On Mon, 8 Jun 2026 at 15:27, Paul Gilmartin <
[email protected]> wrote:

> On Sun, 7 Jun 2026 21:54:42 +0000, Robert Prins wrote:
>
> >I need to merge several, in casu, three,121 byte FB records into a new
> >longer record, but the first of the three is pseudo-variable length, it
> >contains a field in UTF8 format followed by a 0x00 byte, and the data up
> to
> >this 0x00 byte needs to be used as the first part of the newly spliced
> >record.
>     ...
> Are all your data in all your data sets UTF8 or is there a mixture of
> CCSIDs?
>

The data comes from a white box via FTP (or IND$FILE) and as such the
original valid UTF-8 is translated using whatever translate table is used
by either, but the program uses data embedded in the original white box
file to actually build the first FB(121) record, which looks like

 | B    | Brussel (Metro Delta)                         |
 | D    | Raststätte Gütersloh Süd                      |
 | F    | Calais                                        |
 | GB   | Brentwood M25 (W)                             |
 | L    | Aire de Capellen Nord                         |
 | LT   | A13 exit Palanga (K)                          |
 | LV   | exit LiepÄ ja (Bus Dienvida robeža)            |
 | NL   | VZP De Kroon                                  |
 | PL   | MOP Sosna                                     |

Where I've used a | to replace the 0x00. The other two FB(121) records that
need to be spliced to the above are additional parts of a table, and those
don't need special treatment, I just need to truncate the first of the
three at the 0x00 (or whatever sentinel value I decide to use, but given
that 0x00 doesn't appear in the input data that seems a sensible value)

I am not interested in anything DFSORT exit, POSIX pipe, or whatever, if it
cannot be done by sort, I'll just have to write a little follow-up program,
which I should have done when the first z/OS output file with an LRECL >
121 was created. And no, I'm not going to explain why I'm sticking with
that LRECL, the program I'm working with dates back to 1994, and
introducing output files with a larger LRECL is ***NOT*** an option.
Period. Full stop. End-of-story!

So it's either DFSORT or a follow-up program, which would obviously also
allow me to post-process the other three now DFSORT processed files with
it, removing, for one of them, the rather complicated:

* Merge the LW file
* These sort commands can handle both the old, it's left unchanged, as
* well as the new, records are merged, LW output file.
**********************************************************************
  OPTION COPY
* --------------------------------------------------------------------
* Put '01200' in columns 364-368

  INREC IFTHEN=(WHEN=INIT,OVERLAY=(364:+1200,ZD,LENGTH=5)),

* Whatever                       0120
* --------------------------------------------------------------------
* Test column 9 for '+' or '|' OR column 41 for '+' or '|'
* - copy 365 ('1') to 364
* - add seqno to 367, for two records

    IFTHEN=(WHEN=GROUP,BEGIN=(9,1,SS,EQ,C'+|',OR,41,1,SS,EQ,C'+|'),
      PUSH=(364:365,1,367:SEQ=1),RECORDS=2),

* T-1 / P-1                      1121
* T-1 / P-2                      1122
* --------------------------------------------------------------------
* Test column 116 for '+' or '|'
* - copy 366 ('2') to 364
* - add seqno to 367, for three records

    IFTHEN=(WHEN=GROUP,BEGIN=(116,1,SS,EQ,C'+|'),
      PUSH=(364:366,1,367:SEQ=1),RECORDS=3),

* T-2 / P-1                      2121
* T-2 / P-2                      2122
* T-2 / P-3                      2123
* --------------------------------------------------------------------
* Test column column 367 for '1'
* - add columns 1-121 at column 122

    IFTHEN=(WHEN=GROUP,BEGIN=(367,1,ZD,EQ,+1),
      PUSH=(122:1,121)),

* Whatever                       0120
* T-1 / P-1 T-1 / P-1            1121
* T-1 / P-2 T-1 / P-1            1122
* Whatever  T-1 / P-1            0120
* T-2 / P-1 T-2 / P-1            2121
* T-2 / P-2 T-2 / P-1            2122
* T-2 / P-3 T-2 / P-1            2123
* Whatever  T-2 / P-1            0120
* --------------------------------------------------------------------
* Test column column 367 for '2'
* - add columns 1-121 at column 243

    IFTHEN=(WHEN=GROUP,BEGIN=(367,1,ZD,EQ,+2),
      PUSH=(243:1,121)),

* Whatever                       0120  x 0...: 1,121
* T-1 / P-1 T-1 / P-1            1121
* T-1 / P-2 T-1 / P-1 T-1 / P-2  1122
* t-1 / P-1 t-1 / P-1 T-1 / P-2  1121  x 1..1: 122,1+1,121
* t-1 / P-2 t-1 / P-1 t-1 / P-1  1122
* Whatever  t-1 / P-1 t-1 / P-1  0120  x 0...: 1,121
* T-2 / P-1 T-2 / P-1 t-1 / P-1  2121
* T-2 / P-2 T-2 / P-1 T-2 / P-2  2122
* T-2 / P-3 T-2 / P-1 T-2 / P-2  2123  x 2..3: 122,121+243,121+1,121
* --------------------------------------------------------------------
* Test column 114 for '+' or '|' (Old data, hack)
* - Set flags to '0***0'

    IFTHEN=(WHEN=GROUP,BEGIN=(114,1,SS,EQ,C'+|'),
      PUSH=(364:368,1),RECORDS=1)

* Old data                       0***0
* --------------------------------------------------------------------

  OUTFIL FNAMES=(SORTOUT),
    INCLUDE=((364,1,ZD,EQ,+0),OR,
             (364,1,ZD,EQ,+1,AND,367,1,ZD,EQ,+2),OR,
             (364,1,ZD,EQ,+2,AND,367,1,ZD,EQ,+3)),

    FTOV,VLTRIM=C' ',

    IFTHEN=(WHEN=(364,1,ZD,EQ,+0),BUILD=(1,121)),

    IFTHEN=(WHEN=(364,1,ZD,EQ,+1,AND,367,1,ZD,EQ,+2),
      BUILD=(122,121,1,121)),

    IFTHEN=(WHEN=(364,1,ZD,EQ,+2,AND,367,1,ZD,EQ,+3),
      BUILD=(122,121,243,121,1,121))
  END

Robert
-- 
Robert AH Prins
robert(a)prino(d)org
The hitchhiking grandfather <https://prino.neocities.org/index.html>
Some REXX code for use on z/OS
<https://prino.neocities.org/zOS/zOS-Tools.html>

Do any of your pseudo-variable length records span FB records?
>
> Is this a job for a SORTIN exit?
>
> Can DFSORT take all its input from an exit with no actual data set?
>
> Can DFSORT use an (allocated) POSIX pipe as SORtIN
>
> --
> gil
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to