

SNDRCVF Check response indicators DOWHILE (&IN03 *NE ‘1’) Exit Edit input, set option indictors If (&name = ‘ ‘) chgvar IN30 ‘1’ SNDRCVF an indicator is set to on when an error is detected causing an data field to be displayed in red.ġ8 Program Flow using Screens and Indicators exit when F3 is pressed Option indicators: set by programs, used to control when/how info is displayed e.g.

2 possible values: 1 or 0 Response indicators: set by functions keys, used by programs to determine the appropriate response e.g. If so, it initializes the 2 fields MARK1 and MARK2 and redisplays the screen.ġ6 DOFOR Loop DCL &LOOPCTL TYPE(*INT) LEN(4)ĭCL &LOOPLMT TYPE(*INT) LEN(4) DOFOR VAR(&LOOPCTL) FROM(1) TO(&LOOPLMT) BY(1) (group of commands run 0 or more times) ENDDOġ7 Resulting Indicators Indicators are on/off switches used by programs. If not, It then checks to see if the user has pressed F5. If F3 is pressed, the loop exits and WRKOBJPDM is done.
#HOW TO GET SYSTEM DATE IN CL PROGRAM CODE#
IF (&IN05) /* always processed once */ DO CHGVAR VAR(&MARK1) VALUE(0) CHGVAR VAR(&MARK2) VALUE(0) ENDDO WRKOBJPDM This bit of code sends the display file to the screen and reads it back. If so, it initializes the 2 fields MARK1 and MARK2 and redisplays the screen.ġ5 DOUNTIL Loop SNDRCVF DOUNTIL(&IN03) /* the contents of loop is */ (group of CL commands) ENDDO WHEN COND(&TYPE = *PGM) THEN(DO) OTHERWISE CMD(CHGVAR &BADTYPE ‘1’) ENDSELECTġ4 DOWHILE Loop SNDRCVF DOWHILE(&IN03 *NE ‘1’) IF (&IN05 *EQ ‘1’) + DOĬHGVAR VAR(&MARK1) VALUE(0) CHGVAR VAR(&MARK2) VALUE(0) ENDDO WRKOBJPDM This bit of code sends the display file to the screen and reads it back. THEN ( SNDMSG MSG('Good Morning') TOUSR(DC233A40) ) ELSE CMD( SNDMSG MSG('Good Afternoon') TOUSR(DC233A40 ) )ġ2 DO, ENDDO example IF (&CHOICE = 'O' *OR &CHOICE = 'o') + DOĬHGCURLIB IBC233LIB WRKOBJPDM IBC233LIB ENDDO ELSE (GOTO END) END: ENDPGMġ3 Select Group SELECT WHEN COND(&TYPE *EQ *CMD) THEN(DO) IF (condition) THEN (command) ELSE for conditions, *AND, *OR, *NOT, *LT, *GT, *EQ, *NL, *NG, etc DO and ENDDO - used when you need to execute several commands in an IF statement GOTO and labelsġ1 IF, THEN, ELSE example IF COND(&TIME *LE 120000) + DCLF FILE(MARKSDF) SNDRCVF - Sends a record to a screen and waits for the user to enter input, then reads it (only for Display Files) - used with input/output screens e.g. (passed in) CHGVAR VAR(&varname) VALUE(value)Ĩ Examples DCL VAR(&TOTAL) TYPE(*DEC) LEN(7,2)ĭCL VAR(&GRADE) TYPE(*CHAR) LEN(1) CHGVAR VAR(&GRADE) VALUE (‘A’) CHGVAR VAR(&TOTAL) VALUE(&TOTAL + 1)ĩ Some File Commands DCLF - Declares a File (files must be declared before you can use them) e.g. DCL VAR(&varname) TYPE(*CHAR) LEN(8) variables must be declared before you can use them) variables from a display file will automatically be available to program.
#HOW TO GET SYSTEM DATE IN CL PROGRAM UPDATE#
Only five *FILE per program Display file or Database File Can’t update Database Files Can’t create reportsħ CL Variables Datatypes = *CHAR, *DEC, *LGL, *INT, *UINT information is passed back and forth between the program and the user via the display file.)ĥ Program Flow Display the Screen While not F3 Exit Process Data The programs use them to communicate with the user ( i.e.

2 Agenda Assignment 1 Review Display Files CL Programmingģ Review Display Files Constants Input/Output fields Attributes
