× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I noticed Leif hard-coded the record length into his copy-
member program.  So here's a more general-purpose
version that can copy members of ANY record length.
The trick is to set on the final two bits in the output UFCB
flags field to denote "caller supplies pointers to I/O buffers".
After the input file is opened, copy the input buffer pointer
from the input UFCB to the output buffer pointer in the output
UFCB, and then open the output file.  This maps the output
directly onto the input.  No need to consider record length.

DCL SPCPTR ?P1       PARM;
DCL SPCPTR ?P2       PARM;
DCL SPCPTR ?P3       PARM;
DCL OL     MAIN      (?P1, ?P2, ?P3) PARM EXT MIN(3);
DCL DD     FROMFILE  BAS(?P1) CHAR(10);
DCL DD     FROMMBR   BAS(?P2) CHAR(10);
DCL DD     TOMBR     BAS(?P3) CHAR(10);
/*--------------------------------------------------------*/
DCL SPCPTR ?SEPT     BASPCO;
DCL SYSPTR ?OS(5500) BAS(?SEPT);
DCL DD     DNLOFF    BAS(*) POS(17) BIN(4);
DCL MSPPTR ?DNL;
DCL DD     EPT(256)  BAS(?DNL) POS(5) CHAR(130);
DCL DD     GET(256)  DEF(EPT) POS(21) BIN(2) AEO(130);
DCL DD     PUT(256)  DEF(EPT) POS(29) BIN(2) AEO(130);
/*--------------------------------------------------------*/
DCL SPCPTR ?ODP1     AUTO;
DCL SPCPTR ?INBUFF1  AUTO;
DCL DD     *         AUTO CHAR(96);
DCL DD     FILE1     AUTO CHAR(10);
DCL DD     *         AUTO BIN(2) INIT(-75);
DCL DD     *         AUTO CHAR(10) INIT("*LIBL");
DCL DD     *         AUTO BIN(2) INIT(73);
DCL DD     MBR1      AUTO CHAR(10);
DCL DD     *         AUTO CHAR(10);
DCL DD     INDEX1    AUTO BIN(2);
DCL DD     FLAGS1    AUTO CHAR(2) INIT(X"8020");
DCL DD     *         AUTO CHAR(4) INIT("0100");
DCL DD     *         AUTO CHAR(28);
DCL DD     FINAL1    AUTO BIN(2) INIT(32767);
/*--------------------------------------------------------*/
DCL SPCPTR ?ODP2     AUTO;
DCL SPCPTR *         AUTO;
DCL SPCPTR ?OUTBUFF2 AUTO;
DCL DD     *         AUTO CHAR(80);
DCL DD     FILE2     AUTO CHAR(10);
DCL DD     *         AUTO BIN(2) INIT(-75);
DCL DD     *         AUTO CHAR(10) INIT("*LIBL");
DCL DD     *         AUTO BIN(2) INIT(73);
DCL DD     MBR2      AUTO CHAR(10);
DCL DD     *         AUTO CHAR(10);
DCL DD     INDEX2    AUTO BIN(2);
DCL DD     FLAGS2    AUTO CHAR(2) INIT(X"8013");
DCL DD     *         AUTO CHAR(4) INIT("0100");
DCL DD     *         AUTO CHAR(28);
DCL DD     FINAL2    AUTO BIN(2) INIT(32767);
/*--------------------------------------------------------*/
DCL DD     TYPE1     AUTO CHAR(4) INIT(X"03000001");
DCL DD     TYPE2     AUTO CHAR(4) INIT(X"10000005");
DCL DD     NULL      AUTO CHAR(1) INIT(X"FF");
DCL SPCPTR ?UFCB1    AUTO INIT(?ODP1);
DCL SPCPTR ?UFCB2    AUTO INIT(?ODP2);
DCL SPCPTR ?TYPE1    AUTO INIT(TYPE1);
DCL SPCPTR ?TYPE2    AUTO INIT(TYPE2);
DCL SPCPTR ?NULL     AUTO INIT(NULL);
DCL OL     OCLIST1   (?UFCB1) ARG;
DCL OL     OCLIST2   (?UFCB2) ARG;
DCL OL     IOLIST1   (?UFCB1, ?TYPE1, ?NULL) ARG;
DCL OL     IOLIST2   (?UFCB2, ?TYPE2, ?NULL) ARG;
DCL DD     READ      AUTO BIN(4);
DCL DD     WRITE     AUTO BIN(4);
DCL EXCM   CPF5001   EXCID(H"5001") BP(EXIT) CV("CPF") IMD;
/*--------------------------------------------------------*/
      ENTRY      * (MAIN) EXT;
      CPYBLA     FILE1, FROMFILE;
      CPYBLA     MBR1, FROMMBR;
      CALLX      ?OS(12), OCLIST1, *;
      ADDSPP     ?DNL, ?ODP1, ?ODP1 -> DNLOFF;
      CPYNV      READ, GET(INDEX1);
      CPYBLA     FILE2, FROMFILE;
      CPYBLA     MBR2, TOMBR;
      CPYBWP     ?OUTBUFF2, ?INBUFF1;    /* map OUT to IN */
      CALLX      ?OS(12), OCLIST2, *;
      ADDSPP     ?DNL, ?ODP2, ?ODP2 -> DNLOFF;
      CPYNV      WRITE, PUT(INDEX2);
LOOP: CALLX      ?OS(READ), IOLIST1, *;
      CALLX      ?OS(WRITE), IOLIST2, *;
      B          LOOP;
EXIT: CALLX      ?OS(11), OCLIST1, *;
      CALLX      ?OS(11), OCLIST2, *;
      PEND;


+---
| This is the MI Programmers Mailing List!
| To submit a new message, send your mail to MI400@midrange.com.
| To subscribe to this list send email to MI400-SUB@midrange.com.
| To unsubscribe from this list send email to MI400-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: dr2@cssas400.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.