BIND
The BIND command binds the specified service code to the loaded inbound document or creates a new empty outbound document.
The service specified as a part of the command will have been created using the JSON Binding Wizard in LANSA Integrator Studio.
You will need to specify the type of bind as outbound or inbound - a READ is normally associated with an inbound type while a WRITE is normally associated with an outbound type.
Required
BIND --------- SERVICE -------- value -------------------------->
>-- TYPE ----------- *INBOUND ----------------------->
*OUTBOUND
Optional
>-- BINDTRACE ------ *NO ---------------------------->
*YES
>-- FILTER --------- value --------------------------|
Keywords
SERVICE |
This keyword is used to in an JSONBindFileService property lookup using service.'value' and service.archive.'value' to locate the binding class and binding jar file to be used. The value here will be the corresponding service class name that was defined in the JSON Binding Wizard. This keyword is mandatory. |
TYPE |
This keyword is used to specify the type of bind to be performed, and it will depend on whether you are intending to perform a READ of an existing file or a WRITE of a new file. There are two possible values: *INBOUND - using this value will bind the specified service code to the inbound document loaded as a part of the preceding READ command. *OUTBOUND - using this value will create a new empty outbound document. This keyword is mandatory. |
BINDTRACE |
This keyword is used to turn on tracing for the inbound 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. |
Comments / Warnings
The position of the BIND command in the code depends on whether you are intending to read data from an existing JSON document or you are intending to create a new JSON document. If you are reading data from an existing JSON document, the code flow will look something like this:
JSM(X)_OPENJSM(X)_COMMANDsSERVICE_LOAD
READ
BIND
GET (one or more times)
CLOSE
SERVICE_UNLOAD
JSM(X)_CLOSEWhereas, an application that needs to WRITE to a JSON document would typically issue the following sequence of commands:
JSM(X)_OPENJSM(X)_COMMANDsSERVICE_LOAD
BIND
SET (one or more times)
WRITE
CLOSE
SERVICE_UNLOAD
JSM(X)_CLOSEExamples
RDML
* Define JSM fields
DEFINE FIELD(#JSMSTS) TYPE(*CHAR) LENGTH(020)
DEFINE FIELD(#JSMMSG) TYPE(*CHAR) LENGTH(256)
DEFINE FIELD(#JSMCMD) TYPE(*CHAR) LENGTH(256)
* Bind
CHANGE FIELD(#JSMCMD) TO('BIND SERVICE(INBOUNDORDER) TYPE(*INBOUND) BINDTRACE(*YES)')
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 := 'BIND SERVICE(INBOUNDORDER) TYPE(*INBOUND) BINDTRACE(*YES)'
Use Builtin(JSMX_COMMAND) With_Args(#JSMHND #JSMCMD) To_Get(#JSMSTS #JSMMSG)