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

Count of records using ICETOOL


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

New User


Joined: 27 Mar 2007
Posts: 10
Location: India

PostPosted: Mon Feb 18, 2008 7:13 pm
Reply with quote

I have my input like this:

Code:

AB 1234 hi
AB 5678 ok
AB 9876 fj
CD 2345 jj
CD 8765 lo
EF 4443 vx


I want my output as:

Code:

AB 3
CD 2
EF 1


How do i do using SORT/ ICETOOL?
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: Mon Feb 18, 2008 10:00 pm
Reply with quote

You can use a DFSORT job like this to do what you asked for. You show the count as 1 digit so that's what I gave you. If you want more digits, then just change the EDIT mask accordingly, e.g. EDIT=(TTT) for 3 digits with leading zeros or EDIT=(IIT) for 3 digits without leading zeros.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
AB 1234 hi
AB 5678 ok
AB 9876 fj
CD 2345 jj
CD 8765 lo
EF 4443 vx
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
    SECTIONS=(1,2,
      TRAILER3=(1,3,COUNT=(EDIT=(T))))
/*
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Tue Feb 19, 2008 9:20 am
Reply with quote

You can also get the desired results by using the below DFSORT JCL

Code:
//VZM1CKKN JOB (3GAHF3,R),                                       
//         'RAJAT TEST',CLASS=X,MSGCLASS=Y,NOTIFY=&SYSUID       
//S1      EXEC PGM=ICETOOL                                       
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//*                                                             
//IN       DD *                                                 
AB 1234 HI                                                       
AB 5678 OK                                                       
AB 9876 FJ                                                       
CD 2345 JJ                                                       
CD 8765 LO                                                       
EF 4443 VX                                                       
/*
//T1       DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS) 
//T2       DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS) 
//OUT      DD SYSOUT=*                                           
//TOOLIN   DD *                                                   
    SORT FROM(IN) TO(T1) USING(SRT1)                             
    SPLICE FROM(T1) TO(T2) ON(1,2,CH) WITH(80,6) -               
    KEEPNODUPS                                                   
    COPY FROM(T2) TO(OUT) USING(CPY1)                             
/*                                                               
//SRT1CNTL DD *                                                   
    OPTION COPY                                                   
    SORT FIELDS=(1,2,CH,A)                                       
    OUTREC OVERLAY=(80:SEQNUM,3,ZD,START=1,INCR=1,RESTART=(1,2)) 
/*                                                               
//CPY1CNTL DD *                                                   
    OPTION COPY                                                   
    OUTREC FIELDS=(1,2,5:80,3,72:X)                               
/*                                                               
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Feb 19, 2008 9:27 am
Reply with quote

Hello,

Just curious. . . .

Is there some reason you posted a suggestion that requires multiple passes of the data as well as multiple intermediate work files and requires sorting/merging the data, when the original solution meets the requirement with a single pass of the data and requires no sorting of the data at all?


Are you possibly a hardware salesperson?
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Tue Feb 19, 2008 10:10 am
Reply with quote

Quote:
Are you possibly a hardware salesperson?


No....a developer....


I just answered to this post because I thought of an another idea to do this... I know the JCL poseted by frank is more efficent then mine.... if you feel i did anything wrong then i am sorry...
Back to top
View user's profile Send private message
mukunthg

New User


Joined: 27 Mar 2007
Posts: 10
Location: India

PostPosted: Tue Feb 19, 2008 2:53 pm
Reply with quote

Thanks Frank. It works! icon_smile.gif
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 19, 2008 9:42 pm
Reply with quote

Quote:
Are you possibly a hardware salesperson?


Good one, Dick.

I don't know whether to laugh or cry.
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