| Author |
Message |
itjagadesh
New User
Joined: 05 Dec 2006 Posts: 15 Location: chennai
|
|
|
|
Hi all,
consider a below input record (REF = 80 FB) contains employee and indicator
Input
| Code: |
Employee Indicator
1 y
1 N
2 Y
3 Y
3 N
|
Output
| Code: |
Employee Indicator
1 y
3 y
|
Req : same Employee with different indicator.When an employee with two different we need to write first record into output.
In our case employee 1 and 3 contains record with two different indicator so we need to write first occurance of record into output. Employee 2 doesn contains two type of indicator.so no need to write into output.
please help me out to sort this |
|
| Back to top |
|
 |
References
|
Posted: Wed May 07, 2008 6:24 pm Post subject: Re: When an employee with two difference write first record |
 |
|
|
 |
HappySrinu
Active User
Joined: 22 Jan 2008 Posts: 87 Location: India
|
|
|
|
first gather only the values who are repeating in to file.
then duplicate using first column. guess it works. |
|
| Back to top |
|
 |
dbzTHEdinosauer
Senior Member
Joined: 20 Oct 2006 Posts: 903 Location: germany
|
|
|
|
could there be 3 records for an employee?
is the input file sorted? if so, what are the keys? |
|
| Back to top |
|
 |
dbzTHEdinosauer
Senior Member
Joined: 20 Oct 2006 Posts: 903 Location: germany
|
|
|
|
| also, I would like to commend you for such a useful title/subject. I am sure that others searching will find a wealth of info. |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 109 Location: San Jose
|
|
|
|
The following DFSORT JCL will give you the desired results. I assumed that your employee is 10 bytes length key and the indicator starts at pos 15. I also assumed that the indicator must be Y or N.
| Code: |
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1 Y
1 N
2 Y
3 Y
3 N
4 N
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION EQUALS
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'00')),
IFTHEN=(WHEN=(15,1,CH,EQ,C'Y'),OVERLAY=(81:C'1')),
IFTHEN=(WHEN=(15,1,CH,EQ,C'N'),OVERLAY=(82:C'1'))
SORT FIELDS=(01,10,CH,A)
SUM FIELDS=(81,1,ZD,82,1,ZD)
OUTFIL OMIT=((81,1,ZD,EQ,0,AND,82,1,ZD,GT,0),OR,
(81,1,ZD,GT,0,AND,82,1,ZD,EQ,0)),
BUILD=(01,80)
/* |
Hope this helps...
Cheers
Kolusu |
|
| Back to top |
|
 |
|
|
|