Topic Options
#48348 - 06/13/14 04:47 PM Is it possible to restart and rewind a PDC at EOF?
KP_ABD Offline
OL Newbie

Registered: 12/12/13
Posts: 25

I have an AFPDS setup , that I want to go through, spool out a file for a specific value in a data field, then at the end of the data file, go back to the start of file, change my conditional testing to a different value, then spool a new file based upon the new value.

Is this possible or is the only way to accomplish this is to set my first value in my PDS, compile and spool; then change the value I am looking for in the PDS, recompile and spool new file?

#48406 - 06/19/14 01:30 PM Re: Is it possible to restart and rewind a PDC at EOF? [Re: KP_ABD]

The use of instructions REWIND, SPACEFILE, IGNORE, RETURN will need to be used in continuation.

REWIND will take you back to the beginning of the input file.

SPACEFILE allows you to move forwards or backwards in a input file.

IGNORE will keep the page buffer, and move to the next record.

RETURN will go back to the beginning of the script.

In concept you have a loop to process condition1.
Upon end of this loop, you REWIND, reset the condition to value2, and process. And so on.

The output, might be tricky. The instruction CLOSESPOOL is NOT AFP relevant. Simply re-declare the SPOOL instruction to create a new spool file.

Edited by Jeff_K (06/19/14 01:32 PM)
Edit Reason: correction