Professional Documents
Culture Documents
Chapter 11 & 12 - Display Files and CL Programs: Final Product
Chapter 11 & 12 - Display Files and CL Programs: Final Product
Final Product:
Type STRSDA.
1 of 10 06/04/18
Type Option 1 – Design Screens
2 of 10 06/04/18
Enter the Source Physical File and Member
3 of 10 06/04/18
Select Record Type
4 of 10 06/04/18
Add Input field to collect selected option. See Page 476 in text book.
Edit the Display Attributes for the Input/Output Option field by placing an ‘*’ in front of the BB and
then placing a ‘Y’ beside ‘Display Attributes’.
5 of 10 06/04/18
Place a ‘Y’ in the ‘RI’ (Reverse Image) yes field. Type indicator 99 in one of the Reverse Image
indicators field. This tells the AS/400 that the ‘Enter Selection Field’ will be displayed in Reverse
Image if the indicator 99 is set to ‘1’ or ‘on’.
Place a ‘Y’ in the ‘UL’ (Under Line) yes field to make sure that this field is always underlined.
Place a ‘Y’ in the ‘PC’ (Position Cursor) yes field to make sure that the cursor is always positioned
in this field.
6 of 10 06/04/18
Assign a field name to the ‘Enter Selection’ field by placing a ‘?’ in front of the field. This displays
the field definition prompt. Name the field.
Press Enter.
Press F14 from the Work with Display Records screen to Define F3=Exit.
7 of 10 06/04/18
CA03 is the conditioned keyword (or name of indicator 03) that means exit to the AS/400.
Assigning it to 03 tells the AS/400 Display file that F3 is now a valid function key.
We could alternately use the keyword, CF03. CF03 would return the data in the ‘Enter Selection’
field to the program, but if we’re exiting, why would we need it?
Enter the screen design once more and add the message ‘Invalid Entry – Try Again’ to the bottom
of the screen. Use the Attribute byte to setup field conditioning based on indicator 99. This will
cause the Display File to display the message only when indicator 99 is set to one. Use the
Attribute byte to display the message in red.
8 of 10 06/04/18
Exit and compile the Display File.
CL programs are by default, stored in the members in the Source Physical File, QCLSRC or
QCLPSRC.
The following program will use the above Display File to process commands on the AS/400.
9 of 10 06/04/18
PGM {Field and File Declaration Section}
/*********************************************************/
/* CHECK FOR SIGNOFF */ {If screen option is 90, then signoff}
IF COND(&OPTION *EQ '90') THEN(SIGNOFF)
/*********************************************************/
/* CHECK FOR EXIT */ {If F3 pressed, then exit program}
IF COND(&IN03 *EQ '1') THEN(GOTO CMDLBL(END))
/*********************************************************/
/* CHECK FOR INVALID OPTIONS */
IF COND((&OPTION *NE '1') *AND (&OPTION *NE +
'2') *AND (&OPTION *NE ' 1') *AND +
(&OPTION *NE ' 2') *AND (&OPTION *NE +
'01') *AND (&OPTION *NE '02')) THEN(DO)
CHGVAR VAR(&IN99) VALUE('1')
GOTO CMDLBL(READ)
ENDDO
/***************************************************************/
/* OPTION 1 */
IF COND((&OPTION *EQ '1') *OR (&OPTION +
*EQ ' 1') *OR (&OPTION *EQ '01')) THEN(DO)
WRKOBJPDM CMOPS324
ENDDO
/***************************************************************/
/* OPTION 2 */
IF COND((&OPTION *EQ '2') *OR (&OPTION +
*EQ ' 2') *OR (&OPTION *EQ '02')) THEN(DO)
WRKOBJPDM MOOGK
ENDDO
10 of 10 06/04/18