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



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

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

Postby senthamizh » Sun Feb 07, 2016 4:09 am

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.
senthamizh
 
Posts: 4
Joined: Tue Sep 14, 2010 2:44 pm
Has thanked: 0 time
Been thanked: 0 time

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

 

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

Postby NicC » Mon Feb 08, 2016 8:04 am

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post