I have a Sequential File with RECFM=FB, LRECL = 1000. File has Multiple Set of Records.My Requirement is, I want to concatenate all Records where Record starting from Position 1 To 14 Having same value. All Records where Starting 14 Bytes are same, should Apprear Once & Remaning fileds should get Concatenated & Written to Ouput File, If there is a Single Occurence of Record should get written as-is. Attribute of Output File: LRECL = 2000, RECFM = FB. Below is Example:
INPUT FILE:
123|ABC|XYZ123|DBA|DB2|MF
123|ABC|XYZ123|ORA|JOB|KF
999|XYZ|XYZ123|CAT|JOB|AF
888|kBC|ABC123|MAT|MAN|NF
123|ABC|XYZ123|DIG|CAL|BC
888|kBC|ABC123|PAN|MAL|KK
OUTPUT FILE:
123|ABC|XYZ123|DBA|DB2|MF|ORA|JOB|KF|DIG|CAL|BC ----> Pipe(|) After MF,KF.3 Instance Of Record. Here
123|ABC|XYZ123| is Common in all Records.
888|kBC|ABC123|MAT|MAN|NF|PAN|MAL|KK ----> Pipe(|) After NF.2 Instance Of Record. Here
888|kBC|ABC123| is Common in all Records.
999|XYZ|XYZ123|CAT|JOB|AF ----> Single Instance of Record.
Note: While Concatenating Files Pipe Symbol (|) to Be Appended after end of each Record if we have Multiple Instance of Records. If Single Instance Then Record Should be Printed without Pipe Symbol (|).
Thanks
Kind Rgds
Vineet Anand