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

count the number of records


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

New User


Joined: 17 May 2006
Posts: 17

PostPosted: Thu Jun 29, 2006 12:21 pm
Reply with quote

plese let me know how to count the number of records using sort
requirement
i have 46 state codes
first i need to sort them (Done)
then counts the number of records for particular coads.....
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: Thu Jun 29, 2006 8:54 pm
Reply with quote

Please show an example of your input records and what you want for output. What is the RECFM and LRECL of the input file? What is the starting position, length and format of the state code field?
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Fri Jun 30, 2006 12:11 pm
Reply with quote

Hi,
Here is the solution with few assumptions.

1)State code is of length 2 starting at position 9.
2)Sortting is done on the state code.
4)Total number of records were displayed with the total record on state code basis.

Code:


//PS020    EXEC PGM=ICETOOL                                 
----+----1----+----2----+----3----+----4----+----5----+----6-
//SYSOUT   DD  SYSOUT=*                                     
//TOOLMSG  DD  SYSOUT=*                                     
//DFSMSG   DD  SYSOUT=*                                     
//IN1      DD  *                                             
12345   AP                                                   
23456   AP                                                   
21345   TN                                                   
213456  TN                                                   
212121  TN                                                   
213456  HR                                                   
212121  HR                                                   
//OUT1     DD  SYSOUT=*                                     
//TOOLIN   DD  *                                             
   SORT FROM(IN1) TO(OUT1) USING(CTL1)                       
//CTL1CNTL DD  *                                             
   INREC FIELDS=(1,10,C'00000001')                           
   SORT FIELDS=(9,2,CH,A)                                   
   SUM FIELDS=(11,8,ZD)                                     
   OUTREC FIELDS=(1,10,11,8,ZD,M10,66X)                     
/*                                                           



The o/p will look like

Code:


12345   AP       2
213456  HR       2
21345   TN       3



Thank you
Krishy
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: Fri Jun 30, 2006 8:34 pm
Reply with quote

That particular requirement can be done more easily with DFSORT/ICETOOL's OCCUR operator. For example:

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file
//RPT DD SYSOUT=*
//TOOLIN DD *
OCCUR FROM(IN) LIST(RPT) BLANK -
  HEADER('State') ON(9,2,CH) -
  HEADER('Count') ON(VALCNT,U05)
/*


RPT will have:

Code:

State    Count     
-----   ------     
AP           2     
HR           2     
TN           3     


Of course, the report can be tailored appropriately using various OCCUR options as described at:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA10/6.9?DT=20050222160456
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 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