9 146 JSMX_COMMAND

LANSA Technical

9.146 JSMX_COMMAND

Þ Note: Built-In Function Rules.

This Built-In Function sends a command string to the JSM connection identified by the handle.

If an optional working list argument is specified then the fields defined in that list are available to the loaded service. If no working list argument is specified then no fields are available to the loaded service. Note that this working list does not need to have any entries.

If an optional working list return value is specified then that working list is available to the loaded service.

See also: 9.147 JSMX_OPEN and 9.145 JSMX_CLOSE.

For use with

LANSA for i

YES

Only available for RDMLX.

Visual LANSA for Windows

YES

Only available for RDMLX.

Visual LANSA for Linux

YES

Only available for RDMLX.

 

 

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

Req

Handle to connection

4

4

 

 

2

U

Req

Command

1

Unlimited

 

 

3

L

Opt

List of field definitions to send/receive. If this list is not passed, no fields will be used.

 

 

 

 

 

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

U

Req

Status

1

20

 

 

2

U

Req

Message

1

Unlimited

 

 

3

L

Opt

Working List

 

 

 

 

 

 

Technical Note 1

  • There is a new keyword: SERVICE_CONTENT
  • It can take one attribute: *HTTP
  • When JSMX_COMMAND sends a SERVICE_LOAD command it may also use the SERVICE_CONTENT keyword.

     Note that the following will ONLY happen if you are running under the context of JSMDirect

If SERVICE_CONTENT(*HTTP) is used in the command string, the following will happen:
If this is the first connection to use SERVICE_CONTENT(*HTTP)
read STDIN (this can only be done once)
this connection takes ownership of JSM_CLOSE (receives STDOUT)
If this is NOT the first connection to use SERVICE_CONTENT(*HTTP)
this connection takes ownership of JSMX_CLOSE (receives STDOUT) - The previous connection loses the ownership.
 

Scenario A:

#1 JSMX_OPEN - open connection
#2 JSMX_OPEN - open connection
#3 JSMX_OPEN - open connection
#1 JSMX_COMMAND( "SERVICE_LOAD(xxx) SERVICE_CONTENT(*HTTP)" ) - send CGI keywords, read STDIN, claim ownership
#2 JSMX_COMMAND( "SERVICE_LOAD(xxx)" )  - send CGI keywords
#3 JSMX_COMMAND( "SERVICE_LOAD(xxx) SERVICE_CONTENT(*HTTP)" ) - send CGI keywords, transfer ownership
#1 JSMX_CLOSE - close connection
#2 JSMX_CLOSE - close connection
#3 JSMX_CLOSE - close connection and write STDOUT
 

Scenario B:

#1 JSMX_OPEN - open connection
#1 JSMX_COMMAND( "SERVICE_LOAD(xxx) SERVICE_CONTENT(*HTTP)" ) - send CGI keywords, read STDIN, claim ownership
#1 JSMX_CLOSE - close connection and write STDOUT
#2 JSMX_OPEN - open connection
#2 JSMX_COMMAND( "SERVICE_LOAD(xxx)" ) - send CGI keywords
#2 JSMX_CLOSE - close connection
#3 JSMX_OPEN - open connection
#3 JSMX_COMMAND( "SERVICE_LOAD(xxx) SERVICE_CONTENT(*HTTP)" ) - send CGI keywords, transfer ownership
#3 JSMX_CLOSE - close connection
 

Note

Only one connection can have ownership of JSMX_CLOSE at a time.

STDIN is read once only.

STDOUT is written once only.

The CGI keywords are always sent.

Technical Note 2

The following datatypes are supported. If any other datatype is used, that datatype will be ignored, that is, not passed to JSM.

TYPE(*CHAR)
TYPE (*DATETIME)
TYPE (*BOOLEAN)
TYPE (*STRING)
TYPE (*INT)
TYPE (*TIME)
TYPE (*DATE)
TYPE (*PACKED)
TYPE (*DEC)
TYPE (*FLOAT)
TYPE (*SIGNED)

Example

Example: To call a command using field list and working list.

USE BUILTIN(JSMX_COMMAND) WITH_ARGS(#JSMHNDL #JSMCMD #FLDLST) TO_GET(#JSMSTS #JSMMSG #WRKLST)