Common commands used in CL procedures

This contains a list of commands that are frequently used in CL procedures.

You can use this list to select the appropriate command for the function you want. Superscript 1 indicates the commands that you can use only in CL programs and procedures.

System Function Command Command Function
Change Procedure Control Call (CALL) Calls a program
  Call Procedure (CALLPRC) 1 Calls a procedure.
  Return (RETURN) Returns to the command following the command that caused a program or procedure to be run
CL Procedure Limits Program (PGM) 1 Indicates the start of CL procedure source
  End Program (ENDPGM) 1 Indicates the end of CL procedure source
CL Procedure Logic If (IF) 1 Processes commands based on the value of a logical expression
  Else (ELSE) 1 Defines the action to be taken for the else (false) condition of an IF command
  Do (DO) 1 Indicates the start of a Do group
  Do While (DOWHILE)1 Indicates the start of a Do group that processes a set of commands while the value of a logical expression remains true
  Do Until (DOUNTIL)1 Indicates the start of a Do group that processes a set of commands until the value of a logical expression is true
  Do For (DOFOR)1 Indicates the start of a Do group that processes commands zero or more times based on specified values
  Leave (LEAVE) 1 Ends processing of commands in a Do While, Do Until, or Do For group
  Iterate (ITERATE) 1 Ends processing of commands in a Do While, Do Until, or Do For group, and evaluates the group conditions again
  End Do (ENDDO) 1 Indicates the end of a Do group
  Go To (GOTO) 1 Branches to another command
  Select (SELECT)1 Indicates the start of a Select group, which allows conditional processing of command groups
  When (WHEN)1 Processes commands in a Select group when the value of a logical expression is true
  Otherwise (OTHERWISE) 1 Defines the commands to be processed if no conditions on a When command in a Select group are true
  End Select (ENDSELECT) 1 Indicates the end of a Select group
  Call Subroutine (CALLSUBR)1 Passes control to a subroutine defined within the same procedure
  Subroutine (SUBR)1 Delimits the group of commands which define a subroutine
  Return Subroutine (RTNSUBR)1 Exits a subroutine
  End Subroutine (ENDSUBR)1 Ends a subroutine
CL Procedure Variables Change Variable (CHGVAR)1 Changes the value of a CL variable
  Declare (DCL) 1 Declares a variable
Conversion Change Variable (CHGVAR)1 Changes the value of a CL variable
  Convert Date (CVTDAT) 1 Changes the format of a date
Data Areas Change Data Area (CHGDTAARA) Changes a data area
  Create Data Area (CRTDTAARA) Creates a data area
  Delete Data Area (DLTDTAARA) Deletes a data area
  Display Data Area (DSPDTAARA) Displays a data area
  Retrieve Data Area (RTVDTAARA) 1 Copies the content of a data area to a CL variable
Files End Receive (ENDRCV) 1 Cancels a request for input previously issued by a RCVF, SNDF, or SNDRCVF command to a display file
  Declare File (DCLF) 1 Declares a display or database file
  Receive File (RCVF) 1 Reads a record from a display or database file
  Retrieve Member Description (RTVMBRD) 1 Retrieves a description of a specific member of a database file
  Send File (SNDF) 1 Writes a record to a display file
  Send/Receive File (SNDRCVF) 1 Writes a record to a display file and reads that record after the user has replied
  Wait (WAIT) 1 Waits for data to be received from an SNDF, RCVF, or SNDRCVF command issued to a display file
Messages Monitor Message (MONMSG) 1 Monitors for escape, status, and notify messages sent to a program's message queue
  Receive Message (RCVMSG) 1 Copies a message from a message queue into CL variables in a CL procedure
  Remove Message (RMVMSG) 1 Removes a specified message from a specified message queue
  Retrieve Message (RTVMSG) 1 Copies a predefined message from a message file into CL procedure variables
  Send Program Message (SNDPGMMSG) 1 Sends a program message to a message queue
  Send Reply (SNDRPY) 1 Sends a reply message to the sender of an inquiry message
  Send User Message (SNDUSRMSG) Sends an informational or inquiry message to a display station or system operator
Miscellaneous Commands Check Object (CHKOBJ) Checks for the existence of an object and, optionally, the necessary authority to use the object
  Print Command Usage (PRTCMDUSG) Produces a cross-reference listing for a specified group of commands used in a specified group of CL procedures
  Retrieve Configuration Source (RTVCFGSRC) Generates CL command source for creating existing configuration objects and places the source in a source file member
  Retrieve Configuration Status (RTVCFGSTS) 1 Gives applications the capability to retrieve configuration status from three configuration objects: line, controller, and device.
  Retrieve Job Attributes (RTVJOBA) 1 Retrieves the value of one or more job attributes and places the values in a CL variable
  Retrieve System Value (RTVSYSVAL) 1 Retrieves a system value and places it into a CL variable
  Retrieve User Profile (RTVUSRPRF) 1 Retrieves user profile attributes and places them into CL variables
Program Creation Commands Create CL Module (CRTCLMOD) Creates a CL module
  Delete Module (DLTMOD) Deletes a module
  Delete Program (DLTPGM) Deletes a program
  Create Bound Control Language Program (CRTBNDCL) Creates a bound CL program.
  Create CL Program (CRTCLPGM) Creates an OPM CL program.
  Create Program (CRTPGM) Creates a program from one or more modules.
  Create Service Program (CRTSRVPGM) Creates a service program from one or more modules.
Related information
CL command finder