That is next client_ty of that client has to be updated ( in this case 520) and 4th field should be SP ( means spaces) and for non spaces ( NP).
In case we have spaces and there is only one record for that client, we have to update HMO and 4th field as SP
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
Apart from the fact that you did not help the helpers by using the code tags, and you say NP should be inserted into the 4th field when the third field is not blank but you show NS, and that you have a dataset not a file and you did not specify LRECL or RECFM (either, or both, of which could affect the solution), and you say that the next client_ty has to be updated when I suspect that that should say that if the client_ty is blank it should be updated with the client_ty of the next client record. But what if there is no 'next' client_ty?
Nic- you say NP should be inserted into the 4th field when the third field is not blank but you show NS
Kiran- Yes you are correct it should be NS
Nic- that you have a dataset not a file and you did not specify LRECL or RECFM (either, or both, of which could affect the solution)
Kiran- I have mentioned in the first message ( cleint filed is 8 char, date is 10 char, client_ty is 3 charaters and file is sorted on client, date ( asec)), in addition to that, it is 80 length FB PS file.
Nic- you say that the next client_ty has to be updated when I suspect that that should say that if the client_ty is blank it should be updated with the client_ty of the next client record. But what if there is no 'next' client_ty?
Kiran- I have mentioned in my first message In case we have spaces and there is only one record for that client, we have to update HMO and 4th field as SP
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Full knowledge of the data is important. Consecutive blanks would be a problem, as well as blanks in the final record of a key.
Still, assuming those don't exist, WHEN=GROUP for the blank, with PUSH of the entire record, RECORDS=2, OUTFIL to omit the blanks, and a BUILD with the slash-operator (get the basic data, (81,80,/,1,80), a little breakdown to copy the required bytes and the literal) subordinate to a WHEN= confirming that the keys are equal should be about there.
So, can there be consecutive blanks, and if so, is there a maximum? And what would you want done? If the final record of a group is blank, what would you want done?
I can't see that the JOINKEYS needs the RESTART, just a plain sequence should do. A test for equal keys could replace the primary key and just use the sequence for the match.