WRITE

The WRITE command serializes the JSON object out to a specified file. You will use the SET command one or more times prior to using the WRITE command to set up the data in the document.

 

                                                          Required

 

 WRITE ---------- FILE --------------- file path ---------------->

 

                                                          Optional

 

              >-- BINDTRACE ---------- *NO ---------------------->

                                       *YES

 

              >-- FILTER ------------- value --------------------|

 

Keywords

FILE

This keyword is used to specify the file name and path of the JSON document to be created.

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.json
C:/orders/order.json

C:\orders\order.json


or

Relative path.
For example, orders/order.json (note, no '/' at the start), in which case the document order.json will be placed 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.json

or

Relative path.
For example, orders/order.json (note, no '/' at the start), in which case the document order.json will be placed in the orders directory under the JSM Instance directory on your server.

Note: The directory structure must exist.

This keyword is mandatory.

BINDTRACE

This keyword is used to turn on tracing for the outbound bind result.

There are two options:

*YES - to switch tracing on.

*NO - to switch tracing off.

This keyword is optional.

FILTER

Refer to FILTER for more complete information on this keyword.

This keyword is optional.

 

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('WRITE FILE(response/rsp_order.json)')

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 := 'WRITE FILE(response/rsp_order.json)'

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