IF command in a CL program or procedure The If (IF) command is used to state a condition that, if true, specifies a statement or group of statements in the program or procedure to be run. The Else (ELSE) command can be used with the IF command to specify a statement or group of statements to be run if the condition expressed by the IF command is false.
IBM Docs, 3/5/2013 · Control Language (CL), an integral part of OS/400, is a set of commands by which users control operations and request system-related functions on the AS/400. A CL command usually is made up of three-character words up to 10 characters (usually three.
3/14/2013 · A CL procedure is a group of CL commands that tells the system where to get input, how to process it, and where to place the results. The procedure is assigned a name by which it can then be called by other procedures or bound into a program and called. As with other kinds of procedures, you must enter CL procedure source statements, compile, and …
Using IF & ELSE Command . This command is used to branch the flow of logic under some condition. Syntax: IF COND(LOGICAL EXPRESSION) THEN ( CL COMMANDS) CONDITION MUST BE LOGICAL EXPRESSION. Example: IF COND(&RESP *EQ 5) THEN CALL (PGM(A)) IF (&A=2) THEN. CALL PGM1. ELSE . CALL PGM2, 6/27/2013 · Prior to using these command if I wanted to read a file in a CL I had to do something like: 01 PGM 02 03 DCLF FILE(QTEMP/WRKFILE) OPNID(A) 04 05 LOOP: RCVF OPNID(A) 06 MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ENDLOOP)) 07 08 IF COND(&A_STATUS *NE ‘A’) + 09 THEN(GOTO CMDLBL(LOOP)) 10 11 ENDLOOP: 12 13 ENDPGM, 7/4/2013 · IBM i ( OS400) V5R3 brought what I like to call the Select group of commands, SELECT, WHEN, OTHERWISE, and ENDSELECT . If you are familiar with the Select operation codes in RPG/RPGLE you need little or no introduction to their equivalent in CL . Their introduction has allowed me to write, what I consider to be, better looking and structured code.