View previous topic :: View next topic
Author
Message
sanjayis01 Warnings : 1 New User Joined: 13 Jun 2007Posts: 55 Location: banaglore
Input File1:
100 00000000000000000000000000000000000000000000000000000000000000000000000000000
200 00000000000000000000000000000000000000000000000000000000000000000000000000000
300 33333333333333333333300330000000000000000000000000000000000000000000000000000
400 44444444444444444444444440000000000000000000000000000000000000000000000000000
600 00000000000000000000000000000000000000000000000000000000000000000000000000000
Input File 2:
100 00000000000000000KK0000000000000000000000000000000000000000000000000000000000
200 00000000000000000KK0000000000000000000000000000000000000000000000000000000000
300 00000000000000000KK0000000000000000000000000000000000000000000000000000000000
400 00000000000000000KK0000000000000000000000000000000000000000000000000000000000
Hi O.P File
10000000000000000000KK0000000000000000000000000000000000000000000000000000000000
20000000000000000000KK0000000000000000000000000000000000000000000000000000000000
30033333333333333333KK3300330000000000000000000000000000000000000000000000000000
40044444444444444444KK4444440000000000000000000000000000000000000000000000000000
60000000000000000000 000000000000000000000000000000000
Code:
//STEP05 EXEC PGM=SYNCSORT
//SORTJNF1 DD DSN=File1,DISP=SHR
//SORTJNF2 DD DSN=FILE2,DISP=SHR
//SORTOUT DD DSN=OUTPUTFILE,
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(100,100),RLSE)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(1,3,A)
JOINKEYS FILES=F2,FIELDS=(1,3,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F2:21,2,F1:1,20,F1:23,78)
Issue:
File 1 having 5 records.. FIle 2 having 4 records
In FILE 1 and FILE 2 1st 3 character are key fields (bold letters) based on those key fields if the key fields matches in both the files override the 21st postion from the 1st file and replace it by KK( Ucan see in the o/p file ) but for the non match record should be remain same .. if you look at the p/p file u can identify spaces instead of "00"
please let me know i can retain the non matching record without alterring
Please let me know if you need more details
its syncsort product
Back to top
Manuneedhi K Active User Joined: 07 May 2008Posts: 115 Location: Chennai
Can you try with the below code. I just tried and this seems to be working.
Code:
OPTION COPY
JOINKEYS FILES=F1,FIELDS=(1,3,A)
JOINKEYS FILES=F2,FIELDS=(1,3,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,80,F2:1,80)
OUTFIL FNAMES=MYOUT
OUTREC IFTHEN=(WHEN=(101,2,CH,EQ,C' '),
BUILD=(1,20,21,2,C'00',23,58)),
IFTHEN=(WHEN=(NONE),
BUILD=(1,20,101,2,23,58))
Back to top
sanjayis01 Warnings : 1 New User Joined: 13 Jun 2007Posts: 55 Location: banaglore
hi Manuneedhi
Thats fine when you know what value you will get..
What if you dont know what value you will get in that pistion
So how we can resolve this?
Back to top
Manuneedhi K Active User Joined: 07 May 2008Posts: 115 Location: Chennai
Back to top
Please enable JavaScript!