Create Command (CRTCMD)

Where allowed to run: All environments (*ALL)
Threadsafe: No
Parameters
Examples
Error messages

The Create Command (CRTCMD) command creates a new user-defined command (that is, a command definition) that can use the same command processing support that is used by IBM-supplied commands. The command definition is an object that can be stored in the general purpose library (QGPL) or in a user library. To update an existing command (for example, change the name of one of its parameter keywords), the existing command must first be deleted by the Delete Command (DLTCMD) command and then created again by the Create Command (CRTCMD) command. However, some of the values can be changed by the Change Command (CHGCMD) command.

To create a command, a set of command definition statements are entered into a source file. The Create Command (CRTCMD) command is used to process the source file and create a command definition object. The following command definition statements are used as needed:

Descriptions of the command definition statements are in the Control Language (CL) topic of the Programming category in the iSeries Information Center at URL http://www.ibm.com/eserver/iseries/infocenter .

Restriction: The CRTCMD command can be used only to create the command definition of an actual CL command. That is, it cannot be used to create definitions of statements, such as the command definition statements themselves.

Top


 

Parameters

Keyword Description Choices Notes
CMD Command Qualified object name Required, Positional 1
Qualifier 1: Command Name
Qualifier 2: Library Name, *CURLIB
PGM Program to process command Single values: *REXX
Other values: Qualified object name
Required, Positional 2
Qualifier 1: Program to process command Name
Qualifier 2: Library Name, *LIBL, *CURLIB
SRCFILE Source file Qualified object name Optional, Positional 3
Qualifier 1: Source file Name, QCMDSRC
Qualifier 2: Library Name, *LIBL, *CURLIB
SRCMBR Source member Name, *CMD Optional, Positional 4
REXSRCFILE REXX source file Qualified object name Optional
Qualifier 1: REXX source file Name, QREXSRC
Qualifier 2: Library Name, *LIBL, *CURLIB
REXSRCMBR REXX source member Name, *CMD Optional
REXCMDENV REXX command environment Single values: *COMMAND, *CPICOMM, *EXECSQL
Other values: Qualified object name
Optional
Qualifier 1: REXX command environment Name
Qualifier 2: Library Name, *LIBL, *CURLIB
REXEXITPGM REXX exit programs Single values: *NONE
Other values (up to 8 repetitions): Element list
Optional
Element 1: Program Qualified object name
Qualifier 1: Program Name
Qualifier 2: Library Name, *LIBL, *CURLIB
Element 2: Exit code 2, 3, 4, 5, 7, 8, 9, 10
THDSAFE Threadsafe *YES, *NO, *COND Optional
MLTTHDACN Multithreaded job action *SYSVAL, *RUN, *MSG, *NORUN Optional
TEXT Text 'description' Character value, *SRCMBRTXT, *CMDPMT, *BLANK Optional
VLDCKR Validity checking program Single values: *NONE
Other values: Qualified object name
Optional
Qualifier 1: Validity checking program Name
Qualifier 2: Library Name, *LIBL, *CURLIB
MODE Mode in which valid Single values: *ALL
Other values (up to 3 repetitions): *PROD, *DEBUG, *SERVICE
Optional
ALLOW Where allowed to run Single values: *ALL
Other values (up to 9 repetitions): *BATCH, *INTERACT, *BPGM, *IPGM, *BREXX, *IREXX, *EXEC, *BMOD, *IMOD
Optional
ALWLMTUSR Allow limited users *NO, *YES Optional
MAXPOS Maximum positional parameters 0-75, *NOMAX Optional
PMTFILE Message file for prompt text Single values: *NONE
Other values: Qualified object name
Optional
Qualifier 1: Message file for prompt text Name
Qualifier 2: Library Name, *LIBL, *CURLIB
MSGF Message file Qualified object name Optional
Qualifier 1: Message file Name, QCPFMSG
Qualifier 2: Library Name, *LIBL, *CURLIB
HLPSHELF Help bookshelf Simple name, *NONE, *LIST Optional
HLPPNLGRP Help panel group Single values: *NONE
Other values: Qualified object name
Optional
Qualifier 1: Help panel group Name
Qualifier 2: Library Name, *LIBL, *CURLIB
HLPID Help identifier Character value, *CMD, *NONE Optional
HLPSCHIDX Help search index Single values: *NONE
Other values: Qualified object name
Optional
Qualifier 1: Help search index Name
Qualifier 2: Library Name, *LIBL, *CURLIB
CURLIB Current library Name, *NOCHG, *CRTDFT Optional
PRDLIB Product library Name, *NOCHG, *NONE Optional
PMTOVRPGM Prompt override program Single values: *NONE
Other values: Qualified object name
Optional
Qualifier 1: Prompt override program Name
Qualifier 2: Library Name, *LIBL, *CURLIB
AUT Authority Name, *LIBCRTAUT, *USE, *ALL, *CHANGE, *EXCLUDE Optional
REPLACE Replace command *YES, *NO Optional
ENBGUI Enable GUI *YES, *NO Optional

