A file has 3 Set of batches. Each batch can be identified by Header and Trailer. The records between Header and trailer can be dynamic.
So, I want to split this file into 3 files based on Header and Trailer.
In the below example, Header& Trailer are identified by first two characters.
Header Starts with 00
Trailer Starts with 80
Data records Starts with 10
Example:
Input file:
00ABCDEFG
10AGAG
10BCDHE
10DHHE
80TRL
00RTAETG
10GAG
10ADGAGD
80GAGAG
00RTAETG
10GAG
10ADGAGD
10GAGAG
10GAGG
80GAGAG
Expected Output files:
Output file1:
00ABCDEFG
10AGAG
10BCDHE
10DHHE
80TRL
Output file2:
00RTAETG
10GAG
10ADGAGD
80GAGAG
Output file3:
00RTAETG
10GAG
10ADGAGD
10GAGAG
10GAGG
80GAGAG
The record format is FB and Length is 80 for all the files.
Please help me on getting this output using any tool like ICETOOL/SORT/FILEAID.
Please let me know if any information to be clear.
Thank you!
Coded