Thanks Bill and Magesh,
The VB File here is required for processing so we need to keep the VB format.
For the solution, I am taking first 4 bytes of header into consideration as
for the first record in file the header gets accommodated in the first line,
but the header may get split when appearing next time as I showed in the file snippet previously.
The hex value for first 4 bytes are X'89464D43'
On running the code below, the entire data is getting copied to F2,
and F1 is coming as Blank.
If you could please suggest where am I going wrong
This value, X'89464D43', does not occur on any record in your data at position five.
Wow. I can't understand ho we didn't pick up that the second occurrence could appear anywhere. You didn't mention it after all, and I for one didn't look at the scrumble-jumble data to verify what you did say.
I have to agree with enrico. It's a mugs' game. Can't even see the header indicator, so can't evaluate chance of false hits.
How do you verify the data hasn't been "edited". You don't need to, because you know it has.
The split should be before the encryption. You can (perhaps, subject to false-hits) do it this way in the short term (during testing to get things going, for instance) but it should not be a medium-/long-term/permanent task.
If you're feeling twitchy about false-hits (I would) then I'd suggest three OUTFILs, SAVE on one (always expected to be "empty") and select for 1 on the first and 2 on the second.
Use NULLOFL on the OUTFIL for 2 (one RC=) and the OUTFIL with SAVE (a different RC=). Then you can deal with all possible combinatons (if you get the RC= in the correct order).
Bill / Enrico - Thanks for your comments, Although am able to split using 'OR' on BEGIN and checking for various combinations, I agree chance of false hit is high.
Bill - Honestly I did not get the suggestion but I am going to refer some Manuals and try to work that out fo sure, I will post if am able to pen it down.
NULLOFL on OUTFIL allows the output of a (limited values) Return Code when the OUTFIL dataset is empty.
With NULLOFL on three OUTFILs you can for instance get an RC=4 for when your SAVE OUTFIL is empty, which it always should be, and RC=12 for when your second OUTFIL is empty (which it should never be). When your first OUTFIL is empty, your second must be empty as well, so you'd still get RC=12.
The highest RC= will be output, so the RC=4 is the least significant one.