Running APIs from an IBM i command line
When running the ARSxxxxxx programs from an IBM® i command
line, the IBM i QSH command is used. When embedded single
quotation marks exist within the program parameter, they must be doubled. For
example:
QSH CMD('arsdoc get ...... "-i WHERE Account#=''1234567'' "....-u testadmin -p ondemand')
Since the QSHELL environment will log messages to the terminal, you want to control this by
setting environment variable QIBM_QSH_CMD_OUTPUT. This variable controls where the messages are
logged. This does not interfere with the messages that get logged to the System Log. The QSHELL
environment logging can be sent to the terminal session, to a file in the IFS directory structure,
or you can choose not to log the messages. The Add Environment Variable (ADDENVVAR), Change
Environment Variable (CHGENVVAR), Remove Environment Variable (RMVENVVAR), and Work with Environment
Var (WRKENVVAR) commands can be used to manipulate the QSHELL environment. The environment
parameters can be set for the entire system and for the job. In most cases, you do not want to
change the environment parameter at the system level, because it affects all users of QSHELL on the
system.
- Set the job environment to log messages to the terminal
ADDENVVAR ENVVAR(QIBM_QSH_CMD_OUTPUT) VALUE(STDOUT) LEVEL(*JOB)
- Set the system environment to not log messages.
ADDENVVAR ENVVAR(QIBM_QSH_CMD_OUTPUT) VALUE(NONE) LEVEL(*SYS)
- Set the job environment to log messages to a file in the IFS. In the example, a directory that
is named mydirectory must exist in the IFS.
ADDENVVAR ENVVAR(QIBM_QSH_CMD_OUTPUT)VALUE('FILE=/mydirectory/QSHELL_output') LEVEL(*JOB)
The following is an example of the messages that might be displayed to the terminal or logged in
the output file.
OnDemand Load Id = >8495-53-0-1FAA-20130627000000-20130627000000-8496<
Loaded 4 rows into the database
Document compression type used - OD77. Bytes Stored = >10240<
Message QSH0005 is issued in the job log when running the QSH command. The message text is
Command ended normally with exit status &1. The possible statuses returned are
shown in the following table.
Status | Description |
---|---|
0 | Completed Successfully |
1 | Command Failure |
2 | Folder does not exist or do not have authority to folder |
3 | User ID or Password is not valid. Cannot establish communication to server |
127 | Command Not Found |
254 | No Hits Match Query |
The following environmental variables should also be set if required for your Content Manager OnDemand for i implementation:
Environmental variable | Purpose | Suggested command to set recommended value |
---|---|---|
QIBM_MULTI_THREADED | Required for ARSLOAD if indexing PDF files, for ARSODF, and for ARSPDOCI and ARSPDUMP. | ADDENVVAR ENVVAR(QIBM_MULTI_ THREADED) VALUE('Y') LEVEL(*xxx) |
LIBPATH | Required for ARSPDOCI and ARSPDUMP, which run in PASE and are dependent on shared libraries whose location is identified by this LIBPATH setting. | ADDENVVAR ENVVAR(LIBPATH) VALUE('/QIBM/ProdData/OnDemand/bin') LEVEL(*xxx) |
Note: The value for *xxx is either *SYS or
*JOB. Specifying LEVEL(*SYS) for QIBM_MULTI_THREADED affects all jobs on the system. Specifying LEVEL(*SYS) for LIBPATH makes the value effective for all PASE and Java applications.