Comprehensive example: Display overrides

The following example is intended only to illustrate what the various forms of the display override command can do. The DSPOVR command is typically entered interactively or added temporarily to a CL program, or to any high-level language program via QCMDEXC, to verify that the proper overrides are in effect at the time a program is called or a file is opened. Assume that commands 1, 2, 3, and 18 are entered at call level 1.

Note: By using the code example, you agree to the terms of the Code license and disclaimer information.
Figure 1. An example of displaying overrides. The example outlines how to display overrides.
               Program A (in the user default activation group)
Command 1      OVRPRTF FILE(PRTA) COPIES(3)
Command 2      OVRDBF FILE(DBC) WAITFILE(*IMMED)
Command 3      CALL PGM(B)
 
                 Program B (in activation group 5)
Command 4        OVRPRTF FILE(PRTB) TOFILE(PRTA) COPIES(6) +
                   OVRSCOPE(*CALLLVL)
Command 5        OVRDBF FILE(DBC) WAITFILE(60) OVRSCOPE(*CALLLVL)
Command 6        OVRDBF FILE(DBE) TOFILE(DBF) OVRSCOPE(*JOB)
Command 7        DSPOVR FILE(PRTB) MRGOVR(*YES)
Command 8        CALL PGM(C)
 
                   Program C (in activation group 5)
