View previous topic :: View next topic
|
Author |
Message |
bcmohanty
New User
Joined: 17 May 2006 Posts: 17
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|