Top

 

Command (CMD)

Specifies the command to be created.

Qualifier 1: Command

name

Specify the name of the command to be created.

This is a required parameter.

Qualifier 2: Library

*CURLIB

The command is created in the current library for the job. If no library is specified as the current library for the job, QGPL is used.

name

Specify the name of the library where the command is to be located.

Top

 

Program to process command (PGM)

Specifies the name and library of the command processing program (CPP) used to process the command. The command processing program is not needed until command run time.

The parameters passed to the command processing program are the ones defined by the command definition statements in the source file specified in the Source file (SRCFILE) parameter.

This is a required parameter.

Single values

*REXX

The CPP for this command is the REXX procedure identified on the REXX source member (REXSRCMBR) parameter.

Qualifier 1: Program to process command

name

Specify the name of the CPP that processes the command.

Qualifier 2: Library

*LIBL

All libraries in the library list for the current thread are searched until the first match is found.

*CURLIB

The current library for the job is used to locate the program. If no library is specified as the current library for the job, QGPL is used.

name

Specify the name of the library where the program is located.

Top

 

Source file (SRCFILE)

Specifies the source file that contains the command definition statements.

Qualifier 1: Source file

QCMDSRC

The source file named QCMDSRC contains the command definition statements.

name

Specify the name of the source file that contains the command definition statements for the command being created.

Qualifier 2: Library

*LIBL

All libraries in the library list for the current thread are searched until the first match is found.

*CURLIB

The current library for the job is used to locate the source file. If no library is specified as the current library for the job, QGPL is used.

name

Specify the library name for the source file that contains the command definition statements for the command being created.

Top

 

Source member (SRCMBR)

Specifies the source file member that contains the command definition statements used to create the command.

*CMD

When the file specified for the Source file (SRCFILE) parameter is a database file, the name of the source file member is the name specified for the Command (CMD) parameter of this command.

name

Specify the name of the member in the source file specified for the SRCFILE parameter.

Top

 

REXX source file (REXSRCFILE)

Specifies the source file that contains the REXX command processing program (CPP).

Qualifier 1: REXX source file

QREXSRC

The file named QREXSRC contains the REXX CPP source file member.

name

Specify the name of the source file that contains the source member to use.

Qualifier 2: Library

*LIBL

All libraries in the library list for the current thread are searched until the first match is found.

*CURLIB

The current library is used to locate the source file. If no library is specified as the current library for the job, QGPL is used.

name

Specify the name of the library used to locate the REXX source file.

Top

 

REXX source member (REXSRCMBR)

Specifies the source file member that contains the REXX procedure that is to function as the apparent command processing program (CPP).

*CMD

The default member name is the name specified for the Command (CMD) parameter of this command.

name

