Example: QINSTAPP program

This is an example program that can be saved to tape or optical media and loaded on the system using the Load and Run Media Program (LODRUN) command.

Following is an example of a QINSTAPP program. The program is saved to a tape or optical media by the program writer and loaded on the system using the Load and Run Media Program (LODRUN) command. The Load and Run Media Program (LODRUN) command passes control of the system to the program, which then performs the tasks written into the program.

This example program can be designed to accomplish many different tasks. For example, the program could:

Figure 1. Example of an Application Using the LODRUN Command
PGM         PARM(&DEV)  /* "Device" is only Parm allowed           */
DCL         VAR(&DEV)   TYPE(*CHAR) LEN(10)
DCL         VAR(&MODEL) TYPE(*CHAR) LEN(4)
 
/* Can check for appropriate model number, release level, and so on */
RTVSYSVAL   SYSVAL(QMODEL) RTNVAR(&MODEL)
IF          (&MODEL *EQ 'xxxxx') THEN...
 
/* Install a library for new application (programs, data):         */
RSTLIB      SAVLIB(NEWAPP) DEV(&DEV) ENDOPT(*LEAVE) +
              MBROPT(*ALL)
/* Install a command to start new application:                     */
            RSTOBJ OBJ(NEWAPP) SAVLIB(QGPL) DEV(&DEV) +
              MBROPT(*ALL)
 
END:        ENDPGM
Related information
Load and Run Media Program (LODRUN) command