Example: Creating abbreviated change job CL command

This example shows how to define and create an abbreviated command.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

You can create your own abbreviated commands to simplify IBM-supplied commands or to restrict the parameters allowed for users. For example, to allow users the ability to change only the printer device parameter, you can create your own Change Job (CJ) command. Following are three steps to create and implement your own Change Job (CJ) command:

  • Step one: Command definition source statements
    
        CMD   PROMPT('Change Job')
     
        PARM  KWD(PRTDEV) +
              TYPE(*NAME) +
              LEN(10)  +
              SPCVAL(*SAME *USRPRF *SYSVAL *WRKSTN) +
              PROMPT('Printer Device')
    
  • Step two: Processing program
    
        PGM PARM(&PRTDEV)
        DCL VAR(&PRTDEV)  TYPE(*CHAR)  LEN(10)
        CHGJOB  PRTDEV(&PRTDEV)
        ENDPGM
    
  • Step three: Create Command (CRTCMD) command
    
        CRTCMD  CMD(CJ)  PGM(CJ)  SRCMBR(CJ)