Specify the name of the source file member that contains the REXX procedure that is to function as the apparent command processing program.

Top

 

REXX command environment (REXCMDENV)

Specifies the command environment that is active when the REXX command processing program (CPP) starts to run. If the system control language (CL) environment is not used, a program can be specified to process commands found in the REXX procedure. The REXX interpreter calls this program to process commands encountered in the procedure. This environment can be changed through the REXX ADDRESS instruction.

Single values

*COMMAND

The control language (CL) command environment is used.

*CPICOMM

The Common Programming Interface (CPI) for Communications command environment is used. CPICOMM is the command environment used for CL commands that are embedded within a REXX procedure.

*EXECSQL

The Structured Query Language (SQL) Command environment is used. EXECSQL is the command environment used for CL commands that are imbedded within a SQL procedure.

Qualifier 1: REXX command environment

name

Specify the name of the program to be called to process commands that are embedded in the REXX procedure.

Qualifier 2: Library

*LIBL

All libraries in the library list for the current thread are searched until the first match is found.

*CURLIB

The current library for the job is used to locate the program. If no library is specified as the current library for the job, QGPL is used.

name

Specify the name of the library where the program is located.

Top

 

REXX exit programs (REXEXITPGM)

Specifies the exit programs to be used when the REXX command processing program (CPP) is started. A maximum of eight program and exit code combinations can be specified.

Single values

*NONE

There are no exit programs for the REXX CPP.

Element 1: Program

Qualifier 1: Program

name

Specify the name of the exit program.

Qualifier 2: Library

*LIBL

All libraries in the library list for the current thread are searched until the first match is found.

*CURLIB

The current library list is used to locate the program. If no library is specified as the current library for the job, QGPL is used.

name

Specify the name of the library to be searched.

Element 2: Exit code

2

The associated program is called whenever an external function or subroutine has been called by the REXX program. The exit program is then responsible for locating and calling the requested routine.

3

The associated program is called whenever the interpreter is going to call a command. The exit program is responsible for locating and calling the command given the command string and the current environment name.

4

The associated program is called whenever a REXX instruction or function attempts an operation on the REXX external data queue.

5

The associated program is called when session input or output operations are attempted.

7

The associated program is called after running each clause of the REXX procedure to determine whether it should be halted.

8

The associated program is called after running each clause of the REXX program to check whether tracing should be turned on or off.

9

The associated program is called before interpretation of the first instruction of a REXX procedure (including REXX procedures called as external functions and subroutines).

10

The associated program is called after interpretation of the last instruction of a REXX procedure (including REXX procedures called as external functions and subroutines).

Top

 

Threadsafe (THDSAFE)

Specifies whether the command is threadsafe and can be used safely in a job that has multiple threads.

*NO

The command is not threadsafe and should not be used in a job that has multiple threads.

*YES

The command is threadsafe and can be used safely in a job that has multiple threads.

*COND

The command is threadsafe under certain conditions. See the online help or other documentation for the command to determine the conditions under which the command is threadsafe.

Top

 

Multithreaded job action (MLTTHDACN)

Specify the multithreaded job action for this command. If you do not know the action to take in a multithreaded job, use the default value of *SYSVAL.

*SYSVAL

The multithreaded job action specified in the QMLTTHDACN system value is used.

*RUN

Run the command.

*MSG

Run the command and send a diagnostic message.

*NORUN

Do not run the command.

Top

 

Text 'description' (TEXT)

Specifies the text that briefly describes the object.

*SRCMBRTXT

The text is taken from the source file member used to create the CL command.

*CMDPMT

The text is taken from the text defined for the PROMPT keyword of the CMD statement in the command definition source.

*BLANK

No text is specified.

'description'

Specify no more than 50 characters of text, enclosed in apostrophes.

Top

 

Validity checking program (VLDCKR)

