API or procedure to print layout of spool file in app program

160 pts.
Print Spool File
Hi all,

I stuck in one of the procedure where I am selecting one file and their fields,on next screen function should availble for user to see the layout of spool file for selected filed.

Please share if there is any api or procedure I can call from this screen.

(this functionally is simillar to Query/400)





Answer Wiki

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

Other than processing the source, the only useful APIs that I can think of would be List Record Formats (QUSLRCD) to list the record formats and List Fields (QUSLFLD) to list the fields from each format.

But because programs are free to output formats in any order they choose and because printer formats don’t have to come in any particular order (and many might not even be used for a given spooled file), I’m not sure that a “layout” utility could be very useful.

Again, processing the source might give a better indication of any intended layout. Maybe.


Discuss This Question: 3  Replies

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.
  • Samule400
    Thanks Tom, Is there any other alternative to print the layout in app programs....?
    160 pointsBadges:
  • TomLiotta
    First, if you have a program described printerfile, you can only process the source O-specs to get any idea what a layout might be. Those might be modified by C-specs since there is no "layout" other than what the program chooses for any print line. Print lines may be different every time the program runs. And if you have an externally-described printerfile, the program has no information about the layout. The layout may change in the printerfile every time the program runs. As long as format-level identifiers don't change, the program will have idea that the layout has changed. Any "layout" would have to be extracted from the compiled printerfile object. I have never seen any API that can extract anything resembling a "layout" from a compiled printerfile object. Often, programmers will use one of IBM's externally-described printerfiles, such as QSYSPRT or QPRINT. Those have almost no layout specified in the objects. Instead, programmers construct printlines inside of their programs and cause those printlines to be inserted into the QSYSPRT or QPRINT output. IMO, that's a very poor way to create reports, but it's still common. In such cases, you need to analyze both the program source and the printerfile description and merge the two in order to guess at the eventual "layout" result. Regardless of the circumstances, the only realistic choice is to process the DDS source for an externally-described printerfile or the RPG O-spec source for a program-described printerfile. There is no generally known alternative unless you can de-compile a printerfile object and can process the internals of the object itself. If you can do that, then there is no point to asking questions here. Processing the DDS source is the only reasonable choice. Tom
    125,585 pointsBadges:
  • TomLiotta
    As long as format-level identifiers don’t change, the program will have no idea that the layout has changed. Typo correction... Tom
    125,585 pointsBadges:

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.

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


Share this item with your network: