ILE RPG Client JSM API Example
The following example shows how the JSM APIs are used from an ILE RPG program. This example is not a complete RPG program.
D JSMSRV |
S |
50 |
D JSMSTS |
S |
20 |
D JSMMSG |
S |
255 |
D JSMCMD |
S |
255 |
D BYTEDATA |
S |
32767 |
D BYTELENGTH |
S |
10I 0 |
C |
MOVE |
*BLANKS |
JSMSRV |
C |
MOVE |
*BLANKS |
JSMSTS |
C |
MOVE |
*BLANKS |
JSMMSG |
C |
MOVE |
*BLANKS |
JSMCMD |
C |
MOVE |
*BLANKS |
BYTEDATA |
C |
Z-ADD |
32767 |
BYTELENGTH |
*
* Open connect to default JSM server
*
C |
CALLB |
'JSMOPEN' |
|
C |
PARM |
|
JSMSRV |
C |
PARM |
|
JSMSTS |
C |
PARM |
|
JSMMSG |
*
* Send command to service and receive status and response
*
C |
MOVEL |
*BLANKS |
JSMCMD |
*
C |
CALLB |
'JSMCMD' |
|
C |
PARM |
'MYCMD' |
JSMCMD |
C |
PARM |
|
JSMSTS |
C |
PARM |
|
JSMMSG |
*
* Send command and variable data to service
*
C |
MOVEL |
'MYCMD' |
JSMCMD |
*
C |
CALLB |
'JSMCMDX' |
|
C |
PARM |
|
JSMCMD |
C |
PARM |
|
BYTEDATA |
C |
PARM |
|
BYTELENGTH |
C |
PARM |
|
JSMSTS |
C |
PARM |
|
JSMMSG |
*
* Close service
*
C |
CALLB |
'JSMCLOSE' |
|
C |
PARM |
|
JSMSTS |
C |
PARM |
|
JSMMSG |
*
C |
SETON |
|
LR |