|
View previous topic :: View next topic
|
| Author |
Message |
sumitmalik29 Warnings : 1 New User
Joined: 10 Feb 2008 Posts: 19 Location: bhuneswar
|
|
|
|
1) to extract the last record from file A and compare the extracted record with records from file B, If a match is found place duplicate records in file C,
If file B also has duplicate records, they needs to be placed in file C,
2) File D to contain unique records
Files record length 2000 and Fixed block.
For example
FILE A records
AAAAAAAAAXYAA12345
BBBBBBBBBXYBB17890
CCCCCCCCCXYCC22222
CCCCCCCCCXYCC22222
DDDDDDDDDXYDD44444
EEEEEEEEEXYEE55555
FILE B
AAAAAAAAAXYAA12346
BBBBBBBBBXYBB17898
CCCCCCCCCXYCC22222
FFFFFFFFFFXYFF33333
DDDDDDDDDXYDD44444
file C output
CCCCCCCCCXYCC22222
CCCCCCCCCXYCC22222
DDDDDDDDDXYDD44444 -> from File A
DDDDDDDDDXYDD44444 -> from file B
file D output
AAAAAAAAAXYAA12345
BBBBBBBBBXYBB17890
EEEEEEEEEXYEE55555
Comparison of file A and B is done on columns 14 to 18
I am having a limitation to use SUBSET, GROUP functions and created the below jcl for this
| Code: |
//STEP021 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=FILE1,DISP=SHR
//IN2 DD DSN=FILE2,DISP=SHR
//T1 DD DSN=FILE3,
//*
//OUT DD DSN=FILE4,
//*
//OUT1 DD DSN=FILE5,
//*-----------------------------------------------------------------
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL2)
COPY FROM(IN1) TO(T1) USING(CTL1)
SELECT FROM(T1) TO(OUT) ON(14,4,CH) NODUPS USING(CTL3) DISCARD(OUT1)
//CTL1CNTL DD *
INREC OVERLAY=(2001:SEQNUM,8,ZD)
SORT FIELDS=(2001,8,ZD,D)
OUTFIL FNAMES=T1,ENDREC=01,BUILD=(1,2000)
/*
//CTL2CNTL DD *
INCLUDE COND=(10,2,CH,EQ,C'XY')
INREC OVERLAY=(2000:C'1')
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(2000,1,CH,EQ,C'1'),
BUILD=(1,1999,1X)
/*
|
But in CTL2CNTL column 2000 is overlayed, that overtypes if data is already available in column 2000. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Your description of what you want is very confusing and your example doesn't help.
| Quote: |
| to extract the last record from file A and compare the extracted record with records from file B, ... |
The last record in file A is the 55555 record - there's no match for this in File B, so I don't understand your 1) rule.
In File C, where do the two 22222 records come from (file A or file B or both)? Why do the 44444 records come from fileA and fileB?
You need to show a better example of input and expected output that makes it clear where each output record comes from. You need to do a better job of explaining the "rules" for getting from input to output. |
|
| Back to top |
|
 |
sumitmalik29 Warnings : 1 New User
Joined: 10 Feb 2008 Posts: 19 Location: bhuneswar
|
|
|
|
Frank, Very Sorry for creating confusion.
Instead of writing file A , I have written file B and vice-versa
Correcting the rule 1
I have to compare the last record from file B i.e. (44444) with the records from file A.
Now the last record (44444) from file B matches with record from file A, these matching records will be placed in file C.
Also the file A has duplicate records within itself i.e. (22222) so they will also be placed in file C.
Now the records left in file A will be unique and will be put to file D
File D records:
12345
17890
55555
Thanks |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|