5.9.6 SET

The SET command is used to populate the outbound JSON 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.

The SET command can also be used to include HTTP header properties in the HTTP response protocol.

The HTTP property name value pairs are passed as entries in a two-column working list.

The SET command can be called any time before the SEND command that creates the HTTP response.

Syntax:

Command

Keyword

Value

Developer notes

SET

LIST

value

Conditional. Bind list.

FRAGMENT

value

Conditional. Bind fragment.

SUBSET

 

Optional. See SUBSET.

PROPERTY

*LIST

Conditional. Set HTTP header properties.

 

Example

DEFINE     FIELD(#PNME) TYPE(*CHAR) LENGTH(20)

DEFINE     FIELD(#PVAL) TYPE(*CHAR) LENGTH(20)

DEF_LIST   NAME(#PLST) FIELDS((#PNME) (#PVAL)) TYPE(*WORKING)

 

CHANGE     FIELD(#PNME) TO('''X-Invoice''')

CHANGE     FIELD(#PVAL) TO(T9300)

ADD_ENTRY  TO_LIST(#PLST)

 

USE        BUILTIN(JSM_COMMAND) WITH_ARGS('SET PROPERTY(*LIST) SERVICE_LIST(PNME,PVAL)') TO_GET(#JSMSTS #JSMMSG #PLST)