Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us