Specifies the program that performs additional validity checking on the parameters in the command being created. The same parameters that are passed to the command processing program (CPP) are also passed to the validity checking program. The validity checker performs additional parameter checking beyond that specified by the command definition statements in the source file, and beyond normal control language syntax checking. More information on validity checking is in the CL information in the iSeries Information Center at http://www.ibm.com/eserver/iseries/infocenter.

Single values

*NONE

There is no separate validity checking program for this command. All validity checking is done by the command analyzer and the command processing program. Whenever the command is processed or checked for validity, provided variables and expressions are not used.

Qualifier 1: Validity checking program

name

Specify the name and library of the validity checking program that checks the validity of the command.

Qualifier 2: Library

*LIBL

All libraries in the library list for the current thread are searched until the first match is found.

*CURLIB

The current library for the job is used to locate the program. If no library is specified as the current library for the job, QGPL is used.

name

Specify the name of the library where the validity checking program is located.

Top

 

Mode in which valid (MODE)

Specifies the modes of operating environment to which the newly defined command applies.

Single values

*ALL

The command is valid in all the types of modes: production, debug, and service.

Other values (up to 3 repetitions)

*PROD

The command is valid for production mode operations.

*DEBUG

The command is valid for debug mode operations.

*SERVICE

The command is valid for service mode operations.

Top

 

Where allowed to run (ALLOW)

Specifies where the command can be processed.

Single values

*ALL

The command can be processed in a batch input stream, in a CL program, in a REXX procedure, in a CL ILE module, or when processed interactively. It can also be passed to the system program QCMDEXC (or QCAEXEC) for processing.

Other values (up to 9 repetitions)

*BATCH

The command can be processed in a batch input stream, external to a compiled CL program.

*INTERACT

The command can be processed interactively, external to a compiled CL program.

*BPGM

The command can be processed in a compiled CL program that is called from batch entry.

*IPGM

The command can be processed in a compiled CL program that is called from interactive entry.

*BREXX

The command can be used in a REXX procedure run in a batch job.

*IREXX

The command can be used in a REXX procedure run in an interactive job.

*BMOD

The command can be used in a batch CL ILE program only.

*IMOD

The command can be used in a interactive CL ILE program only.

*EXEC

The command can be used as a parameter on the CALL command and be passed as a character string to the system program QCMDEXC (or QCAEXEC) for processing. If *EXEC is specified, either *BATCH or *INTERACT must also be specified.

Top

 

Allow limited users (ALWLMTUSR)

Specifies whether a user whose profile is set for limited capabilities is allowed to use the command by typing it in the command line on a menu.

*NO

This command cannot be entered in the command line on a menu by a user whose profile is set for limited capabilities.

*YES

This command can be entered in the command line on a menu by a user whose profile is set for limited capabilities.

Top

 

Maximum positional parameters (MAXPOS)

Specifies the maximum number of parameters that can be specified positionally (without the parameter keyword) for this command. This parameter value must be greater than the number of nonconstant required parameters and less than the total number of nonconstant parameters. Parameters of TYPE(*ZEROELEM), parameters with the CONSTANT attribute, and lists and qualified names whose ELEMs and QUALs have the CONSTANT attribute or are of TYPE(*ZEROELEM) are not included in the number of parameters that can be coded positionally for this command.

*NOMAX

No maximum positional coding limit is specified for this command.

0-75

Specify the maximum number of positional parameters.

Top

 

Message file for prompt text (PMTFILE)

Specifies the message file from which the prompt text for the command is retrieved.

Single values

*NONE

No message file is needed for the prompt text. The text, if any, is supplied in the definition statements that define the command.

Qualifier 1: Message file for prompt text

name

Specify the name of the message file.

Qualifier 2: Library

*LIBL

All libraries in the library list for the current thread are searched until the first match is found.

*CURLIB

The current library for the job is used to locate the message file. If no library is specified as the current library for the job, QGPL is used.

name

Specify the name of the library where the message file is located.

Top

 

Message file (MSGF)

