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

How to count the no. of records using DFSORT/ICETOOL


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

New User


Joined: 25 Jul 2008
Posts: 17
Location: Mumbai

PostPosted: Tue Jun 23, 2009 1:30 pm
Reply with quote

Hi,

I have an input file like below :
Code:


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


I want the count of records having AB in the first 2 columns. Can I do this using SORT/ICETOOL.
Please help me on this.
Thanks in Advance.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Tue Jun 23, 2009 2:04 pm
Reply with quote

This should do the trick

Code:
///STEP1 EXEC PGM=ICETOOL           
//TOOLMSG DD SYSOUT=*             
//DFSMSG  DD SYSOUT=*             
//INPUT   DD *                     
AB 1234 hi                         
CD 5678 ok                         
   9876 fj                         
AD 2345 jj                         
CD 8765 lo                         
EF 4443 vx                         
AB 4443 vx                         
//TOOLIN  DD *                     
*                                 
 COUNT FROM(INPUT) USING(CTL1)     
*                                 
//*                               
//CTL1CNTL DD *                     
 INCLUDE COND=(1,2,CH,EQ,C'AB')     
/*                                   

Garry

[/code]
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Tue Jun 23, 2009 2:18 pm
Reply with quote

Indeed the above method can do it.

But how to put the number into a file which is to be processed by other steps?
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Tue Jun 23, 2009 2:57 pm
Reply with quote

A small change

Code:
//STEP1 EXEC PGM=ICETOOL                                   
//TOOLMSG DD DISP=(,PASS),UNIT=VIO,SPACE=(TRK,1),       
//   DSN=&&MSG
//SYSPRINT DD SYSOUT=*                                     
//OUT DD SYSOUT=*                                         
//DFSMSG  DD SYSOUT=*                                     
//INPUT   DD *                                             
AB 1234 hi                                                 
CD 5678 ok                                                 
   9876 fj                                                 
AD 2345 jj                                                 
CD 8765 lo                                                 
EF 4443 vx                                                 
AB 4443 vx                                                 
//TOOLIN  DD *                                             
*                                                         
 COUNT FROM(INPUT) USING(CTL1)                             
*                                                         
//*                                                       
//CTL1CNTL DD *                                           
 INCLUDE COND=(1,2,CH,EQ,C'AB')                           
/*                                               
//STEP2 EXEC PGM=ICETOOL                         
//TOOLMSG DD SYSOUT=*                             
//TOOLO   DD DISP=(OLD,DELETE),                           
//   DSN=&&MSG
//SYSPRINT DD SYSOUT=*                           
//RESULT DD SYSOUT=*                             
//DFSMSG  DD SYSOUT=*                             
//TOOLIN  DD *                                   
*                                                 
 COPY FROM(TOOLO) TO(RESULT) USING(CTL2)         
*                                                 
//*                                               
//CTL2CNTL DD *                                   
 INCLUDE COND=(2,7,CH,EQ,C'ICE628I')             
 INREC BUILD=(1:27,15)                           
/*                                               


To get what you want in dataset, change the //RESULT DD to refer to the dataset where you want the count

Garry.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Jun 23, 2009 3:12 pm
Reply with quote

Hi,

this might be a little easier
Code:
//S1       EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                 
AB 1234 HI                                                       
AB 1234 HI                                                       
CD 5678 OK                                                       
   9876 FJ                                                       
AD 2345 JJ                                                       
CD 8765 LO                                                       
EF 4443 VX                                                       
AB 4443 VX                                                       
//SORTOUT  DD SYSOUT=*  write this to a dataset    LRECL=9             
//SYSIN    DD *                                                 
  OPTION COPY                                                   
  INCLUDE COND=(1,2,CH,EQ,C'AB')                                 
   OUTFIL REMOVECC,NODETAIL,                                     
     BUILD=(9X),                                                 
     TRAILER1=(COUNT=(M11,LENGTH=9))   
/*                         

Gerry
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 Jun 23, 2009 9:06 pm
Reply with quote

Here's a DFSORT/ICETOOL job that's even easier. It uses the new WRITE operand of COUNT available with z/OS DFSORT PTF UK90013 (July, 2008). For complete details, see:

Use [URL] BBCode for External Links

Code:

//S1 EXEC PGM=ICETOOL                                           
//TOOLMSG DD SYSOUT=*                                           
//DFSMSG  DD SYSOUT=*                                           
//INPUT   DD *                                                   
AB 1234 HI                                                       
CD 5678 OK                                                       
   9876 FJ                                                       
AD 2345 JJ                                                       
CD 8765 LO                                                       
EF 4443 VX                                                       
AB 4443 VX       
/*                                               
//OUT DD SYSOUT=*                                               
//TOOLIN  DD *                                                   
COUNT FROM(INPUT) USING(CTL1) WRITE(OUT) DIGITS(9)               
/*                                                               
//CTL1CNTL DD *                                                 
  INCLUDE COND=(1,2,CH,EQ,C'AB')                                 
/*                                                               
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top