View previous topic :: View next topic
|
Author |
Message |
samanthjain
New User
Joined: 25 Jul 2008 Posts: 17 Location: Mumbai
|
|
|
|
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
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 |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
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 |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|