IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SELCOPY - Select some records - create trlr w/ count


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
senthil1kumar

New User


Joined: 20 May 2008
Posts: 5
Location: bangalore

PostPosted: Fri May 30, 2008 11:56 am
Reply with quote

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
View user's profile Send private message
senthil1kumar

New User


Joined: 20 May 2008
Posts: 5
Location: bangalore

PostPosted: Fri May 30, 2008 2:37 pm
Reply with quote

I dont believe i did that. I am exteremely sorry! icon_sad.gif

Will start a new topic!

Thanks
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri May 30, 2008 10:43 pm
Reply with quote

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
View user's profile Send private message
Nick Jones

New User


Joined: 28 Apr 2009
Posts: 13
Location: UK

PostPosted: Thu Apr 30, 2009 4:01 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top