Retrieve job attributes

You can retrieve the job attributes and place their values in a CL variable to control your applications.

Job attributes are retrieved using the Retrieve Job Attribute (RTVJOBA) command. You can retrieve all job attributes, or any combination of them, with the Retrieve Job Attribute (RTVJOBA) command.

In the following CL procedure, a Retrieve Job Attribute (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 Attribute (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.

Related information
Retrieve Job Attributes (RTVJOBA) command