Page 1 of 1

Update 1 record of multiple with OVERLAY

PostPosted: Fri Feb 07, 2020 7:44 pm
by golemis
Hi team,

I have a dataset (VB(90)) in which the records are like:

    Y AAA BBB
    N CCC DDD
    N EEE FFF
    N GGG HHH

I need to update the first record with a "N" in first collumn, with a "Y" leaving all other record intact

Tried :

 OPTION COPY,STOPAFT=1,VLSHRT
  RECORD TYPE=V,LENGTH=90
  INCLUDE COND=(5,1,SS,EQ,C'N')
  OUTFIL OVERLAY=(5:5,1,CHANGE=(1,C'N',C'Y'))


But this gives me as output only the updated record, in which case is the second one (correct). How can I get the whole file updated ?

Thanks GG

Re: Update 1 record of multiple with OVERLAY

PostPosted: Fri Feb 07, 2020 8:01 pm
by golemis
Tried 3 different sort steps, one for all Y, then the overlayed, and then the remaining N's, and the idea is to concatenate them at the end. However for the remaining N's, there is no STARTAFT=2 in the OPTION parameter. how can I skip the updated (overlayed) record, so I will not have it twice in the output ?

Re: Update 1 record of multiple with OVERLAY

PostPosted: Fri Feb 07, 2020 9:35 pm
by golemis
I think I've done it:
1st sort
 OPTION COPY,VLSHRT
  RECORD TYPE=V,LENGTH=90
  OUTFIL FNAMES=SORTOUT,INCLUDE=(5,1,SS,EQ,C'Y')
  OUTFIL FNAMES=SORTO2,INCLUDE=(5,1,SS,NE,C'Y')

2nd have the SORTO2 as SORTIN:
 OPTION COPY,STOPAFT=1,VLSHRT
  RECORD TYPE=V,LENGTH=90
  INCLUDE COND=(5,1,SS,EQ,C'N')
  OUTFIL OVERLAY=(5:5,1,CHANGE=(1,C'N',C'Y'))

and 3rd again the SORTO2 of 1st step as SORTIN
 OPTION COPY,SKIPREC=1,VLSHRT
  RECORD TYPE=V,LENGTH=90
  INCLUDE COND=(5,1,SS,EQ,C'N')


Seems to be working as expected. I would appreciate any comments on things I might have overseen, or missed.

Thanks GG