My requirement is, if the VersionNbr in HDRRec is 1, then all detail records (including Header and Trailer) under that Header Record needs to be extracted and written into a new file. So in this case the output will be
The Header record is identified by the keyword HDR which starts at position 1 and trailer record is identified by the keyword TRL which starts at position 1. The version number will be starting at position 41 and will be 8 bytes in length.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Indrajit_57,
If you pad the group-id indicator at the end of a VB file you will ruin the very concept of VB files and make them all fixed block.
I assumed that your HDR value starts in pos 5 ( first 4 byte of RDW) and the number 1 starts in position 22. In order to retain the original lengths of the VB file, we pad a 1 byte space right after the RDW and use that for pushing the Group-id indicator. since we padded the space before the actual record , now your positions are incremented by 1. So the HDR is now at position 6 and the number is at position 23. While writing out we remove that field, there by retaining the original VB file lengths for each record.