Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SELCOPY - Select some records - create trlr w/ count

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
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    Post subject: SELCOPY - Select some records - create trlr w/ count
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    Post subject:
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

Site Director


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

PostPosted: Fri May 30, 2008 10:43 pm    Post subject:
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    Post subject: SELCOPY - Select some records - create trlr w/ count
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    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts copy SEQ to PDS and create stats steve-myers JCL & VSAM 5 Thu Apr 27, 2017 1:15 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us