READ

LANSA Integrator

READ

The READ command is used to parse and load XML document.

When the READ command is executed, the following steps occur:

1.  The service determines the encoding to apply to the received byte content (of the XML document) to convert it to Unicode content. The default action is to auto-detect the encoding of the XML source. Autodetect will determine the encoding from the XML declaration encoding, for example <?xml version="1.0" encoding="UTF-8"?>.

2.  The service converts the Unicode content to a UTF-8 byte content and parses the content into a document object.

3.  The service determines if the Unicode data needs to be archived.

 

                                                          Required

 

 READ ------------ FILE ------------ file path ------------------>

 

                                                          Optional

 

               >-- ENCODING -------- value ---------------------->

 

               >-- ARCHIVE --------- value ----------------------|

 

Keywords

FILE

This keyword is used to specify the file name and path of the XML document.

It is recommended to use the forward slash as the path separator and to avoid the use of the DOS drive designator.

The format of the path should be as follows:

For Windows you can specify:

  • Absolute path
    For example:
    /orders/order.xml
    C:/orders/order.xml

    C:\orders\order.xml


    or
  • Relative path.
    For example, orders/order.xml (note, no '/' at the start), in which case the order.xml document must reside in the orders directory under the JSM Instance directory on your server.

For the IBM i you can specify:

  • Absolute path.
    For example:
    /orders/order.xml

    or
  • Relative path.
    For example, orders/order.xml (note, no '/' at the start), in which case the order.xml document must reside in the orders directory under the JSM Instance directory on your server.

Note: Whatever directory structure you specify must already exist.

This keyword is mandatory.

ENCODING

Refer to ENCODING for more complete information on this keyword.

The default value for the XMLBindFileService is *AUTODETECT.

This keyword is optional.

ARCHIVE

Refer to ARCHIVE for more complete information on this keyword.

This keyword is optional.

Comments / Warnings

The ARCHIVE keyword is a very useful way to store away XML documents after they have been processed.

Examples

RDML

 

* Define the fields used by the JSM Commands

DEFINE FIELD(#JSMSTS) TYPE(*CHAR) LENGTH(020)

DEFINE FIELD(#JSMMSG) TYPE(*CHAR) LENGTH(256)

DEFINE FIELD(#JSMCMD) TYPE(*CHAR) LENGTH(256)

 

CHANGE FIELD(#JSMCMD) TO('READ FILE(orders/order.xml) ARCHIVE(archive/arc_order.xml)') 

USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG)

 

RDMLX

 

* Define the fields used by the JSM Commands

Define FIELD(#JSMSTS) TYPE(*CHAR) LENGTH(020)

Define FIELD(#JSMMSG) TYPE(*CHAR) LENGTH(256)

Define FIELD(#JSMCMD) TYPE(*CHAR) LENGTH(256)

Define FIELD(#JSMHND) TYPE(*CHAR) LENGTH(4)

 

#JSMCMD := 'READ FILE(orders/order.xml) ARCHIVE(archive/arc_order.xml)'

Use BUILTIN(JSMX_COMMAND) WITH_ARGS(#JSMHND #JSMCMD) TO_GET(#JSMSTS #JSMMSG)