ControlLanguage TCS
ControlLanguage TCS
Value
Keyword
Command name
Command label
Command Name
•Identifies the function performed by the program that
is called when the command is run
•Is made up of a verb (or action), followed by a noun
(or phrase) that identifies the receiver of the action
• PGM Command
• Declare Commands (DCL, DCLF)
• Program Function
• CL Processing Commands
• (CHGVAR, DLTF etc.)
• Logic Control Command (IF ELSE etc.)
• Built in Functions (%SST, %SWITCH
etc.)
• Program Control Commands(CALL etc.)
• ENDPGM Command
Example:
GRTOBJAUT OBJ(MYLIB/MYPGM) +
OBJTYPE(*PGM) +
USER(*PUBLIC)
•Unconditional commands
e.g. GOTO
•Conditional Commands
e.g. IF...THEN...ELSE
GOTO CMDLBL(Label)
Example:
PGM
.
START:SNDRCVF RCDFMT(MEU)
IF (&OPT *EQ 1THEN(CALL PGM10)
.
GOTO CMDLBL(START)
.
ENDPGM
Examples:
•IF COND(&OPT = 1) THEN(CALL PGM10)
•IF (&A *EQ &B) THEN(GOTO START)
•IF (&A *EQ &B) GOTO START)
•IF (&A=&B) THEN(CALL PGM10)
ELSE CMD(CALL PGM20)
• Arithmetic
• Character string
• Logical
• Relational
Arithmetic operators:
• + Addition
• - Subtraction
• * Multiplication
• / Division
Examples:
• (&A + 1)
• (&A - &F)
• (&A + (-&B))
• (&A + &B - 15)
• ((&A + &B - 15) /&C)
• *CAT || Concatenation
Relational operators:
Logical Operators:
• SUBSTRING or %SST
• SWITCH
Job Attributes:
• RTVJOBA Command
PGM
DCL &DATE6 *CHAR 6
DCL &DATE5 *CHAR 5
RTVSYSVAL QDATE RTNVAR(&DATE6)
CVTDAT DATE(&DATE6) TOVAR(&DATE6) +
TOFMT(*JUL) TOSEP(*NONE)
ADDPFM LIB1/FILEX +
MBR('MBR' *CAT &DATE5)
.
ENDPGM
RTVUSRPRF USRPRF(*CURRENT) +
RTNUSRPRF(&USR) +
MSGQ(&USRMSGQ) +
MSGQLIB(&USRMSGLIB)
CL Program can
•Send Messages
SNDPGMMSG, SNDUSRMSG
• Receive Messages
RCVMSG
• Retrieve Messages
RTVMSG
• Monitor Messages
MONMSG
Contd.