5.16.8 SET

The SET command is used to populate the outbound document object.

Fragments use only fields, so the SET FRAGMENT command requires the SERVICE_EXCHANGE(*FIELD) keyword.

Lists use only a working list, so the SET LIST command requires a working list argument.

Syntax:

Command

Keyword

Value

Developer notes

SET

LIST

value

Conditional. Bind list name.

FRAGMENT

value

Conditional. Bind fragment name.

INSTRUCTION

value

Optional. XML processing instruction.

DATA

value

Conditional. Processing instruction data.

SUBSET

 

Optional. See SUBSET.

 

Example

SET LIST(ORDERS) #WRKLST

 

SET FRAGMENT(DETAIL) SERVICE_EXCHANGE(*FIELD)

 

Note: List and Fragment keywords

There are two possible ways to add a list of data when creating an XML document.

1.  The most obvious way is to use the SET command described here with the LIST keyword, then specifying the array in a working list. With this approach the section of XML would need to be defined as a list in the XML Binding Wizard.

2.  Alternatively, the same could be achieved by using the FRAGMENT keyword inside some looping code. Each loop would add a new row to the list. XML documents and readers will automatically pick up this repeating sequence as a list. With this approach the section of XML would need to be defined as a fragment in the XML Binding Wizard.

Whichever way you choose, you will need to carefully decide whether the relevant section of XML is defined as a List or a Fragment.

Note: Instruction keyword

If you wanted to add an XML processing instruction as follows:

<?xml version="1.0" encoding="utf-8"?>

<?xml-stylesheet type="text/css" href="mystyles.css"?>

 

then you could use the following command:

SET INSTRUCTION(xml-stylesheet) DATA(type="text/css" href="mystyles.css")