Example: QINSTAPP program

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

The 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:

  • Restore and run other programs or applications
  • Restore a library
  • Delete another program or application
  • Create specific environments
  • Correct problems in existing applications
Note: By using the code example, you agree to the terms of the Code license and disclaimer information.
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