5.34.5 GET
The GET command is used to read the inbound document 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.
Syntax:
Command |
Keyword |
Value |
Developer notes |
GET |
LIST |
value |
Conditional. Bind list. |
FRAGMENT |
value |
Conditional. Bind fragment. |
|
INSTRUCTION |
value |
Optional. XML processing instruction. |
|
SUBSET |
|
Optional. See SUBSET. |
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 XML document.
1. You can either define the relevant section of the XML code as a list (using the XML 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 XML 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 you issue a GET FRAGMENT, that fragment becomes the current fragment. That is, the fragment pointer moves to the current one.
-
You need to read the fragments in an order that allows all fragments to be accessed. You can only access lists and child fragments once you have positioned the fragment pointer to its parent fragment. So, in a way, fragments are a bit like branches on a tree - to access lists and fragments further down the tree you will need to position the fragment pointer to the parent branch.
-
For example, when you issue a GET FRAGMENT, a GET LIST can only access lists within this current fragment. Therefore, you should read all the lists (using GET LIST) in the current fragment before you move on to another. Once you move onto another fragment, then the lists in the previous fragments will not be accessible. You may access the lists within a specific fragment in any order.
-
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.
Note: Instruction keyword
If the XML processing instructions were as per the following example:
<?xml version="1.0" encoding="utf-8"?>
<?Label SLBK|PROFILE|208|SUCCESS?>
<Orders>
Then you could use the following command to retrieve the instruction.
GET INSTRUCTION(Label)