Is it possible to split the file into two files using SORT
The first file will start from Header, data and should end copying after it gets the encrypted header again.
Likewise, it should copy the entire content from the second header encountered till end of file
EDIT: Include the correct BUILD on the OUTFIL with SAVE.
The other thing is the VB aspect. They all seem to be 16. So are they FB with an RDW, or truly VB? We should ask.
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
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
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.
********************************* Top of Data **********************************
89464D43'
******************************** Bottom of Data ********************************
Thanks Bill - The second header would not split, but its position might get alter by a column or two.
On changing to BEGIN=(6,4,CH,EQ,X'89464D43') I got all data in File 1 and File 2 gets empty...
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
You can use OR in BEGIN and you can use SS in BEGIN. The SS is clearer, the OR can be more efficient if you have loads of records.
For the OR, use same test, different start-positions (like 7, 8, 9, however many you want).
For the SS, specify start-position of 6, and length being the maximum number of bytes before the key can be encountered (like 7 with the same example for the OR).
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
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.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
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.