CONNECT
The CONNECT command connects to the IBM i host machine. If no HOST keyword is present then the connection is established using the native access method.
CONNECT ----- HOST -------- host:port ------------------------>
>-- USER -------- user profile --------------------->
>-- PASSWORD ---- password -------------------------|
Keywords
HOST |
Nominate a host to connect to. If no HOST keyword is present then the connection is established to the same machine where the JSM Server is active. |
USER |
User profile to be used for connection to host. |
PASSWORD |
Password for supplied user. |
Comments / Warnings
To use the CONNECT command without specifying a specific HOST, USER and PASSWORD, the JSM Server must be running on the IBM i where you are attempting to retrieve spool files.
Examples
RDML
USE BUILTIN(JSM_COMMAND) WITH_ARGS('CONNECT') TO_GET(#JSMSTS #JSMMSG)
or
CHANGE FIELD(#JSMCMD) TO(''' CONNECT HOST(ISERIES1) USER(USERXX) PASSWORD(XXXXXX)''')
USE BUILTIN(JSM_COMMAND) WITH_ARGS(#JSMCMD) TO_GET(#JSMSTS #JSMMSG)
RDMLX
In this example you explicitly OPEN the JSM Server on the IBM i where you intend to retrieve spool files. By nominating the <host>:<port> on the JSMX_OPEN command you can then CONNECT to the same server without specifying a HOST, USER or PASSWORD.
* connect the JSMX client to an IBM i based Java Service Manager and start a thread for the service
use builtin(jsmx_open) with_args('ISERIES1:4570') TO_GET(#jsmxsts #jsmxmsg #jsmxhdle1)
* Load the service
#jsmcommand := 'SERVICE_LOAD SERVICE(PDFSPOOLFILESERVICE)'
use builtin(jsmx_command) with_args(#jsmxhdle1 #jsmcommand) TO_GET(#jsmxsts #jsmxmsg)
* connect to the IBM i host
use builtin(jsmx_command) with_args(#jsmxhdle1 'Connect') TO_GET(#jsmxsts #jsmxmsg)
or
If by default the JSMX_OPEN connects to a JSM Server running on a different machine than where you want to retrieve the spool files information, you will need to supply the HOST, USER and PASSWORD for the machine you want to CONNECT to.
* connect the JSMX client to an IBM i based Java Service Manager and start a thread for the service
use builtin(jsmx_open) to_get(#jsmxsts #jsmxmsg #jsmxhdle1)
* Load the service
#jsmcommand := 'SERVICE_LOAD SERVICE(PDFSPOOLFILESERVICE)'
use builtin(jsmx_command) with_args(#jsmxhdle1 #jsmcommand) TO_GET(#JSMSTS #JSMMSG)
* connect to the IBM i host
#jsmcommand := 'Connect Host(' + #JSMServer + ') User(' + #JSMUserid + ') password(' + #JSMpassword + ')'
use builtin(jsmx_command) with_args(#jsmxhdle1 #jsmcommand) TO_GET(#jsmxsts #jsmxmsg)