|
View previous topic :: View next topic
|
| Author |
Message |
Rambhupal.chaudari
New User
Joined: 30 Mar 2007 Posts: 25 Location: Hyderabad
|
|
|
|
Hi ALL,
Please help me in achieving below query.
I/p file format :-
EMP.no EMPname Salary
1 Ram 1000
2 Sam 200
1 Ram 900
3 Tom 200
4 Jam 100
2 Sam 1200
If you find any duplicates (Key fields are Emp No and Emp Name), the Indicator should be set to 'Y', otherwise, 'N'. The output should be in ascending order of Key.
O/P file format :-
EMP.no EMPname Salary Indicator
1 Ram 1900 Y
2 Sam 1400 Y
3 Tom 200 N
4 Jam 100 N
I want to get the above output file from given input, Using sort utility, with any number of steps.
I got the output with out the new field 'indicator'.
Please let me know any suggestions.
Thanks,
Ram. |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| Quote: |
| I got the output with out the new field 'indicator'. |
Post the sortcard you are using for this. |
|
| Back to top |
|
 |
Rambhupal.chaudari
New User
Joined: 30 Mar 2007 Posts: 25 Location: Hyderabad
|
|
|
|
Hi Sambhaji,
Here is my sysin , just to sum sal field.
| Code: |
//SYSIN DD *
SORT FIELDS=(1,1,zd,A,3,3,ch,a)
SUM FIELDS=(7,4,ZD)
/*
|
o/p will be
1 Ram 1900
2 Sam 1400
3 Tom 0200
4 Jam 0100 |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Rambhupal.chaudari,
Use the following DFSORT JCL
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5
1 RAM 1000
2 SAM 200
1 RAM 900
3 TOM 200
4 JAM 100
2 SAM 1200
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC OVERLAY=(81:C'01')
SORT FIELDS=(1,1,CH,A,3,3,CH,A)
SUM FIELDS=(7,4,ZD,81,2,ZD)
OUTREC IFOUTLEN=80,
IFTHEN=(WHEN=INIT,OVERLAY=(12:C'N')),
IFTHEN=(WHEN=(81,2,ZD,GT,1),OVERLAY=(12:C'Y'))
//* |
The output of this job is
| Code: |
1 RAM 1900 Y
2 SAM 1400 Y
3 TOM 200 N
4 JAM 100 N
|
|
|
| Back to top |
|
 |
Rambhupal.chaudari
New User
Joined: 30 Mar 2007 Posts: 25 Location: Hyderabad
|
|
|
|
Thank you very much Skolusu,
Its really nice logic. Amazing ..
thnks again,
Ram.. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|