Retrieving job attributes

To retrieve the job attributes and place their values in a CL variable to control your applications, use the Retrieve Job Attributes (RTVJOBA) command. With this command you can retrieve all job attributes or any combination of them.

In the following CL procedure, a Retrieve Job Attributes (RTVJOBA) command retrieves the name of the user who called the procedure.

        PGM
         /* ORD410C Order entry program  */
        DCL &CLKNAM TYPE(*CHAR) LEN(10)
        DCL &NXTPGM TYPE(*CHAR) LEN(3)
        .
        .
        .
        RTVJOBA USER(&CLKNAM)
BEGIN:  CALL ORD410S2 PARM(&NXTPGM &CLKNAM)
         /* Customer prompt */
        IF (&NXTPGM *EQ 'END') THEN(RETURN)
        .
        .
        .

The variable &CLKNAM, in which the user name is to be passed, is first declared using a DCL command. The Retrieve Job Attributes (RTVJOBA) command follows the declare commands. When the program ORD410S2 is called, two variables, &NXTPGM and &CLKNAM, are passed to it. &NXTPGM is passed as blanks but could be changed by ORD410S2.