Comments on: How to convert spool file to programs in AS/400 Mon, 29 Dec 2014 16:37:27 +0000 hourly 1 By: tomliotta Tue, 25 Jan 2011 22:07:10 +0000 #comment-87053 If you have a spooled file of the compile listing, the first thing I would do is use iSeries Navigator to drag/drop a copy into a PC text file. I’d want to be certain I had that extra copy in a second system for safety.

Once in a PC text file, I might simply edit (another copy of) the listing to remove parts of the listing that aren’t source. Depending on how big the program is, that might only take a few minutes. From a cleaned-up PC text file, you can copy it into a shared directory back on your AS/400. The CPYFRMSTMF command can then copy it into a source member.

Alternatively, you could use the CPYSPLF command to copy the spooled file into a simple physical file. You might then use SQL to DELETE lines you don’t want. Deletion might get rid of all lines less than the RRN() of the first source line or greater than the RRN() of the last source line. You would also DELETE lines WHERE page heading constants were found. Finally, you might CREATE VIEW that only presnted a SUBSTR() of the print lines that included the source itself. You could then copy the VIEW into a source member.

Another alternative might be to use various Qshell or PASE utilities against either a spool file PC copy or the CPYSPLF physical file to clean up the listing.

There are a lot of ways to do it. The way for you will depend on what you feel comfortable doing.

Regardless, step #1 should be to make sure that you work with copies of the spooled file. Always keep track of the steps so you can quickly start from the beginning again.