XmlDS (‘Filename’ : Data record : sequence : altname)
Filename = Constant or alphanumeric field (10A)
Data record = the corresponding data structure with data
Sequence = sequence number for multiple occurrences (optional)
Altname = An alternate name for the definition (optional)


Return type:
XML encoded string

Description:
XmlDS returns a XML encoded string. The individual fields is retrieved from the file description of the filename in parameter 1. The encoding of the individual fields is taken from the administration setup. The data inserted into the XML string is retrieved from the data record, sent as parameter 2.

The first time the command is used, the administration setup is automatically created. If a field is located in SSAPD012P the field is automatically activated. If the field is located in SSAPD014P it is also activated and created as a list box or radio button.

This is normally used in conjunction with PutXmlRec function

Sequence is used for having multiple fields with the same name. This is used for multi-line entry screens. This way the fields can be retrieved the same way.

Altname – normally the definitions are stored under function/subfunction. But in most cases the definitions are the same for e.g. subfunction, delete/create/edit/display, so instead of creating and maintaining 4-5 the “same” definitions, “alt name” can be used. So all the xmlDS uses the same altname and therefore the same definitions. (open and closed fields can still be achieved using fs_disabled functionality. E.g. the definitions for display and update are the same, but display has fs_disabled = disabled.

Example:

String = xmlDS(‘Customerfile’ : customer_rec : 0 : ‘update’)

Uses the File description of the customerfile (Even though you program uses a logical file, use the name of the physical file here) Then the commend places the data from the customer_record into the correct fields, using the setup in “field definitions” in the administrator menu. As we use ‘update’ as the altname, a sequence must be provided, but we have no use for one, so it’s 0, which equals “no sequence”.

See program CSMAIM62R for more detail on use and the Administrator section for definition explanation.

Notes and Restrictions:
Remember that the layout of the second variable, MUST match the filename in variable 1.
The variable name is converted to upper case.