Find if a spool file exists

pts.
Tags:
RPGLE
Using RPG, how to find if a spool file exists. I would like to pass spool file name and job details as parameters to RPG program.

Answer Wiki

Thanks. We'll let you know when a new response is added.

In your RPG program you can place a call to the QUSRSPLA system API to try and retrieve the attributes of the spool file. If nothing is returned in the error data structure for the API then the spool file exists, if an error is returned then the spool file could not be found.

I don’t have an RPG example available for this API, but I do have a CL program example that accepts the spool file name and job details and returns an indicator to identify whether or not the spool file exists.

The source for the CL program can be found at:

http://www.astradyne-uk.com/code/index.php?id=0bebfeadda

It shouldn’t be difficult to convert the method into RPG and create a sub-procedure you can add to your toolbox.

All the best

Jonathan

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Yorkshireman
    You don't say what information you have at the point you wish to do this.


    Is your RPG running in the same job as the expected Spoolfile would be created?  If so, then you could use attributes of the job, and pass the information needed to the API mentioned.

    If you are wanting to do this, say next day, then what information do you have available? - job number / user id ???

    the RTVSPLFA command could be used to trap for errors - if error, no spool file of the name provided.  

     

    6,085 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: