5.10.5 GET

The GET command is used to read the inbound JSON object.

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

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

The GET command also allows the program to access the HTTP response protocol properties.

Syntax:

Command

Keyword

Value

Developer notes

GET

LIST

value

Conditional. Bind list.

FRAGMENT

value

Conditional. Bind fragment.

SUBSET

 

Optional. See SUBSET.

PROPERTY

value

Get HTTP header property.

*LIST

Get all HTTP header properties.

 

Example

GET LIST(ORDERS) #WRKLST

 

GET FRAGMENT(DETAIL) SERVICE_EXCHANGE(*FIELD)

 

 

Note: List and Fragment keywords

You can only use one keyword at a time.

There are two ways in which you can read a list from an JSON document.

1.  You can either define the relevant section of the JSON code as a list (using the JSON Binding Wizard), and use the LIST keyword in your GET command. This will retrieve the entire list in one go into a working list.

2.  Alternatively, you can define the relevant section as a collection of fragments (using the JSON Binding Wizard) and then use the FRAGMENT keyword in your GET command and place this in a loop.

The following points are important when using GET FRAGMENT and GET LIST together.

When a fragment becomes the current fragment, it is marked as used, so once you leave it, it will not become the current fragment again.