View previous topic :: View next topic
|
Author |
Message |
mukunthg
New User
Joined: 27 Mar 2007 Posts: 10 Location: India
|
|
|
|
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:
How do i do using SORT/ ICETOOL? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
rajatbagga
Active User
Joined: 11 Mar 2007 Posts: 199 Location: india
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
rajatbagga
Active User
Joined: 11 Mar 2007 Posts: 199 Location: india
|
|
|
|
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 |
|
|
mukunthg
New User
Joined: 27 Mar 2007 Posts: 10 Location: India
|
|
|
|
Thanks Frank. It works! |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
Are you possibly a hardware salesperson? |
Good one, Dick.
I don't know whether to laugh or cry. |
|
Back to top |
|
|
|