Command 9          CALL PGM(QCMDEXC) PARM('OVRDSPF FILE(DSPE) +
                     TOFILE(DSPF) OVRSCOPE(*CALLLVL)' 50)
Command 10         OVRDBF FILE(DBC) TOFILE(DBD) OVRSCOPE(*CALLLVL)
Command 11         DSPOVR FILE(DBC) MRGOVR(*NO) LVL(3)
Command 12         DSPOVR FILE(DBD) MRGOVR(*NO) LVL(2)
Command 13         MONMSG MSGID(CPF9842)
Command 14         OVRDSPF FILE(CREDITS) TOFILE(DEBITS)
Command 15         CALL PGM(QCMDEXC) PARM('DSPOVR FILE(*ALL) MRGOVR(*YES) +
                     LVL(*) OUTPUT(*)' 47)
Command 16         RETURN
 
Command 17       DSPOVR FILE(*ALL) MRGOVR(*NO)
Command 18       RETURN
Command 19     DSPOVR FILE(*ALL) MRGOVR(*NO) LVL(2) OUTPUT(*)

Command 1 overrides the value of the COPIES attribute of file PRTA at level 1 to 3.

Command 2 overrides the value of the WAITFILE attribute of file DBC at level 1 to *IMMED.

Command 3 calls program A and creates a new call level, 2.

Command 4 causes an override at level 2 from file PRTB to file PRTA. Also, the command overrides the value of the COPIES attribute to 6.

Command 5 overrides the the value of the WAITFILE attribute for file DBC at level 2 to 60.

Command 6 causes an override of file DBE to file DBF and scopes the override to the job level.

Command 7 displays a merged override for file PRTB at level 2 with text descriptions of each keyword and parameter, as shown in Figure 2. The to-file is PRTA because of command 4, and the COPIES attribute is 3 because of command 1.

Figure 2. Override with printer file display. The example describes the Display Override with Printer File command.
                      Display Override with Printer File
 
 File  . . . . . . . . . . . . . . :  PRTB
 Call level  . . . . . . . . . . . :  *
 Merged  . . . . . . . . . . . . . :  *YES
 
                                       Keyword    Value
 Name of file being overridden . . :  FILE       PRTB
 Overriding to printer file  . . . :  TOFILE     PRTA
 Library . . . . . . . . . . . . . :             *LIBL
 Number of copies  . . . . . . . . :  COPIES     3
 
 
 
 
 
 
 
 
 
 Press Enter to continue.
 
 F3=Exit   F12=Cancel
 

Command 8 calls program B and creates the new call level 3.

Command 9 causes an override at level 3 from file DSPE to file DSPF. An override done via a call to the QCMDEXC program takes the call level of the program that called the QCMDEXC program.

Command 10 causes an override of file DBC to file DBD.

Command 11 displays all overrides for file DBC from the job level to level 3, as shown in Figure 3. The overrides specified by commands 10, 5, and 2 are displayed in keyword-parameter form. Observe that this form of the DSPOVR command shows all the overrides for the selected file, regardless of redirection. The three overrides that are shown would not be merged because of the name change at level 3.

Figure 3. All file overrides display (one file). The example describes the All File Overrides Display.
                     Display All File Overrides
 
 Call level  . . . . . . . . . . . :  3
 
 Type options, press Enter.
   5=Display override details
 
 Opt  File    Level  Type  Keyword Specifications
  _   DBC     3      DB    TOFILE(*LIBL/DBD)
  _           2      DB    WAITFILE(60)
  _           1      DB    WAITFILE(*IMMED)
 
 
 
 
 
 
 
 
 
 
 
 F3=Exit   F5=Refresh   F12=Cancel
 

Command 12 attempts to display all file overrides for file DBD from the job level to level 2. Because no overrides for file DBD exist at levels 1 or 2, no overrides are displayed, and the override-not-found escape message (CPF9842) is sent.

Command 13 monitors for message CPF9842 on the preceding command. The monitor specifies no action to be taken, but will prevent a function check if the message is sent.

Command 14 causes an override of the display file CREDITS to the display file DEBITS. The override is scoped to the activation group level of activation group 5. OVRSCOPE(*ACTGRPDFN) is the default.

Command 15 displays the merged overrides at the job level to call level 3 for all files in keyword-parameter form, as shown in Figure 4. File DBC is overridden to file DBD because of command 10 (commands 5 and 2 are therefore not effective). File DSPE is overridden to file DSPF because of command 9. File PRTB is overridden to file PRTA and COPIES(3) because of commands 4 and 1. File DBE is overridden to file DBF because of command 6. The file DEBITS overrides the file CREDITS because of command 14.

Figure 4. All merged file overrides display. The example describes the All Merged File Overrides Display.
                   Display All Merged File Overrides
 
 Call level  . . . . . . . . . . . :  *
 
 Type options, press Enter.
   5=Display override details  8=Display contributing file overrides
 
 
 Opt  File     Type  Keyword Specifications
  _   DSPE     DSP   TOFILE(*LIBL/DSPF)
  8   PRTB     PRT   TOFILE(*LIBL/PRTA) COPIES(3)
  _   DBC      DB    TOFILE(*LIBL/DBD)
  _   PRTA     PRT   COPIES(3)
  _   DBE      DB    TOFILE(*LIBL/DBF)
  _   CREDITS  DSPF  TOFILE(*LIBL/DEBITS)
 
 
 
 
 
 
 
 F3=Exit   F5=Refresh   F11=All file overrides   F12=Cancel
 

If you enter a 5 on the line for PRTB, you get a detail display like the one shown in Figure 2. If you enter an 8 on this same line, you get a display showing commands 4 and 1 on separate lines, as shown in Figure 5. These are the overrides that were merged to form the PRTB override.

Figure 5. Contribute file overrides display. The example describes the Contributing File Overrides Display.
                  Display Contributing File Overrides
 
 File  . . . . . . . . . . . . . . :  PRTB
 Call level  . . . . . . . . . . . :  *
 
 Type options, press Enter.
   5=Display override details
 
 Opt  Level  Type  Keyword Specifications
  _     2    PRT   TOFILE(*LIBL/PRTA) COPIES(6)
  _     1    PRT   COPIES(3)
 
 
 
 
 
 
 
 
 
 
 
 F3=Exit   F5=Refresh   F12=Cancel   F14=Display previous override
 

Command 16 causes a return to level 2, and level 3 is deleted. The overrides issued at level 3 that are scoped to the call level are implicitly deleted. The override issued by command 14 is not deleted because it is scoped to the activation group level.

Command 17 displays all overrides issued for the job level to the current call level (level 2), as shown in Figure 6. The overrides specified in commands 1, 2, 4, 5, 6, and 14 display in keyword-parameter form. The override issued in command 10 is not displayed because call level 3 is no longer active. Pressing F11 on this display allows you to see a display that is similar to the one shown in Figure 4.

Figure 6. All file overrides display (all files). The example describes the All File Overrides Display.
                       Display All File Overrides
 
 Call level  . . . . . . . . . . . :  *
 
 Type options, press Enter.
   5=Display override details
 
 Opt  File       Level  Type  Keyword Specifications
  _   CREDITS  *ACTGRP  PRT   TOFILE(*LIBL/DEBITS)
  _   PRTB           2  PRT   TOFILE(*LIBL/PRTA) COPIES(6)
  _   DBC            2  DB    WAITFILE(60)
  _                  1  DB    WAITFILE(*IMMED)
  _   PRTA           1  PRT   COPIES(3)
  _   DBE         *JOB  DB    TOFILE(*LIBL/DBF)
 
 
 
 
 
 
 
 
 F3=Exit   F5=Refresh   F11=All merged file overrides   F12=Cancel
 

Command 18 causes a return to level 1, and level 2 is deleted. The overrides issued at level 2 that are scoped to the call level are implicitly deleted. The override that is caused by command 14 (scoped to the activation group level) is implicitly deleted when activation group 5 ends. In this example, assume that activation group 5 is a nonpersistent activation group and that ends when command 18 processes. The override caused by command 6 is not deleted.

Command 19 displays all overrides for the job level to call level 2 in keyword-parameter form. Because level 2 is no longer active, only the overrides scoped to the job level (command 6) and those specified at level 1 in commands 1 and 2 are displayed.