On 3/21/2023 6:43 PM, Rob van der Heij wrote:
> After all your solutions, I still don't understand what you were trying to
> do.

Partly because they're all solutions to different things.  I have a bad
habit of editing out too much of what I think is repetitive, leaving
things confusingly out of context.

Here's my original statement:

> I had records to split at column 80 and I knew they weren't longer than
> 160, so DEBLOCK FIXED 80 did the job.  What if the right part might be
> longer than the left? 

I could use CHOP 80 but on the alternate I'd be potentially left with
null records I don't want.  I'd have to add in something to get rid of
them.  But SPLIT will do it by splitting just once after any one character:

  split 79 after 00-ff 1

If the length I want to split at is in a variable, having to subtract 1
is an annoyance.  Using a negative length BEFORE instead of a positive
length AFTER avoids that.  This is exactly equivalent:

  split -80 before 00-ff 1

Then you asked:

> So you want to split 80 from the right?
> Is that   .. | x: if chop -80 | x: | ...   ?
If I did want to split 80 from the right, yes, that does it, but again
with those pesky nulls if the input records are short.  Split doesn't
have a similar construction, but it called to mind a trick for a totally
different purpose with CHOP.

If I want a null record *before* each input record, I can use CHOP 0 to
create it.  If I want a null record *after* each input record, that's
trickier, because "-0 is not a snumber" so I can't CHOP -0, and * is not
a number so CHOP * gives me the wrong thing.  What does the trick is:

  chop not 00-ff

The target is never found, and the record is always chopped at the end.

So I thought I might be able to combine that with the very first trick
above, and SPLIT at -80 by:

  split 80 before not 00-ff

But no, because the target is never found, SPLIT never splits anything.
Similarly, if I try:

  chop 80 before not 00-ff

the target is never found, and CHOP can't find a position before it, so
again it just chops at the end of the record.  (That's not a problem,
since CHOP -80 does that job.)

¬R

Reply via email to