|Parts of a CL source program|
Each CL source statement is a CL command and these CL source commands can be divided into basic parts as follows. A CL program or procedure can refer to other objects that must exist when the program or procedure is created.
This is an optional command used for begin the CL source program and identify any parameters received to CL programs.
PGM PARM(&A &B)
The declare commands must precede all other commands except the PGM command.
DCL (Declare Variable)
It is used to embed additional CL source commands at compile time.
It is used as source statements to manipulate constants or variables.
CHGVAR (Change Variable)
OVRDBF (Override Database File)
Logic control commands
It is used to control processing within the CL program or procedure.
IF THEN ELSE DO ENDDO DOWHILE DOUNTIL DOFOR LEAVE ITERATE GOTO SELECT ENDSELECT WHEN OTHERWISE CALLSUBR SUBR RTNSUBR ENDSUBR
Built-in functions and operators are used in arithmetic, character string, relational or logical expressions.
%SUBSTRING (%SST) %SWITCH %BINARY (%BIN) %ADDRESS (%ADDR) %OFFSET (%OFS) %CHECK %CHECKR %SCAN %TRIM %TRIML %TRIMR
Program control commands
It is used to pass control to other programs.
CALL RETURN TRFCTL
Procedure control commands
It is used to pass control to other procedures.
It is an optional End Program command.
Post a Comment