Thanks to all. SIDCODE does the job.
Now I have to remember how to make AUX files. I can make CNTRL files, but multi-source fixes would eventually drive me to a separate CNTRL per source. On Mon, 21 Feb 2022 18:49:22 -0500 Phil Smith III <[email protected]> wrote: :>I think I misread the requirement. Try this version, which also handles :>block commands. :> :> :> :>/* :> PREFIXO :> K -- Kopy prefix subcommand :> O -- Overlay prefix subcommand :> OO -- Overlay block prefix subcommand :> :> Designed to be used with: :> :> COMMAND SET PREFIX SYNONYM K PREFIXO :> COMMAND SET PREFIX SYNONYM O PREFIXO :> COMMAND SET PREFIX SYNONYM OO PREFIXO :>*/ :> arg p f l rest :> if f = 'CLEAR' | p <> 'PREFIX' then exit /* Nothing to do, great */ :> parse source . . . . . pcmd . :> if rest <> '' then signal Error /* Operand, we don't do those */ :> if index('KOO', pcmd) = 0 then signal Error /* Not ours?? error */ :> 'COMMAND LOCATE :'l /* Go to the line we're handling */ :> if pcmd = 'K' then signal JustWait /* Kopying, go Wait for O */ :> 'EXTRACT /PENDING K' /* Is there a pending K?? */ :> if pending.0 = 0 then signal JustWait /* No, just wait */ :> kline = pending.1 /* Remember where Kopied line is */ :> 'COMMAND LOCATE :'pending.1 'COMMAND EXTRACT /CURLINE' /* Go */ :> kopy = curline.3 /* Get the Kopied data */ :> 'COMMAND EXTRACT /PENDING BLOCK OO :0' l /* See if OO pending */ :> select :> when pcmd = 'O' then do :> call Overlay l l /* Simple O, do that */ :> 'COMMAND LOCATE :'kline 'SET PENDING OFF' /* And clear K */ :> end :> when pending.0 = 0 then /* OO and not pending?? */ :> 'COMMAND LOCATE :'l 'COMMAND SET PENDING BLOCK OO' /* Wait */ :> otherwise /* OO and already a pending K and OO, process it */ :> call Overlay pending.1 l /* Go do the overlays */ :> 'COMMAND LOCATE :'pending.1 'SET PENDING OFF' /* Clear OO */ :> 'COMMAND LOCATE :'kline 'SET PENDING OFF' /* And clear K */ :> end :> exit :> :>/* Do overlays: Build replacement lines, overlaying only blanks */ :>Overlay: :> arg s e /* Start and end lines */ :> do n = s to e /* Spin through them */ :> 'COMMAND LOCATE :'n 'COMMAND EXTRACT /CURLINE' /* Get data */ :> r = '' /* No replacement yet */ :> do i = 1 to length(kopy) /* Only care about overlay length */ :> c = substr(curline.3, i, 1) /* Get character from line */ :> if c = '' then r = r || substr(kopy, i, 1) /* Overlay blank */ :> else r = r || c /* Don't overlay if not blank */ :> end :> if r <> '' then 'COMMAND REPLACE' r /* Replace if not null */ :> end :> return :> :>JustWait: /* Reset pending command, either K or OO */ :> 'COMMAND SET PENDING ON' pcmd :> exit :> :>Error: /* Invalid, show prefix error */ :> 'COMMAND SET PENDING ERROR' pcmd rest :> exit :> :> :> :> :>---------------------------------------------------------------------- :>For IBM-MAIN subscribe / signoff / archive access instructions, :>send email to [email protected] with the message: INFO IBM-MAIN -- Binyamin Dissen <[email protected]> http://www.dissensoftware.com Director, Dissen Software, Bar & Grill - Israel ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