Specifies the message file from which messages identified on the Dependency (DEP) command definition statements are retrieved. The Message identifier (MSGID) parameter on the DEP statements lets you specify the message identifier to be sent if a parameter syntax error is detected. For message identifies with a three-character prefix other than 'CPF', the message file specified for this parameter will be used. QCPFMSG is always used for as the message file for messages that have the prefix 'CPF' in the message identifier.

Qualifier 1: Message file

QCPFMSG

Message file QCPFMSG is the file from which DEP error messages are retrieved.

name

Specify the name of the message file from which DEP error messages are retrieved.

Qualifier 2: Library

*LIBL

All libraries in the library list for the current thread are searched until the first match is found.

*CURLIB

The current library for the job is used to locate the message file. If no library is specified as the current library for the job, QGPL is used.

name

Specify the name of the library where the message file is located.

Top

 

Help bookshelf (HLPSHELF)

This parameter is no longer supported.

Top

 

Help panel group (HLPPNLGRP)

Specifies the help panel group for this command.

Single values

*NONE

No help panel group is specified.

Qualifier 1: Help panel group

name

Specify the name of the help panel group for this command.

Qualifier 2: Library

*LIBL

All libraries in the library list for the current thread are searched until the first match is found.

*CURLIB

The current library for the job is used to locate the panel group. If no library is specified as the current library for the job, QGPL is used.

name

Specify the name of the library where the panel group is located.

Top

 

Help identifier (HLPID)

Specifies the root name for all help section identifiers for this command. All help sections in the help panel group associated with this command will begin with this name.

*NONE

No help identifier is specified. *NONE is not allowed if a panel group name is specified for the Help panel group (HLPPNLGRP) parameter.

*CMD

The name of the command is to be used as the root for help section identifiers in the help panel group.

name

Specify the root name for the help section identifiers for this command.

Top

 

Help search index (HLPSCHIDX)

Specifies the help search index to use when the search index function key is pressed from the help screen.

Single values

*NONE

No help search index is associated with this command.

Qualifier 1: Help search index

name

Specify the name of the search index to be used when the search index function key is pressed.

Qualifier 2: Library

*LIBL

All libraries in the library list for the current thread are searched until the first match is found.

*CURLIB

The current library for the job is used to locate the search index. If no library is specified as the current library for the job, the QGPL library is used.

name

Specify the name of the library where the search index is located.

Top

 

Current library (CURLIB)

Specifies the name of the current library associated with the job being run.

This library is also the current library when the validity checker program (if any) is processed for the command.

*NOCHG

The current library does not change for the processing of this command. If the current library is changed during processing of the command, the change remains in effect after command processing is complete.

*CRTDFT

No current library is active during the processing of the command. The current library that was active before command processing began is restored when processing is completed.

If *CURLIB was specified as the to-value for any single values or special values for this command, or for any command processed while no current library is active, the QGPL library is used as the current library.

name

Specify the name of the library that is used as the current library. The library need not exist when the command is created, but must exist when the command is processed. When command processing is completed, the current library is restored to its previous value. If the current library is changed during command processing by the Change Library List (CHGLIBL) command or Change Current Library (CHGCURLIB) command, the change is effective only until the command is processed. QTEMP cannot be specified for the current library.

Top

 

Product library (PRDLIB)

Specifies the product library that is to be in effect during the processing of the command.

The product library for a command or menu remains in the library list while a command or menu is active, unless another command or menu changes the product library. When a command or menu that changed the product library ends, the product library is restored to what it was when the command or menu started.

*NOCHG

The product library is not changed when processing of the command starts. If the product library is changed during the processing of the command, the change remains in effect after command processing is complete.

*NONE

There is no product library in the job's library list. The product library is restored to its previous value when command processing is complete.

name

Specify the name of the library to be used as the product library during command processing. The library need not exist when the command is created, but must exist when the command is processed. When command processing is completed, the product library is restored to its previous value. QTEMP cannot be specified for the product library.

