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
 
How to find Count of some records using SORT utility

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
shivani_jha

New User


Joined: 12 Feb 2007
Posts: 11
Location: mumbai

PostPosted: Tue Feb 13, 2007 12:01 pm    Post subject: How to find Count of some records using SORT utility
Reply with quote

hi

I want to find the count and sum of all X type of records of a file using SORT utility. I have X, Y and Z type of records in file.

How can I get the output which should have count of X records Sum of X records
Count of Y records and Sum of Y records in this pattern.

Shivani
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


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

PostPosted: Tue Feb 13, 2007 9:46 pm    Post subject:
Reply with quote

What is the RECFM and LRECL of your input file. What is the starting position, length and format of the relevant fields? Please show an example of your input records and the records you expect for output.
Back to top
View user's profile Send private message
anand_smail

New User


Joined: 05 Jun 2005
Posts: 13

PostPosted: Fri Feb 23, 2007 12:57 pm    Post subject: Re: How to find Count of some records using SORT utility
Reply with quote

shivani_jha wrote:
hi

I want to find the count and sum of all X type of records of a file using SORT utility. I have X, Y and Z type of records in file.

How can I get the output which should have count of X records Sum of X records
Count of Y records and Sum of Y records in this pattern.

Shivani

Do you got the answer to this question?
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Fri Feb 23, 2007 1:44 pm    Post subject:
Reply with quote

Here you go.

(SYNCSORT)
Code:

//PS010   EXEC PGM=SYNCSORT         
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD *                     
AAA     11                           
AAA     22                           
BBB     11                           
BBB     22                           
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                     
  SORT FIELDS=(1,3,CH,A)             
  SUM FIELDS=(9,2,ZD)               


Code:


SYSOUT  :
AAA     33
BBB     33

Thanks
Krishy
[/code]
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Fri Feb 23, 2007 1:54 pm    Post subject:
Reply with quote

Sorry,
Please change the control card as below to get the total number of records as well.

Code:

INREC FIELDS=(1,20,21:C'00001')
SORT FIELDS=(1,3,CH,A)         
SUM FIELDS=(9,2,ZD,21,5,ZD)   


Sysout :

Code:


AAA     33          00002
BBB     33          00002


Thanks
Krishy
[/code]
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Feb 23, 2007 9:55 pm    Post subject:
Reply with quote

If that's the requirement (and we don't know that it is), here's a more efficient way to do it (copy vs sort) with DFSORT:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
AAA     11
AAA     22
BBB     11
BBB     22
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
    SECTIONS=(1,3,
      TRAILER3=(1,3,X,
       TOT=(9,2,ZD,M11,LENGTH=5),X,
       COUNT=(M11,LENGTH=5)))
/*
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 -> DFSORT/ICETOOL 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 Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
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 JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am

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