How do I find a spooled file created by the Exec400 Task?

View some of the Frequently Asked Questions to our support staff. Included are some tips and tricks making this forum ideal for users getting started with GoAnywhere Director. Note: Users can reply to existing topics but only our support staff can add new topics to this forum.

How do I find a spooled file created by the Exec400 Task?

Postby Support_Duane » Fri Mar 06, 2009 11:57 am

When running an exec400 (Execute System i Command or Program) task in GoAnywhere, the spool file job name and number are different from the job that is creating the spool file. IBM uses a job called QPRTJOB when the current job's user name is not the same as the current user profile.

A QPRTJOB job is a job that spooled files are associated with when the current job's user name is not the same as the user profile currently running. System jobs can change to run under a user's profile in order for a user to obtain ownership of the spooled file instead of the system job.

Here is a link explaining the issue from IBM ... prtjob.htm

Here is one method and an example CL to show how to use it.

  • Create a Data Queue to keep info on the printout.
  • Create an Environment variable to point to the Data Queue.
  • Run your query.
  • Run the Receive Data Queue API (QRCVDTAQ) to read the info on the QPRTJOB job that runs the print.
  • Use the current user, the job name QPRTJOB and the job number returned from the Data Queue in your copy print files command.
Code: Select all
            DCL        VAR(&DATAQUEUE) TYPE(*CHAR) LEN(10)           
            DCL        VAR(&LIB) TYPE(*CHAR) LEN(10)                 
            DCL        VAR(&LEN) TYPE(*DEC) LEN(5 0)                 
            DCL        VAR(&WAITTIME) TYPE(*DEC) LEN(5 0)             
            DCL        VAR(&DATA) TYPE(*CHAR) LEN(256)               
            DCL        VAR(&ENV) TYPE(*CHAR) LEN(128)                 
            DCL        VAR(&NBR) TYPE(*CHAR) LEN(6)                   
            CHGVAR     VAR(&LIB) VALUE('QTEMP')                       
            CHGVAR     VAR(&DATAQUEUE) VALUE('SPOOLQUEUE')           
            CHGVAR     VAR(&WAITTIME) VALUE(0)                       
            CHGVAR     VAR(&ENV) VALUE('*DTAQ ' *CAT &LIB *TCAT '/' +
                         *CAT &DATAQUEUE)                             
              MONMSG     MSGID(CPF9870)                                 
              MONMSG     MSGID(CPFA980) EXEC(CHGENVVAR +               
                           ENVVAR(QIBM_NOTIFY_CRTSPLF) VALUE(&ENV) +   
            DSPJOB     OUTPUT(*PRINT)                               
            CALL       PGM(QRCVDTAQ) PARM(&DATAQUEUE &LIB &LEN +     
                         &DATA &WAITTIME)                           
            SNDMSG     MSG(&DATA) TOUSR(RBYRD)                       
            CHGVAR     VAR(&NBR) VALUE(%SST(&DATA 33 6))             
            SNDMSG     MSG(&NBR) TOUSR(RBYRD)                       
Support Specialist
Posts: 66
Joined: Thu Mar 05, 2009 3:49 pm

Return to Knowledge Center

Who is online

Users browsing this forum: No registered users and 1 guest