venkatprasana
New User
Joined: 21 Oct 2013 Posts: 5 Location: india
|
|
|
|
Please find the below requirement:
file 1 :
----+----1----+----2----+----3
*****************************
HEADER0000001
PHSL052014CC018AAAAAAAA
HEADER0000002
PHSL052014NC012BBBBBBBB
PHSL052014NC012AAAAAAAA
HEADER0000003
PHSL052014CC001CCCCCCCC
HEADER0000004
PHSL052014CCO50AAAAAAAA
HEADER0000005
PHSL052014NCO50CCCCCCCC
PHSL052014NCO50AAAAAAAA
File 2 :
----+----1----+----2
********************
11111~AAAAAAAA
22222~BBBBBBBB
33333~BBBBBBBB
Expected output :
----+----1----+----2----+----3----+----4
***************************** Top of Dat
HEADER0000001
PHSL052014CC018AAAAAAAA 11111
HEADER0000002
PHSL052014NC012BBBBBBBB 22222
PHSL052014NC012AAAAAAAA 11111
HEADER0000003
PHSL052014CC001CCCCCCCC 33333
HEADER0000004
PHSL052014CCO50AAAAAAAA 11111
HEADER0000005
PHSL052014NCO50CCCCCCCC 33333
PHSL052014NCO50AAAAAAAA 11111
Requirement :
The header records in the input file - 1 needs to be retained.
For the detail records in file -1 position 19,8 (AAAAAAAA) is matched with the position 7,8 in input file-2 and if they mathced the value from file-2 position 1,5 will be put in the output file by appending.
We used below joinkeys :
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(19,10,A)
JOINKEYS FILE=F2,FIELDS=(7,10,A)
JOIN UNPAIRED F1,F2
REFORMAT FIELDS=(F1:1,30,F2:01,5)
SORT FIELDS=COPY
But the input file-1 records get sorted and in the output all the header records are first printed and details records are next :
HEADER0000001
HEADER0000002
HEADER0000003
HEADER0000004
HEADER0000005
PHSL052014CCO50AAAAAAAA 11111
PHSL052014CC001CCCCCCCC 33333
PHSL052014CC018AAAAAAAA 11111
PHSL052014NCO50AAAAAAAA 11111
PHSL052014NCO50CCCCCCCC 33333
PHSL052014NC012AAAAAAAA 11111
PHSL052014NC012BBBBBBBB 22222
Is the requirement possible with joinkey is sort or do we need to use some other option. |
|