HP RPG/XL Programmer's Guide (30318-90001)

8- 10
Comments
1 This line enables the USWITCH facility.
Column 16 contains F to specify that a USWITCH file is used.
2 This line defines the GLMAST file. It is opened only when user
indicator U2 is turned on.
3 This line displays a message indicating that the update program
in Figure 8-6 is executing and the program must be run later.
Columns 10-11 contain U1 to display the message only when user
indicator U1 is turned on.
Updating a USWITCH File
Figure 8-6 shows how an update program uses the USWITCH file to prevent
other programs from running at the same time. When the program starts,
it turns on user indicator U1. At the end of the update program, when
the last record (LR) indicator is turned on, U1 is turned off and user
indicator U2 is turned on.
Other programs (as shown in Figure 8-5) test U1 to determine whether to
continue and test U2 to determine whether to process the master file,
GLMAST.
Figure 8-6. Setting User Indicators to Prevent Simultaneous Program Execution