View previous topic :: View next topic
|
Author |
Message |
senthil1kumar
New User
Joined: 20 May 2008 Posts: 5 Location: bangalore
|
|
|
|
Scenario :
I have a header record and N number of detailed records and finally a trailer record in my input file. I have to extract detailed records based on some condition and write it to the output file.Trailer record in the output file should contain the COUNT of all records that satisfied the condition (i.e # of detailed recs in o/p file).
Please help me on how to find the detailed record count.
Checked in few manuals but was not able to find this.Actually summary results in spool has the information i am looking for stored in SELTOT.However, i was not able to refer to that field inside the selcopy pgm.
Please give your suggestions.
Thank you! |
|
Back to top |
|
|
senthil1kumar
New User
Joined: 20 May 2008 Posts: 5 Location: bangalore
|
|
|
|
I dont believe i did that. I am exteremely sorry!
Will start a new topic!
Thanks |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I dont believe i did that. I am exteremely sorry! |
Not a problem. Sometimes people click "post reply" when they really want "new topic".
Your question has been separated from the original topic. The "other" new topic has been deleted. |
|
Back to top |
|
|
Nick Jones
New User
Joined: 28 Apr 2009 Posts: 13 Location: UK
|
|
|
|
You probably solved this a long time ago, but, in answer to your question...
Build a count field within your work area, increment it each time you write to your output file and insert the value in your trailer record when all records have been processed. e.g.
Code: |
EQU INREC 1 * Input records (LRECL<=100)
EQU TRAILREC 101 * Output trailer record.
EQU COUNT 201 * 4 Byte Packed Decimal Field.
OPTION WORKLEN=204 * Allocate user work area buffer.
POS COUNT = X'0000,000C' * Initialise the packed decimal count field.
READ INDD INTO INREC * Read next input record.
IF EOF INDD * End of input file reached ?
THEN POS TRAILREC="Number of records selected for output: xx,xxx"
THEN CVPC 4 AT COUNT TO TRAILREC+39 FMT=ZZ,ZZ9
THEN WRITE OUTDD FROM TRAILREC, TRAILREC+44
THEN GOTO EOJ * End-of-job.
IF.... * Test for output record criteria.
THEN WRITE OUTDD FROM INREC
THEN ADD 1 TO 4 AT COUNT * Increment the output record count.
* Processing loops back to the start of the control statements.
* Processing stops when end of prime input or GOTO EOJ is encountered. |
|
|
Back to top |
|
|
|