ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

CL for HLDSPLF

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CL for HLDSPLF

    Hello,

    Is it possible to make a cl to hold a newly generated spool file ? I previously tried to make a simple

    Code:
    PGM
    HLDSPLF FILE(QPJOBLOG1)
    HLDSPLF FILE(QPJOBLOG2)
    HLDSPLF FILE(QPJOBLOG3)
    ...etc
    ENDPGM
    But turns out the JOB, USER, and NUMBER that is being generated daily is always changing and not always the same, is it possible to Retrieve the variable everytime the spool is being generated ? So that the HLDSPLF will always work regardless of whoever is running the jobs ? The list of the spool file name that will be held is always the same.

    edit:

    This is what i try to do if the user that runs the program is the same as the one that will hold the spoolfile


    Code:
    PGM
    
    DCL VAR(&JOB) TYPE(*CHAR) LEN(10)
    DCL VAR(&USR) TYPE(*CHAR) LEN(10)
    DCL VAR(&NBR) TYPE(*CHAR) LEN(6)
    RTVJOBA JOB(&JOB) USER(&USR) NBR(&NBR)
    
    HLDSPLF FILE(GWM01P) JOB(&NBR/&USR/&JOB)
    
    ENDPGM
    Is it possible retrieve the job if the user that runs and the user that will hold the spool file different ?

    Thank you

  • #2
    I'm sure that there is an API or a view or table function from the system SQL services that will retrieve a list of job names containing the spool file names that you want to hold, but rather than try to solve the problem after the spool file is generated, why not just change the print file to be put on hold automatically?
    Code:
    CHGPRTF FILE(GWM01P) HOLD(*YES)

    Comment

    Working...
    X