Top

 

Prompt override program (PMTOVRPGM)

Specifies the name and library of the prompt override program (POP) that will replace (on the prompt display) the default values with the current actual values specified for the parameter. If a POP is specified, the key parameters (specified as KEYPARM(*YES) on the PARM statement in the command definition source) are the only parameters visible on the initial prompt display. When values are input for the key parameters, the remaining parameters are shown on the display with the actual values instead of the default values.

*NONE

No prompt override program is specified.

If *NONE is specified when key parameters exist in the command definition source (that is when KEYPARM(*YES) is specified on the PARM statement), a warning message is issued when the command is created, and KEYPARM(*NO) will be assumed for all parameters.

name

Specify the name of the prompt override program for the command.

Qualifier 2: Library

*LIBL

All libraries in the library list for the current thread are searched until the first match is found.

*CURLIB

The current library for the job is used to locate the prompt override program. If no library is specified as the current library for the job, QGPL is used.

name

Specify the name of the library where the prompt override program is located.

Top

 

Authority (AUT)

Specifies the authority you are giving to users who do not have specific authority for the object, who are not on an authorization list, and whose group profile or supplemental group profiles do not have specific authority for the object.

*LIBCRTAUT

The system determines the authority for the object by using the value specified on the Create authority (CRTAUT) parameter on the Create Library command (CRTLIB) for the library containing the object to be created. If the value specified on the Create authority (CRTAUT) parameter is changed, the new value will not affect any existing objects.

*CHANGE

The user can perform all operations on the object except those limited to the owner or controlled by object existence (*OBJEXIST) and object management (*OBJMGT) authorities. The user can change and perform basic functions on the object. *CHANGE authority provides object operational (*OBJOPR) authority and all data authority. If the object is an authorization list, the user cannot add, change, or remove users.

*ALL

The user can perform all operations except those limited to the owner or controlled by authorization list management (*AUTLMGT) authority. The user can control the object's existence, specify the security for the object, change the object, and perform basic functions on the object. The user also can change ownership of the object.

*USE

The user can perform basic operations on the object, such as running a program or reading a file. The user cannot change the object. Use (*USE) authority provides object operational (*OBJOPR), read (*READ), and execute (*EXECUTE) authorities.

*EXCLUDE

The user cannot access the object.

name

Specify the name of an authorization list. Users included on the authorization list are granted authority to the object as specified by the list. The authorization list must exist when the object is created.

Top

 

Replace command (REPLACE)

Specifies whether or not an existing commmand object with the same name and library as the command being created should be replaced.

If you specify *YES and a command object already exists with the same name and in the same library, the existing command is renamed and moved to library QRPLOBJ, and will be deleted the next time an IPL of the operating system occurs.

*YES

If the create operation is successful, existing commands are replaced by new versions of the same command.

*NO

Existing commands are not replaced, and the creation of new commands with the same name, type, and library as the existing commands is not allowed.

Top

 

Enable GUI (ENBGUI)

Specifies whether the command prompt panels are enabled for conversion to a graphical user interface.

*NO

The command prompt panels are not enabled for conversion to a graphical user interface.

*YES

The command prompt panels are enabled for conversion to a graphical user interface by including information about the panel content in the 5250 data stream.

Top


 

Examples

 CRTCMD   CMD(PAYROLL)  PGM(PAY076)  SRCFILE(PAYSOURCE)
         AUT(*EXCLUDE)

The command named PAYROLL is created from the source file PAYSOURCE. The command is private and calls the command processing program (CPP) named PAY076. It is a valid command when entered in a batch input stream, when compiled in a control language program, when entered interactively, or when passed to the QCMDEXC program.

Top


 

Error messages

*ESCAPE Messages

CPF0201

Command &2 not created in library &3.

CPF0210

Cannot open printer file.

CPF0212

Unable to open source file.

Top