system - Run CL command
Synopsis
system [-iKknpqsv] CLcommand [ arg
... ]
Description
The system utility runs a CL command. Any spool file output
generated by CLcommand is written to standard output. By
default, the spool files are deleted after they are written and the
job log of the job running system is deleted.
Any messages generated by CLcommand are written to
standard error. By default, all messages generated by
CLcommand are written using the following format:
MsgId: Text
where "MsgId" is the seven character i5/OS(TM) message identifier
(for example CPF0001) and "Text" is the text of the message.
Use the -n option to not include the "MsgId" prefix.
By default, system checks the number of threads
running in the job. If there is more than one thread running, it
starts a second job and runs CLcommand in the second job.
Use the -i option to force system to always run
CLcommand in the current job.
Options
- -i
- Always run CLcommand in the current job and set the exit status
to the ILE return code of the program called by CLcommand. Note
that some CL commands do not run in a multi-thread capable job or when there
are multiple threads running in the job.
- -K
- Keep all spool files generated by CLcommand and the
job log of the job running system. If this option is
not specified, all spool files are deleted after they are written and
the job log is deleted.
- -k
- Keep all spool files generated by CLcommand. If this option
is not specified, all spool files are deleted after they are written.
- -n
- Do not include the message identifier when writing the messages
to standard error. Only the message text of the messages are written
to standard error. This option is ignored if the -q
option is also specified.
- -p
- Only write the messages sent to the program's message
queue by CLcommand to standard error. This option is ignored
if the -q option is also specified.
- -q
- Do not write messages generated by CLcommand to
standard error.
- -s
- Do not write spool files generated by CLcommand to
standard output.
- -v
- Write the complete command string to standard output before running it.
Note that for compatibility with the PASE system utility, system
does not return an error if the -b, -e,
-E, -I, or -O options are
specified, but the options are ignored.
Operands
Each arg is a parameter to CLcommand. You may need
to enclose CLcommand and args in quotes to
prevent qsh from expanding any special characters
in them. Both CL and qsh use some of the same
special characters, for example, the asterisk (*) character.
Environment Variables
The system utility is affected by the following
environment variables:
- QIBM_SYSTEM_ALWMLTTHD
- Set this environment variable to control how the
system utility behaves in a multi-thread capable job. If
the value of the variable is "N", system starts
a new job to run the CL command when the current job is multi-thread
capable even if there is only one thread running in the job. There is
no default value.
- QIBM_SYSTEM_USE_ILE_RC
- Set this environment variable to control how the system
utility sets the exit status. If the value of the variable is "Y",
system sets the exit status to the ILE return code of the
program called by CLcommand, or zero if the program did not set a
return code. There is no default value. The environment variable is ignored
if the -i option is specified.
Exit Status
- 0 when CLcommand is successful
- >0 when CLcommand is unsuccessful or when set by the program
called by CLcommand
When the -i option is specified or the environment variable
QIBM_SYSTEM_USE_ILE_RC=Y is set, system sets the exit status
to the ILE return code of the program called by CLcommand, or
zero if the program did not set a return code.
Related Information
Examples
- List all of the active jobs:
system wrkactjob
- Create a test library:
system "CRTLIB LIB(TESTDATA) TYPE(*TEST)"
- Delete a library and do not write any messages:
system -q "DLTLIB LIB(TESTDATA)"