Page 1 of 1

Sort to compare 2 file and replace a filed in first file

PostPosted: Sun Feb 07, 2016 4:09 am
by senthamizh
Hi,

Need to compare 2 file ,File1(FB,LRECL=350) and file2(FB,LRECL=86).

File1:
------5-----------------------------------------------------350
AAAAA2016a1a1a1
AAAAA2016b1b1b1
AAAAA2017fhjflfgf
BBBBB2017................
BBBBB2018.............
CCCCC2019..........
CCCCC2202..............
CCCCC2020...............
 

File2:
-------5-------68--------------------86
AAAAA........O
BBBBB.........M
CCCC.........C


THE KEY FILEDS FOR BOTH FILE IS (1,5).the key in file1 needs to be compared with key in file2 i.e if key in file 1 matches with key in file2 then check 68 position for 'O' OR 'M'OR 'C'AND OVRlay file1 position 10 with 1001.

IF(WHEN(68,1,EQ,'C',OR,68,1,EQ,'O') THEN OVERLAY POSITION 10 WITH 1001 IN FILE1,
IF(WHEN(68,1,EQ,'C',OR,68,1,EQ,'M') THEN OVERLAY POSITION 10 WITH 1002 IN FILE1.
THE OUTPUT SHOULD look as below,
OUTPUT:
------5-----------------------------------------------------350
AAAAA20161001a1a1a1
AAAAA20161001b1b1b1
AAAAA20171001fhjflfgf
BBBBB20171002................
BBBBB20181002.............
CCCCC20191001..........
CCCCC22021001..............
CCCCC20201001...............
 

Is this possible by using join keys?i tried to get the matching records from file file1 but i not able to get the desired results.

Re: Sort to compare 2 file and replace a filed in first file

PostPosted: Mon Feb 08, 2016 8:04 am
by NicC
Ylou have been given clues in thge expert forum - why repost here? If you are having trouble following the clues keep on with that other topic - this one is being locked.