Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Kolusu showed you the output from the given input, and it has your exact example.
You are saying, when there is one PAYM you want the record in front, the PAYM, and the record after. When there are two PAYM you want the record in front of the first, the two PAYM and the one after the second?
Can there be more than two PAYM, so we again try to get the whole thing at once?
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Frank Yaeger wrote:
So for the one, two, three, etc PAYM records, you want the record before the first PAYM record and the record after the last PAYM record.
scorp_rahul23 wrote:
I want to have all records with PAYM whether they are 2 or 3. They will always be continuos.
And apart from that I need a records which is just before first PAYM record and just after last paym record.
I was just going through some of the older topics here, the TS said that he needs the record following the last 'PAYM' record also, pretty much same as what Frank had asked earlier. Do we have a solution yet for this?
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Hi Bill,
I just went through the topic you gave, i doubt if the same can be applied here in this case, anyways that was a good one though!. Thanks Bill
btw for this one, I just worked out one method, but can't post it here due to compatibility issues. The topic is old, but I got surprised by the number of views!
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Arun Raj wrote:
Hi Bill,
I just went through the topic you gave, i doubt if the same can be applied here in this case, anyways that was a good one though!. Thanks Bill
btw for this one, I just worked out one method, but can't post it here due to compatibility issues. The topic is old, but I got surprised by the number of views!
Arun,
Here is a version which would get the desired results.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
scorp_rahul23 wrote:
I want to have all records with PAYM whether they are 2 or 3. They will always be continuos.
And apart from that I need a records which is just before first PAYM record and just after last paym record.
Hi Kolusu,
Looks like the TS needs consecutive 'PAYM' records in output even if there are more than 2. I guess it would need some tweaking in order to handle multple 'PAYM's.
Gerry's version can handle this, but at the expense of multiple passes. I tried out a version which I believe would give this in single pass. Below is the input used and expected output. Suggestions are welcome
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
The thing about the actual solution is the record-length that the TS has, 32,000+. Since an entire record from before (and after) the current one is needed, that lets out the JOINKEYS and PUSH solutions for the actual question.
I think I'll try to "tidy" the topic, split it into the TS's two different questions and give it a less "interesting" subject :-)
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
With records up to half the maximum length, Kolusu's JOINKEYS gets the current and preceding records "side-by-side" on the REFORMAT record, so selection of required records is "easy" (first part of REFORMAT if "record" and "paym" or "paym" and "paym", second part of REFORMAT is "paym" and "record").
Here is an alternative, only possible if records are <= 1/3 of the maximum length.
I don't know if the multiple PUSHs outperform the JOINKEYS or not, but somewhere I have a better way to test for odd/even using bit masks (a suggestion of Frank Yaeger's that I came across).
The topic linked-to here, also has a JOINKEYS example.
For the actual question (with the big records) the inclusion of the END works well, Arun. I thing the eight digits for that sequence number are "excessive"... and I've never liked GT space when NE space is fine :-)
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Bill Woodger wrote:
With records up to half the maximum length, Kolusu's JOINKEYS gets the current and preceding records "side-by-side" on the REFORMAT record, so selection of required records is "easy"
Hi Bill,
I could not see a JOINKEYS solution by Kolusu here. Moreover the output from his job would be different from mine/Gerry's.