Using System UDCs [ HP RPG/XL Programmer's Guide ] MPE/iX 5.0 Documentation
HP RPG/XL Programmer's Guide
Using System UDCs
A User-Defined Command (UDC) is an operating system command saved in a
file. UDCs are similar to job files except that they can be executed
interactively in session mode.
You can use UDCs to do many things. For instance, you can set up a test
UDC that loads an RPG program, then executes it. This test UDC can
contain file equations, program parameters, etc. Logon UDCs are also
handy. You set them up so that when a user logs onto the system, the UDC
is executed automatically. Logon UDCs are used primarily for displaying
application menus to users. They ensure that users execute only the
programs that they are authorized to use. UDCs are discussed in length
in the operating system commands reference manual.
You can create a UDC file with any standard text processor. Once you
create it, you must add it to the system command Directory with the
system SETCATALOG command (see your operating system commands reference
manual for more information on SETCATALOG). To execute a UDC, type its
name at the operating system colon prompt. For example, Figure 8-2 shows
a UDC file containing three UDCs: DAILY, MONTHLY and YEARLY. These UDCs
produce daily, monthly and year-end reports. To print only the year-end
report, type:
:YEARLY
_____________________________________
| |
| DAILY |
| COMMENT - DAILY REPORT |
| RUN RPT10.PROGRAM |
| ** |
| MONTHLY |
| COMMENT - MONTH-END REPORT |
| FILE DETAIL=ALLMONTH |
| RUN RPT10.PROGRAM |
| RESET DETAIL |
| ** |
| YEARLY |
| COMMENT - YEAR-END REPORT |
| STREAM RPT20.JOB |
| ** |
| |
_____________________________________
Figure 8-2. A Simple UDC
Figure 8-3 expands the UDC shown in Figure 8-2 and makes it more
flexible. One UDC, REPORT, replaces the three UDCs in Figure 8-2.
REPORT displays a menu of available reports. When the user selects a
report (DAILY, MONTH-END or YEAR-END), the UDC validates the choice. If
the selection is valid, the UDC starts the appropriate report program.
REPORT uses the logic command, IF, to validate the report choice and
start the appropriate report program. It also uses a User-Defined JCW
(OPTJCW) for storing the user's report choices. For information on the
User-Defined JCWs, see "Communicating File Information" or refer to the
MPE XL Intrinsics Reference Manual.
Figure 8-3. A More Complex UDC
MPE/iX 5.0 Documentation