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

How to calculate Record count


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
johndee

New User


Joined: 06 Dec 2006
Posts: 1
Location: Trivandrum

PostPosted: Wed Dec 06, 2006 3:39 pm
Reply with quote

Hi,

We are trying to calculate the record count.

The current situation is that we are generating the trailer in the sort control card and it is apended to the file at the bottom, but the trailer TOT parameter will have the count upto the previous record read only i.e the trailer record is not added to the count.

We need to include this trailer record also in the total count..can we have it done in the same control card .

Currently we have coded the control card as:
Code:

   SORT FIELDS=(44,20,CH,A)                                 
   SUM FIELDS=NONE                                         
   INREC FIELDS=(1,500,C'1')                               
   OUTFIL REMOVECC,                                         
   TRAILER1=(1:C'TRLHSA',7:TOT=(501,1,ZD,EDIT=(TTTTTTTTT)),
          16:C'065',19:482X)   


But now we need to include the trailer record as well , how can we do that in the same control card.

Thanks,
Johndee.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Dec 06, 2006 10:21 pm
Reply with quote

You don't need to use TOT to total up 1's to get the count. DFSORT has a COUNT parameter for that. And you can even use COUNT+1 to get the count of the data records + 1 for the trailer record. You can do it like this:

Code:

  INREC FIELDS=(1,500)    <---- if needed
  SORT FIELDS=(44,20,CH,A)                               
  SUM FIELDS=NONE                                       
  OUTFIL REMOVECC,                                       
   TRAILER1=(1:C'TRLHSA',7:COUNT+1=(EDIT=(TTTTTTTTT)),   
        16:C'065',19:482X)                               
Back to top
View user's profile Send private message
diwansk

New User


Joined: 01 May 2005
Posts: 4
Location: Bangalore

PostPosted: Tue Feb 20, 2007 7:29 pm
Reply with quote

I have one more query on this. Can the record count be a variable field. In the example given above, the count will be written to a field of length 7 so if the rec count is 1600 it will come as 0001600. I dont leading zeros, is it possible using Sort ?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Feb 20, 2007 9:29 pm
Reply with quote

You can display blanks instead of leading zeros by using:

COUNT+1=(EDIT=(IIIIIIIIT)

Note that the count will still be 7 characters but it will not have the leading zeros.

If you're asking if you can change the length of the count based on omitting leading zeros (e.g. a length of 4 for 1600 and a length of 7 for 1234567), there are no built-in functions for that.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts To get the count of rows for every 1 ... DB2 3
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top