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

8-: 9
* System file information (retrieved from the operating system LISTF
command)
* Data (Local Data Area)
Communicating Switches
When the information you want to pass to other programs or receive from
them can be put in the form of yes/no or on/off states, you may want to
use user indicators (U1-U8) in your RPG program. User indicators can be
saved and passed to other RPG programs by either:
* Saving the switches in a USWITCH file, or
* Saving the switches in the System-Defined JCW
Both of these methods are discussed in the following sections.
Using USWITCH Files. A USWITCH file is a standard text file that
contains the settings of the user indicators (U1-U8). This file can be
created, read and updated by RPG programs. If you're running in job
mode, you do not need to enter the indicator settings in a USWITCH file.
You can include them as part of the job file. For more details about
using USWITCH files, see the USWITCH sections in the
HP RPG Reference
Manual
.
You can read a USWITCH file only, or you can read and update it in a
program. The next two sections show how to do this.
Reading a USWITCH File
Figure 8-5 shows how to read the USWITCH file. In this particular
example, user indicator U1 signals that the program should terminate
immediately. User indicator U2 means that the program can access the
master file, GLMAST. These indicators are set by the update program shown
in Figure 8-6. They are read by each application program to ensure that
they do not execute concurrently with the update program or process the
GLMAST file concurrently.
To read a USWITCH file, enter a Header Specification indicating that the
USWITCH file is being used. Then use the user indicator(s) in File
Description, Input, Calculation and Output Specifications.
Figure 8-5. Reading User Indicators