Common commands used in CL programs and procedures

The list contains the commands frequently used in CL programs and procedures. You can use this list to select the appropriate command for the function you want.

System function Command Command function
Change program or procedure control Call (CALL) Calling a program.
Call Procedure (CALLPRC)1 Calling a procedure.
Return (RETURN) Returning to the command following the command that causes a program or procedure to run.
CL program or procedure limits End Program (ENDPGM)1 Indicating the end of a CL source program.
Program (PGM)1 Indicating the start of a CL source program.
CL program or procedure logic Call Subroutine (CALLSUBR)1 Passing control to a subroutine that is defined within the same program or procedure.
Do (DO)1 Indicating the start of a Do group.
Do For (DOFOR)1 Indicating the start of a Do group that processes commands zero or more times based on specified values.
Do Until (DOUNTIL)1 Indicating the start of a Do group that processes a set of commands until the value of a logical expression is true.
Do While (DOWHILE)1 Indicating the start of a Do group that processes a set of commands while the value of a logical expression remains true.
Else (ELSE)1 Defining the action to be taken for the else (false) condition of an IF command.
End Do (ENDDO)1 Indicating the end of a Do group.
End Select (ENDSELECT)1 Indicating the end of a Select group.
End Subroutine (ENDSUBR)1 Ending a subroutine.
Go To (GOTO)1 Branching to another command.
If (IF)1 Processing commands based on the value of a logical expression.
Iterate (ITERATE)1 Ending processing of commands in a Do While, Do Until, or Do For group, and evaluates the group conditions again.
Leave (LEAVE)1 Ending processing of commands in a Do While, Do Until, or Do For group.
Otherwise (OTHERWISE)1 Defining the commands to be processed if no conditions on a When command in a Select group are true.
Return Subroutine (RTNSUBR)1 Exiting a subroutine.
Subroutine (SUBR)1 Delimiting the group of commands which define a subroutine.
Select (SELECT)1 Indicating the start of a Select group, which allows conditional processing of command groups.
When (WHEN)1 Processing commands in a Select group when the value of a logical expression is true.
CL program or procedure variables Change Variable (CHGVAR)1 Changing the value of a CL variable.
Declare (DCL) 1 Declaring a variable.
Conversion Change Variable (CHGVAR)1 Changing the value of a CL variable.
Convert Date (CVTDAT)1 Changing the format of a date.
Data areas Change Data Area (CHGDTAARA) Changing a data area.
Create Data Area (CRTDTAARA) Creating a data area.
Delete Data Area (DLTDTAARA) Deleting a data area.
Display Data Area (DSPDTAARA) Displaying a data area.
Retrieve Data Area (RTVDTAARA)1 Copying the content of a data area to a CL variable.
Files End Receive (ENDRCV)1 Canceling a request for input previously issued by a RCVF, SNDF, or SNDRCVF command to a display file.
Declare File (DCLF)1 Declaring a display or database file.
Receive File (RCVF)1 Reading a record from a display or database file.
Retrieve Member Description (RTVMBRD)1 Retrieving a description of a specific member of a database file.
Send File (SNDF)1 Writing a record to a display file.
Send/Receive File (SNDRCVF)1 Writing a record to a display file and reads that record after the user has replied.
Wait (WAIT)1 Waiting for data to be received from an SNDF, RCVF, or SNDRCVF command issued to a display file.
Messages Monitor Message (MONMSG)1 Monitoring for escape, status, and notify messages sent to a program's message queue.
Receive Message (RCVMSG)1 Copying a message from a message queue into CL variables in a CL program or procedure.
Remove Message (RMVMSG)1 Removing a specified message from a specified message queue.
Retrieve Message (RTVMSG)1 Copying a predefined message from a message file into CL program or procedure variables.
Send Program Message (SNDPGMMSG)1 Sending a program message to a message queue.
Send Reply (SNDRPY)1 Sending a reply message to the sender of an inquiry message.
Send User Message (SNDUSRMSG) Sending an informational or inquiry message to a display station or system operator.
Miscellaneous commands Check Object (CHKOBJ) Checking for the existence of an object and, optionally, the necessary authority to use the object.
Include CL Source (INCLUDE)1 Embedding CL source commands at compile time.
Print Command Usage (PRTCMDUSG) Producing a cross-reference listing for a specified group of commands that are used in a specified group of CL programs or procedures.
Retrieve Configuration Source (RTVCFGSRC) Generating CL command source for creating existing configuration objects and placing the source in a source file member.
Retrieve Configuration Status (RTVCFGSTS)1 Giving applications the capability to retrieve configuration status from three configuration objects: line, controller, and device.
Retrieve Job Attributes (RTVJOBA)1 Retrieving the value of one or more job attributes and placing the values in a CL variable.
Retrieve System Value (RTVSYSVAL)1 Retrieving a system value and placing it into a CL variable.
Retrieve User Profile (RTVUSRPRF)1 Retrieving user profile attributes and placing them into CL variables.
Program creation commands Create CL Module (CRTCLMOD) Creating an integrated language environment (ILE) CL module.
Delete Module (DLTMOD) Deleting a module.
Delete Program (DLTPGM) Deleting a program.
Create Bound Control Language Program (CRTBNDCL) Creating an ILE CL program.
Create CL Program (CRTCLPGM) Creating an original program model (OPM) CL program.
Create Program (CRTPGM) Creating an ILE program from one or more modules.
Create Service Program (CRTSRVPGM) Creating an ILE service program from one or more modules.
1 Indicates the commands that you can use only in CL programs and procedures.