| Author |
Message |
itjagadesh
New User
Joined: 05 Dec 2006 Posts: 12 Location: chennai
|
|
|
|
Hi All Consider a scenario below,
Input
1001 B 2008100
1001 O 2007100
1002 O 2008100
1002 B 2008101
1003 B 2008102
1003 B 2008103
1003 B 2008104
Output
1001 B 2008100
1002 B 2008101
Problem: Input contains employee,indicator and timestamp.
When an employee contains both 'B' and 'O' records we need to write only B records into output. If an employee doesn't contains 'O' records then no need write into output (1003 employee doesn't contains O record). |
|
| Back to top |
|
 |
References
|
Posted: Tue May 06, 2008 5:53 pm Post subject: Re: Need Help Regarding removing duplicate |
 |
|
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 3777 Location: San Jose, CA
|
|
|
|
What would you want for output for these input records?
| Code: |
1004 O 2008102
1004 O 2008103
1004 O 2008104
1005 B 2008102
1005 O 2008103
1005 B 2008104
|
What is the RECFM and LRECL of your input file? |
|
| Back to top |
|
 |
itjagadesh
New User
Joined: 05 Dec 2006 Posts: 12 Location: chennai
|
|
|
|
Hi Frank,
I need the output in following format(only one record inthe output)
1005 B 2008104
ie) 1004 employee doesn't contains B type record. so no need to write into output.
ie)1005 conatins both 'B' and 'O' type record so we need to write into output (with latest time stamp).
Req : Need to write only 'B' type record into output only when employee contains both 'B' and 'O' type record.otherwise no need to write into output |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 3777 Location: San Jose, CA
|
|
|
|
Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file (FB/80)
//TOOLIN DD *
SORT FROM(IN) TO(T1) USING(CTL1)
SORT FROM(T1) USING(CTL2)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=(6,1,CH,EQ,C'B'),OVERLAY=(81:C'0000100000')),
IFTHEN=(WHEN=(6,1,CH,EQ,C'O'),OVERLAY=(81:C'0000000001'))
SORT FIELDS=(1,4,CH,A,6,1,CH,A,8,7,CH,D)
/*
//CTL2CNTL DD *
OPTION EQUALS,ZDPRINT
SORT FIELDS=(1,4,CH,A)
SUM FIELDS=(81,5,ZD,86,5,ZD)
OUTFIL FNAMES=OUT,OMIT=(81,5,ZD,EQ,0,OR,86,5,ZD,EQ,0),
BUILD=(1,80)
/*
|
|
|
| Back to top |
|
 |
|
|
|