View Full Version : Capture spool file attributes in CL
01-01-1995, 02:00 AM
Sorry if this is a redundant post. I searched the forum and found answers that almost fit my description, but not quite .. so here goes. I have RPG programs that create spool files. Assume I don't know the created spool files name. Within a CL that calls the RPG program how can I capture the spool file name, number and file number. There could possibly be more than one spool file generated. It doesn't seem that the rtvjoba command returns any information on the spool file. Thanks for your time, I really appreciate it !!
10-24-2000, 03:14 PM
Joni, Maybe what would be more helpful would be for you to explain what it is you want to accomplish. As to what you can do if there were only 1 spool file created in your RPG program you can do something like this if you wanted to change the outq it resides in: <pre>ChgSplFA File(printfilename) SplNbr(*last) OutQ(newoutqname)</pre> Anything else would probably require going to the API's. Bill
10-24-2000, 11:15 PM
Joni, Given all the constraints you mentioned, the only way I know is to print a list of the current job's spools before and after the RPG program is run, and then segregate the new spools. You can use either commands DSPJOB or WRKJOB with parameters OUTPUT(*PRINT) and OPTION(*SPLF) to generate the list. The outputted spool file will be QPDSPJOB, it will always be the last spool in the list, and it will always have a status of OPN.
10-25-2000, 04:45 AM
Bill is right, it would help to know what you want to accomplish. Since your asking I assume you want to do some funky processing of an unknown number spoolfile.. There is likely some utility like converting a wrkjob to a spoolfile that you could read to get the info you want.. ...tell us more!
10-25-2000, 06:37 AM
What I'm trying to accomplish: I have written a Java program that takes a spool file and converts it to HTML. What we need is to have any spool file, created from an RPG report, and have it converted it to HTML. I would like to do this all within the same CL. The process copies a spool file to a physical file and the physical file is used as a parameter into the JAVA program. To create that physical file within the CL I need the spool file name and number. I didn't have much luck trying to use the AS/400 java classes provided that are specifically for spool files (always ended up with a lot of garbage in the print out). Thanks for your quick responses !! joni
10-25-2000, 06:59 AM
Look in the INFDS Position 103 - 112 = spool file name 123 - 124 = number PSDS 244 - 253 = Job name 254 - 263 = User ID 264 - 269 = job number Hope this is some help
10-25-2000, 09:20 AM
Joni, Probably the "best" way to do this would be to send all required output to a special outq. This outq can be specified to place an entry on a dataq whenever a spoolfile arrives ( CrtOutQ OutQ(outqlib/outqname) DtaQ(dtaqlib/dtaqname) ). You could then create a never-ending CL program that waits for entries to show up on this dataq and then do your html process inside this CL program. Bill
10-25-2000, 09:44 AM
Sounds like a great idea (I'm not an RPG programmer as you could probably tell). I'll give it a try ! Thanks !! joni
10-27-2000, 12:30 AM
Joni, Another method of processing outq's in cl is to: Copy the outq details to a spoolfile WRKOUTQ OUTQ(&Outq) OUTPUT(*PRINT) Copy this spoolfile to a workfile and then delete the spoolfile CPYSPLF FILE(QPRTSPLQ) TOFILE(WORKFILE) DLTSPLF FILE(QPRTSPLQ) SPLNBR(*LAST) Read the workfile records using rcvf, selecting the spool entries you want to process, everthing uou need should be on the file. Any additional identifying info required can be imbedded in the user data of the spoolfile. Hope this helps. Bill
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.