MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sorting and Group Totals

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Satish
Beginner


Joined: 26 Dec 2002
Posts: 7
Topics: 3

PostPosted: Fri Jan 10, 2003 10:16 am    Post subject: Sorting and Group Totals Reply with quote

Hi,

We have the following sequential file and the requirement is to find out total number records for each type ( i.e AA, BB, DD, XX and TT)

Right now we are doing this thru programming. can somebody help me to do the same using DFSORT.

The input sequentail file is:
Code:

2354    AA    787878
8787    XX    553535
4545    BB    545445
8787    AA    724135
8153    BB    385452
5625    XX    854545
2455    TT    545454
2632    XX    656566
5454    DD    954455

The output file should look like:
Code:

AA       02
BB       02
DD       01
TT       01
XX       03

Thanks in advance
Satish
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Fri Jan 10, 2003 10:29 am    Post subject: Reply with quote

Satish,

There are many ways to get the desired results. I am showing 2 of them. The following DFSORT/ICETOOL jcl will give you the desired results.

Code:

//STEP0100 EXEC  PGM=SORT                                     
//*
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                               
2354 AA 787878                                                 
8787 XX 553535                                                 
4545 BB 545445                                                 
8787 AA 724135                                                 
8153 BB 385452                                                 
5625 XX 854545                                                 
2455 TT 545454                                                 
2632 XX 656566                                                 
5454 DD 954455                                                 
//SORTOUT  DD DSN=YOUR OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN     DD *                                               
  OPTION ZDPRINT                                               
  INREC FIELDS=(6,2,C'001')          * DESIRED FIELD + COUNTER 
  SORT  FIELDS=(1,2,CH,A)            * SORT ON CONTROL FIELD   
  SUM   FIELDS=(3,3,ZD)              * SUMMARIZE IN COUNTER     
  OUTFIL OUTREC=(1,2,X,3,3)                                     
/*


METHOD:2

Code:

//STEP0100 EXEC  PGM=ICETOOL                                       
//*
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD *                                                     
2354 AA 787878                                                       
8787 XX 553535                                                       
4545 BB 545445                                                       
8787 AA 724135                                                       
8153 BB 385452                                                       
5625 XX 854545                                                       
2455 TT 545454                                                       
2632 XX 656566                                                       
5454 DD 954455                                                       
//OUT      DD DSN=YOUR OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//TOOLIN    DD *                                                     
   OCCURS FROM(IN) LIST(OUT) HEADER('KEY') HEADER('COUNT') -         
   ON(6,2,CH) ON(VALCNT) BLANK                                       
/*           


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Satish
Beginner


Joined: 26 Dec 2002
Posts: 7
Topics: 3

PostPosted: Fri Jan 10, 2003 11:21 am    Post subject: Reply with quote

Wow !! Thanks Kolusu,

I tried both.. initially I had a problem with ICETOOL and I realized that I have to use SYS.SICELINK in the Joblib. Both the solutions are working great Kolusu.

Thanks again
Satish
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Jan 10, 2003 12:30 pm    Post subject: Reply with quote

By default, ICETOOL displays 15 digits for ON(VALCNT), so Kolusu's DFSORT/ICETOOL job would give you the following output:

Code:

KEY             COUNT     
---   ---------------     
AA                  2     
BB                  2     
DD                  1     
TT                  1     
XX                  3     


However, if you have DFSORT PTF UQ99331 (March, 2002) installed, you can get a little fancier and use formatting fields with ON(VALCNT), to change the number of digits ICETOOL displays.

If you need leading zeros, you can use E'99...9' to specify the number of digits you want ICETOOL to display. For example:

Code:

   OCCURS FROM(IN) LIST(OUT) HEADER('KEY') HEADER('COUNT') -         
   ON(6,2,CH) ON(VALCNT,E'999') BLANK                                       


would give you the following output:

Code:

KEY   COUNT
---   -----
AA      002
BB      002
DD      001
TT      001
XX      003


If you don't need leading zeros, you can use Ndd to reduce the number of digits displayed from 15 to dd. For example:

Code:

   OCCURS FROM(IN) LIST(OUT) HEADER('KEY') HEADER('COUNT') -         
   ON(6,2,CH) ON(VALCNT,N03) BLANK                                       


would give you the following output:

Code:

KEY   COUNT
---   -----
AA        2
BB        2
DD        1
TT        1
XX        3


For more information on the new ICETOOL features available with PTF UQ99331, see:

http://www.storage.ibm.com/software/sort/mvs/summary_changes/srtmsocc.html#u331
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Satish
Beginner


Joined: 26 Dec 2002
Posts: 7
Topics: 3

PostPosted: Fri Jan 10, 2003 1:47 pm    Post subject: Reply with quote

Hi Frank,

I tired ur solution.. I am getting the following error..

Code:
ICE600I 0 DFSORT ICETOOL UTILITY RUN STARTED                               
                                                                           
ICE632I 0 SOURCE FOR ICETOOL STATEMENTS:  TOOLIN                           
                                                                           
                                                                           
ICE630I 0 MODE IN EFFECT:  STOP                                           
                                                                           
              OCCURS FROM(IN) LIST(OUT) HEADER('KEY') HEADER('COUNT') -   
              ON(6,2,CH) ON(VALCNT,E'999') BLANK                           
                                  $                                       
ICE604A 0 ERROR IN KEYWORD, PARAMETER, OR DELIMITER                       
ICE602I 0 OPERATION RETURN CODE:  12                                       
                                                                           
                                                                           
ICE601I 0 DFSORT ICETOOL UTILITY RUN ENDED - RETURN CODE:  12             



Is it bcoz my system doesn't have DFSORT PTF UQ99331 ??
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Jan 10, 2003 3:26 pm    Post subject: Reply with quote

Satish,

Yes, it's because DFSORT PTF UQ99331 is not installed at your shop. Ask your System Programmer to install it (it's free).

Here are the ICETOOL messages you get when you do have UQ99331:

Code:

ICE600I 0 DFSORT ICETOOL UTILITY RUN STARTED                               
                                                                           
ICE632I 0 SOURCE FOR ICETOOL STATEMENTS:  TOOLIN                           
                                                                           
                                                                           
ICE630I 0 MODE IN EFFECT:  STOP                                           
                                                                           
             OCCURS FROM(IN) LIST(OUT) HEADER('KEY') HEADER('COUNT') -     
             ON(6,2,CH) ON(VALCNT,E'999') BLANK                           
ICE643I 0 WIDTH OF REPORT IS 0121 BYTES                                   
ICE627I 0 DFSORT CALL 0001 FOR SORT FROM IN       TO E35 EXIT COMPLETED   
ICE603I 0 INFORMATION PRINTED IN OUT      DATA SET                         
ICE628I 0 RECORD COUNT:  000000000000009                                   
ICE638I 0 NUMBER OF RECORDS RESULTING FROM CRITERIA:  000000000000005     
ICE602I 0 OPERATION RETURN CODE:  00                                       

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group