View previous topic :: View next topic
Author
Message
sathyaraj New User Joined: 28 Sep 2007Posts: 71 Location: India.
Hi Frank..
In need of your help again.. I tried to solve this with the learnings from the previous task but cudn..
here is my input
Code:
1234,ARUN ,KUMAR ,EE,5
1234,KISHORE ,KUMAR ,DP,5
1234,VARUN ,RAM ,EE,5
1234,THARUN ,PRASAD ,DP,7
1234,KAMAL ,KUMAR ,EE,7
1235,GANESH ,NAIR ,EE,6
1235,SELVA ,PETER ,DP,6
1235,JOHN ,NIMAL ,EE,5
1235,SHEELA ,PRATAP ,DP,6
And I need to get an O/P like this one..
Code:
1234 EE DP
5 - 2 1
7 - 1 1
1235 EE DP
6 - 1 2
5 - 1 0
The first feild is the customer number
The count of EEs and DPs for each customer is required and also that needs to be split with respect to the last digit..
Hope i made it clear...
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Here's a DFSORT job that will do what you asked for:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1234,ARUN ,KUMAR ,EE,5
1234,KISHORE ,KUMAR ,DP,5
1234,VARUN ,RAM ,EE,5
1234,THARUN ,PRASAD ,DP,7
1234,KAMAL ,KUMAR ,EE,7
1235,GANESH ,NAIR ,EE,6
1235,SELVA ,PETER ,DP,6
1235,JOHN ,NIMAL ,EE,5
1235,SHEELA ,PRATAP ,DP,6
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFOUTLEN=11,
IFTHEN=(WHEN=(26,2,CH,EQ,C'EE'),
BUILD=(1,4,29,1,7:C'01')),
IFTHEN=(WHEN=NONE,
BUILD=(1,4,29,1,10:C'01'))
SORT FIELDS=(1,5,CH,A)
OUTFIL REMOVECC,NODETAIL,
BUILD=(11X),
SECTIONS=(1,4,
HEADER3=(/,1,4,7:'EE',10:'DP',/),
5,1,
TRAILER3=(2:5,1,5:'-',
7:TOT=(7,2,ZD,EDIT=(IT)),
10:TOT=(10,2,ZD,EDIT=(IT))))
/*
Back to top
sathyaraj New User Joined: 28 Sep 2007Posts: 71 Location: India.
Thnx once again.. Its working good.. Nd i have one more query..
I duno if its possible.. but thought of giving a try...
In my input file if the last feild is 5 then sould move the second feild to the last position.. i,e after the "5"...
rest of the records should be left unchanged... can it be done using icetool..?
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Please show and explain your expected output for your input example.
Back to top
sathyaraj New User Joined: 28 Sep 2007Posts: 71 Location: India.
Hi..
Code:
1234, ,KUMAR ,EE,5,ARUN
1234, ,KUMAR ,DP,5,KISHORE
1234, ,RAM ,EE,5,VARUN
1234,THARUN ,PRASAD ,DP,7
1234,KAMAL ,KUMAR ,EE,7
1235,GANESH ,NAIR ,EE,6
1235,SELVA ,PETER ,DP,6
1235, ,NIMAL ,EE,5,JOHN
1235,SHEELA ,PRATAP ,DP,6
The second field in the records having last cgaracter as 5 should be moved to the position after the last feild...
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Sigh. I guess this is a totally different output unrelated to your original output?
This DFSORT job will do what you asked for:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1234,ARUN ,KUMAR ,EE,5
1234,KISHORE ,KUMAR ,DP,5
1234,VARUN ,RAM ,EE,5
1234,THARUN ,PRASAD ,DP,7
1234,KAMAL ,KUMAR ,EE,7
1235,GANESH ,NAIR ,EE,6
1235,SELVA ,PETER ,DP,6
1235,JOHN ,NIMAL ,EE,5
1235,SHEELA ,PRATAP ,DP,6
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=(29,1,CH,EQ,C'5'),
BUILD=(1,5,16:16,14,30:5,10))
/*
Back to top
sathyaraj New User Joined: 28 Sep 2007Posts: 71 Location: India.
Hi... Yes this is for a different requirement..
Usually we were employing cobol to do this.. Going forward we will be able to save lots of time.. Thnx a lot..
Back to top
Please enable JavaScript!