Joined: 02 Jan 2009 Posts: 115 Location: Hyderabad
Hello,
I have the below vb file
Code:
01101BBBBBCCCCCCCCCCEEEEEEEEEEEEEEEEEEEE
First 5 bytes are flags and next set is data related to the flags. If a flag is set to 0, there will not be any detailed information. Say Flags A thru E. Detailed info length of flags A thru E are 3,5,10,15,20 bytes respectively.
Now, I have an assembler program to expand this input file based on flags and filling the information with spaces when flag is set to 0.
Output would be
Code:
01101 BBBBBCCCCCCCCCC EEEEEEEEEEEEEEEEEEEE
Can this be done using DFSORT?
I am thinking this way - inrec if 1st byte is 0, overlay 6:3x with right shift (I had findrep right shift in mind). And so on... with hit=next and other conditions. Later I realized there is nothing like right shift for overlay.
Even if we have a way to right shift the data while inserting, does the next ifthen take the latest inrec updated by previous ifthen?
I could have gone for different combinations of these flags and writing inrec overlay. But the flags are more in number (15 flags).
Please advise if there is a way to do. I searched the forum for key words "insert shift", "right shift" etc. But only found right shift for sqz and findrep.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
You missed finding JFY.
However, JFY won't do what you want.
If you have 15 flags, you'll need 15 IFTHEN=(WHEN=(logicalexpression) each (except the last) with HIT=NEXT.
You won't be able to use OVERLAY, because it works directly on the existing current record. You will trash your data in no time. BUILD always creates a new current message, so you'd need BUILD.
Doing up to 15 BUILDs has some overhead per record has some overhead. If you have a lot of data to do this to, you may want to knock together a quick E15 or E35 sort exit (examples in the manual) as well, and compare the two.
Joined: 02 Jan 2009 Posts: 115 Location: Hyderabad
Thanks for the idea Bill. I have millions of records to be processed. So do you think 15 builds is not good idea? That is why I was looking for a non existing syntax overlay with right shift
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
With OVERLAY you have to watch out for destroying your data. If you tried OVERLAY=(1,5,6:3X,6,50) you'd junk the data (give it a try with some test data).
However, use JFY with SHIFT=RIGHT for the data other than the first 5/15. Now your data is in a fixed position for inserting the blanks working from right-to-left.
You must, as in must, relocate the data first, and then do the blanks. If you do the blanks fist, you'll again destroy data.
That should improve things over the BUILDs you have already. The BUILDs are still useful, as running one on your test-data confirms that the other works (or doesn't).