The Start-Up Program


The system runs a start-up program each time you IPL it. Although this program can be written in any language and can perform any task you want, in practice, the program is written in Control Language (CL) because CL has commands for operational activities such as starting subsystems, starting spool writers, and starting server jobs.

Marking a Program as the Start-Up Program

System value QSTRUPPGM contains the qualified name of the start-up program. (A qualified name consists of an object name and the name of the library that contains the object.) You can display the name of the start-up program using the Display System Value (DSPSYSVAL) command, as follows:

      DSPSYSVAL SYSVAL(QSTRUPPGM) 

If you change this system value, the system will execute a different program during IPL. For example, if you create a program called IPLPGM in library mylib, and you want to make it the start-up program, change system value QSTRUPPGM so that it contains the name of the new program:

      CHGSYSVAL SYSVAL(QSTRUPPGM) VALUE('IPLPGM MYLIB') 
Tip 

Note that there is no slash (/) between the program and library name, and that the name of the program comes first. System values that accept qualified names usually require this syntax. You must make sure that the first 10 characters are the name of the program and that the next 10 characters (or less) are the name of the library

It is easier to make these changes using the Work with System Values (WRKSYSVAL) command. The WRKSYSVAL command shows a list of all system values (or of those system values that belong to a certain type) and lets you select option 2 to change a system value or option 5 to display it. For example, use WRKSYSVAL to change system value QSTRUPPGM:

      WRKSYSVAL SYSVAL(QSTRUPPGM) 

The system presents the panel shown in Figure 2.1.

image from book
Figure 2.1: Working with System Values (WRKSYSVAL) command.

When you select option 2 and press Enter, the system prompts you for the new value in a much friendlier manner than CHGSYSVAL could offer. The results are shown in Figure 2.2.

image from book
Figure 2.2: Changing the startup program system value.

Now, all you need to do is type over the current values and press Enter.

Changing IBM's Start-Up Program

If you do not want to write a new start-up program from scratch, you can just copy the source code of IBM's start-up program, make slight modifications, and give it a different name.

To change IBM's start-up program, perform the following steps:

  1. Decide in which library you will place the new program. The program can be placed in any library, but don't place it in any IBM-supplied library (those beginning with the letter Q), because you may lose the program the next time you upgrade to a new release. Choose one of your own libraries. Use a library that you use for normal "housekeeping" tasks, one that will never be deleted or cleared.

  2. Determine a name for your start-up program. If inspiration fails you, use the name START_UP. The underscore character is valid.

  3. Create source physical file QCLSRC in the library you chose in Step 1, or use a source physical file that already exists in the library. To create the source physical file, use the Create Source Physical File (CRTSRCPF) command. In the following command, replace xxx with the name of the library in which you wish to store your start-up program.

          CRTSRCPF FILE(xxx/QCLSRC) TEXT('CL Source') 
  4. Run the DSPSYSVAL command to find out the name of IBM's start-up program and record it on a piece of paper:

          DSPSYSVAL SYSVAL(QSTRUPPGM) 
  5. Retrieve the source code of IBM's start-up program. Place it into the appropriate source physical file of your library. In the following command, replace the words xxx and program with the values of IBM's start-up program, which were displayed in the previous step. Replace zzz and file with the source physical file in which you will store the source code. Replace new_program_name with the name you choose for your startup program.

          RTVCLSRC PGM(xxx/program) SRCFILE(zzz/file)      +SRCMBR(new_program_name) 
  6. Edit the source with Source Entry Utility (SEU) by running the Start SEU (STRSEU) command. Make any necessary changes:

          STRSEU SRCFILE(zzz/file) SRCMBR(new_program_name) 
  7. Compile your program using the Create CL Program (CRTCLPGM) command:

          CRTCLPGM PGM(zzz/new_program_name) +SRCFILE(zzz/file) 
  8. Change system value QSTRUPPGM. Mention the name of your program. Use either the CHGSYSVAL or the WRKSYSVAL command as explained above.



IBM i5/iSeries Primer(c) Concepts and Techniques for Programmers, Administrators, and Sys[... ]ators
IBM i5/iSeries Primer(c) Concepts and Techniques for Programmers, Administrators, and Sys[... ]ators
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 245

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net