View previous topic :: View next topic
Author
Message
Aneesh New User Joined: 30 Sep 2006Posts: 60
Hi,
I have 2 FB files of length 80 bytes. The key values are 2 fields of 6 bytes (1-6) and 4 bytes (7-10) and there can be duplicates for this in the first file. The second file will be a lookup key value file and will not have duplicates.
File1 (Bytes 16-80 are fillers)
AAAAAAYYYYTEST1
AAAAAAYYYYTEST2
AAAAAAZZZZTEST1
AAAAAAZZZZTEST2
AAAAAAZZZZTEST3
BBBBBBYYYYTEST5
File2 (Bytes 11-80 are fillers)
AAAAAAXXXX
AAAAAAYYYY
I need to create an output file that has records in file1 that are not in file2 based on key comparison of key1 and key2- but with some indicator to differentiate if key1 is present but not key2 or if key1 is not at all present in file2.
Output
AAAAAAZZZZTEST1 "Only key2"
AAAAAAZZZZTEST2 "Only key2"
AAAAAAZZZZTEST3 "Only key2"
BBBBBBYYYYTEST5 "Key1 "
This can be done by 2 separate splice/join keys comparing both keys and comparing and merging the files - can this be done in a single step/better way?
Thanks,
Aneesh
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
I think you mean in a single "pass". It could certainly be done in a single "step" using multiple ICETOOL operators.
I can't think of a way to do it in a single pass.
Back to top
Aneesh New User Joined: 30 Sep 2006Posts: 60
Hi Frank,
Yes - Single pass would have been amazing.
Even a single step approach - could you please let me know if you meant the below steps when you mentioned multiple operators in a single step?
First a splice for the full key
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
SPLICE FROM(T1) TO(T2) ON(01,10,CH) WITHALL WITH(01,15) -
KEEPNODUPS KEEPBASE USING(CTL3)
//CTL1CNTL DD *
OUTFIL FNAMES=T1,OVERLAY=(51:1,9,80:X)
//CTL2CNTL DD *
OUTFIL FNAMES=T1
//CTL3CNTL DD *
OUTFIL FNAMES=T2,INCLUDE=(11,5,CH,NE,C' ')
Then repeating similar steps above for a splice using the first key (01,6) and then merging.
Thanks,
Aneesh.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
You could use a one step DFSORT/ICETOOL job with JOINKEYS like the following to do what you asked for:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
AAAAAAYYYYTEST1
AAAAAAYYYYTEST2
AAAAAAZZZZTEST1
AAAAAAZZZZTEST2
AAAAAAZZZZTEST3
BBBBBBYYYYTEST5
/*
//IN2 DD *
AAAAAAXXXX
AAAAAAYYYY
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY JKFROM TO(T1) USING(CTL1)
COPY JKFROM TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
JOINKEYS F1=IN1,FIELDS=(1,10,A),TASKID=A1
JOINKEYS F2=IN2,FIELDS=(1,10,A),TASKID=A1
JOIN UNPAIRED,F1,ONLY
REFORMAT FIELDS=(F1:1,80)
OPTION COPY
/*
//CTL2CNTL DD *
JOINKEYS F1=T1,FIELDS=(1,6,A),TASKID=A2
JOINKEYS F2=IN2,FIELDS=(1,6,A),TASKID=A2
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,80,?)
OPTION COPY
OUTREC IFOUTLEN=80,
IFTHEN=(WHEN=(81,1,CH,EQ,C'B'),
OVERLAY=(17:C'"Only key2"')),
IFTHEN=(WHEN=NONE,OVERLAY=(17:C'"Key1"'))
/*
//A2F2CNTL DD *
SUM FIELDS=NONE
/*
Back to top
Please enable JavaScript!