>>  Sometimes order matters, sometimes it doesn't...

Yes, just my naivete, I guess.  I was using CLI (because 40 years ago I had
never heard about using flags in this manner), and decided to "get fancy".
I had already used my new flag macros in another large project (full VSAM
I/O support from a REXX procedure with full conversion to and from
"flat-file" record layout using individual REXX fields similar to a COBOL
copybook layout--including supporting multiple record formats for a single
file) and that was quite successful.  There is a lot of bit setting to be
done in the ACB, RPL, and MODCB control block.

CALL RXVSAMIO "prtabl", "open", "input", "dynamic";
If rc <> 0 Then Signal ABEND_PRTABL;
CALL RXVSAMIO "prmast3", "open", "input", "dynamic";
If rc <> 0 Then Signal ABEND_PRMAST3;
CALL RXVSAMIO "prmast", "open", "input", "random";
If rc <> 0 Then Signal ABEND_PRMAST;
                           /* begin dataset retrieval */
Do While rc = 0            /* rc of -1 indicates end-of-file */
  Call RXVSAMIO 'prtabl', 'read', ' ', 'next';
  If rc <> 0 & rc <> -1 Then Signal ABEND_PRTABL;
  If rc = 0,
  &  prtabl._fld.prtb_em_table <> 'EMAIL' Then Do
    rc = -1;
  End
...etc...


Different file, but here is an example layout in REXX.

pgmstorage. = '';            /* initialize record format */
pgmstorage._key.0  = 4;      /* define the data key layout */
pgmstorage._key.1  = "SFL_APPL_ID         " "CHAR"     0   8;
pgmstorage._key.2  = "SFL_WEEK_ENDING     " "CHAR"     8   8;
pgmstorage._key.3  = "SFL_STAT_TYPE       " "CHAR"    16   3;
pgmstorage._key.4  = "SFL_RESOURCE        " "CHAR"    19   8;
pgmstorage._kln    = statsfl._kmx;

pgmstorage._fld.0  = 28;     /* define the record layout */
pgmstorage._fld.1  = "SFL_APPL_ID         " "CHAR"     0   8;
pgmstorage._fld.2  = "SFL_WEEK_ENDING     " "CHAR"     8   8;
pgmstorage._fld.3  = "SFL_STAT_TYPE       " "CHAR"    16   3;
pgmstorage._fld.4  = "SFL_RESOURCE        " "CHAR"    19   8;
pgmstorage._fld.5  = "SFL_B_NUCLEUS       " "PACK"    27   5  0;
pgmstorage._fld.6  = "SFL_B_PROGRAMS      " "PACK"    32   5  0;
pgmstorage._fld.7  = "SFL_B_RESIDENT      " "PACK"    37   5  0;
pgmstorage._fld.8  = "SFL_B_RO_NUCLEUS    " "PACK"    42   5  0;
pgmstorage._fld.9  = "SFL_B_RO_PROGRAMS   " "PACK"    47   5  0;
pgmstorage._fld.10 = "SFL_B_RO_RESIDENT   " "PACK"    52   5  0;
pgmstorage._fld.11 = "SFL_B_C_NOTINUSE    " "PACK"    57   5  0;
pgmstorage._fld.12 = "SFL_B_C_NOTINUSEP   " "PACK"    62   3  2;
pgmstorage._fld.13 = "SFL_B_S_NOTINUSE    " "PACK"    65   5  0;
pgmstorage._fld.14 = "SFL_B_S_NOTINUSEP   " "PACK"    70   3  2;
pgmstorage._fld.15 = "SFL_B_R_NOTINUSE    " "PACK"    73   5  0;
pgmstorage._fld.16 = "SFL_B_R_NOTINUSEP   " "PACK"    78   3  2;
pgmstorage._fld.17 = "SFL_A_NUCLEUS       " "PACK"    81   5  0;
pgmstorage._fld.18 = "SFL_A_PROGRAMS      " "PACK"    86   5  0;
pgmstorage._fld.19 = "SFL_A_RESIDENT      " "PACK"    91   5  0;
pgmstorage._fld.20 = "SFL_A_RO_NUCLEUS    " "PACK"    96   5  0;
pgmstorage._fld.21 = "SFL_A_RO_PROGRAMS   " "PACK"   101   5  0;
pgmstorage._fld.22 = "SFL_A_RO_RESIDENT   " "PACK"   106   5  0;
pgmstorage._fld.23 = "SFL_A_C_NOTINUSE    " "PACK"   111   5  0;
pgmstorage._fld.24 = "SFL_A_C_NOTINUSEP   " "PACK"   116   3  2;
pgmstorage._fld.25 = "SFL_A_S_NOTINUSE    " "PACK"   119   5  0;
pgmstorage._fld.26 = "SFL_A_S_NOTINUSEP   " "PACK"   124   3  2;
pgmstorage._fld.27 = "SFL_A_R_NOTINUSE    " "PACK"   127   5  0;
pgmstorage._fld.28 = "SFL_A_R_NOTINUSEP   " "PACK"   132   3  2;
n = pgmstorage._fld.0;
pgmstorage_reclen  = Word(pgmstorage._fld.n,3),
                   + Word(pgmstorage._fld.n,4);
pgmstorage._rln    = pgmstorage_reclen;

pgmstorage._key.SFL_APPL_ID     = applid;
pgmstorage._key.SFL_WEEK_ENDING = rdate;
pgmstorage._key.SFL_STAT_TYPE   = 'PST';
pgmstorage._key.SFL_RESOURCE    = ' ';
CALL RXVSAMIO "statsfl", "READ", "pgmstorage", "KEY", "EQUAL";
Select
When rc = 16,
& statsfl._rc = 8,         /* not found? */
& statsfl._ec = 16 Then Do
...snip...
    CALL RXVSAMIO "statsfl", "WRITE", "pgmstorage";
  End
When rc = 0 Then  Do
...snip...
    CALL RXVSAMIO "statsfl", "UPDATE", "pgmstorage";
  End
Otherwise
  Signal ABEND_STATSFLR;
End
If rc <> 0 Then Signal ABEND_STATSFLR;
...snip...
ABEND_STATSFLR:
  If rc <> 16 Then Do
    Say _pgm": Call error: rc="rc", result="result",",
                          "ddname="statsfl._ddn",",
                          "request="statsfl._lfn",",
                          "macro="statsfl._lfm;
  End
  Else Do
    Say _pgm":" statsfl._lfn "error --" statsfl._ddn "--",
               "rc="statsfl._rc", ec="statsfl._ec"," statsfl._lfm;
  End
  Say " ";
  Call RXDMPVAR;             /* dump all variable names  */
Exit 8;

Thanks,
Dave Clark


On Mon, Feb 16, 2026 at 4:14 PM Mark Boonie <[email protected]> wrote:

>
>
>

Reply via email to