CL Programming

Example of Creating a Command

If you want to create a command to allow the system operator to call a program to start the system, you would do the following. (This example assumes you are using IBM-supplied source files.)

  1. Enter the command definition source statement into the source file QCMDSRC using the member name of STARTUP.
    CMD PROMPT('S Command for STARTUP')
    
  2. Create the command by entering the following command.
    CRTCMD CMD(S) PGM(STARTUP) SRCMBR(STARTUP)
    
  3. Enter the source statements for the STARTUP program (the command processing program).
    PGM
    STRSBS QINTER
    STRSBS QBATCH
    STRSBS QSPL
    STRPRTWTR DEV(QSYSPRT) OUTQ(QPRINT) WTR(WTR)
    STRPRTWTR DEV(WSPR2) OUTQ(WSPRINT) WTR(WTR2)
    SNDPGMMSG MSG('STARTUP procedure completed') MSGTYPE(*COMP)
    ENDPGM
    
  4. Create the program using the Create Bound CL Program (CRTBNDCL) command.
    CRTBNDCL STARTUP
    

In the previous example, S is the name of the new command (specified by the CMD parameter). STARTUP is the name of the command processing program (specified by the PGM parameter) and also the name of the source member that contains the command definition statement (specified by the SRCMBR parameter). Now the system operator can either enter S to call the command or CALL STARTUP to call the command processing program.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]