From: <Bobby.Hicks@ccc-michigan.com>
> That would be great Leif.  Thanks!!

to get you started, below is a snippet. Basically you find a job in the
work control block tables, then walk its ODP:


DCL SPCPTR .PARM1 PARM;
DCL DD      PARM1 CHAR(8) BAS(.PARM1);
    DCL DD LAST-ENTRY-NBR BIN(4) DEF(PARM1) POS(1);
    DCL DD MAX-ENTRY-NBR  BIN(4) DEF(PARM1) POS(5); /* LIMIT 200,000 */

DCL SPCPTR .PARM2 PARM;
DCL DD      PARM2 CHAR(16000000) BAS(.PARM2);
    DCL DD ENTRIES(200000) CHAR(80) DEF(PARM2) POS(1);

DCL OL PARMS (.PARM1, .PARM2) PARM EXT MIN(2);

DCL DD THE-ENTRY CHAR(80) BDRY(16);
    DCL DD ENTRY-DEVICE         CHAR(10) DEF(THE-ENTRY) POS( 1);
    DCL DD ENTRY-USER           CHAR(10) DEF(THE-ENTRY) POS(11);
    DCL DD ENTRY-JOB-NUMBER      CHAR(6) DEF(THE-ENTRY) POS(21);
    DCL DD ENTRY-JOB-TYPE        CHAR(1) DEF(THE-ENTRY) POS(27);
    DCL DD ENTRY-LIBRARY        CHAR(10) DEF(THE-ENTRY) POS(28);
    DCL DD ENTRY-FILE           CHAR(10) DEF(THE-ENTRY) POS(38);
    DCL DD ENTRY-MEMBER         CHAR(10) DEF(THE-ENTRY) POS(48);
    DCL DD ENTRY-OPERATION      CHAR(10) DEF(THE-ENTRY) POS(58);
    DCL DD ENTRY-COUNT            BIN(4) DEF(THE-ENTRY) POS(68);
    DCL DD ENTRY-REC-LENGTH       BIN(2) DEF(THE-ENTRY) POS(72);
    DCL DD ENTRY-RECORDS          BIN(4) DEF(THE-ENTRY) POS(74);
    DCL DD ENTRY-KIND            CHAR(2) DEF(THE-ENTRY) POS(78);
    DCL DD ENTRY-YET-TO-BE-USED  CHAR(1) DEF(THE-ENTRY) POS(80);

DCL DD BYTES PKD(18,0);
DCL DD COUNT BIN(4);
DCL DD SIZE  BIN(2);
DCL DD TEXT CHAR(11);
DCL DD COMP CHAR(11);

/******************** WALK WORK CONTROL BLOCKS **********************/

DCL DD SPCPTRS CHAR(48) BDRY(16);
    DCL SPCPTR .WCBSPC     DEF(SPCPTRS) POS( 1);
    DCL SPCPTR .WCB-ROOT   DEF(SPCPTRS) POS(17);
    DCL SPCPTR .WCB-ENTRY  DEF(SPCPTRS) POS(33);

DCL DD OWN-PCO CHAR(512) BASPCO;
    DCL SYSPTR @WCBT00 DEF(OWN-PCO) POS(433);

DCL DD WCB-ROOT CHAR(2048) BAS(.WCB-ROOT);
    DCL SYSPTR .WCB-TABLES(30) DEF(WCB-ROOT) POS(577);

DCL DD THE-TABLE  BIN(4);
DCL DD THE-OFFSET BIN(4);

DCL DD WCBTBL-SPACE CHAR(256) BAS(.WCBSPC);
    DCL DD WCBTBL-SIZE  BIN(4) DEF(WCBTBL-SPACE) POS(21);

DCL DD WCB-ENTRY CHAR(1024) BAS(.WCB-ENTRY);
    DCL DD WCB-DEVICE       CHAR(10) DEF(WCB-ENTRY) POS(  1);
    DCL DD WCB-USER         CHAR(10) DEF(WCB-ENTRY) POS( 11);
    DCL DD WCB-JOB-NUMBER    CHAR(6) DEF(WCB-ENTRY) POS( 21);
    DCL SYSPTR .WCB-PCS              DEF(WCB-ENTRY) POS( 33);
    DCL DD WCB-JOB-TYPE      CHAR(1) DEF(WCB-ENTRY) POS( 97);
    DCL DD WCB-STATUS        CHAR(1) DEF(WCB-ENTRY) POS( 98);
    DCL DD WCB-GROUP         CHAR(1) DEF(WCB-ENTRY) POS(100);
    DCL DD WCB-START-TIME    CHAR(8) DEF(WCB-ENTRY) POS(345);

DCL SPCPTR .WCB-PCO;
DCL DD WCB-PCO CHAR(1024) BAS(.WCB-PCO);
    DCL SYSPTR @DMCQ DEF(WCB-PCO) POS(33);

DCL DD RESOLVE CHAR(34);
    DCL DD RESOLVE-TYPE CHAR( 2) DEF(RESOLVE) POS( 1);
    DCL DD RESOLVE-NAME CHAR(30) DEF(RESOLVE) POS( 3);
    DCL DD RESOLVE-AUTH CHAR( 2) DEF(RESOLVE) POS(33) INIT(X'0000');

ENTRY * (PARMS) EXT;

GET-WCB-ROOT:
    SETSPPFP    .WCB-ROOT, @WCBT00;

SEARCH-WORK-CONTROL-TABLES:
    CPYNV        LAST-ENTRY-NBR, 0;
    CPYNV        THE-TABLE, 0;
SEARCH-NEXT-TABLE:
    ADDN(S)      THE-TABLE, 1;
    CMPNV(B)     THE-TABLE, 30            /HI(DONE-WITH-TABLES);
    CMPPTRT(B)  .WCB-TABLES(THE-TABLE), * /EQ(DONE-WITH-TABLES);
    SETSPPFP    .WCBSPC, .WCB-TABLES(THE-TABLE);

PREPARE-TO-SEARCH-WCB-TABLE:
    SETSPPFP    .WCB-ENTRY, .WCBSPC;
    CPYNV(B)     THE-OFFSET, H'0300'/POS(=+2);

NEXT-WCBTBL-ENTRY:
    ADDN(S)      THE-OFFSET, H'0400';:
    CMPNV(B)     THE-OFFSET, WCBTBL-SIZE/NLO(SEARCH-NEXT-TABLE);
    SETSPPO     .WCB-ENTRY,  THE-OFFSET;

CHECK-WCBTBL-ENTRY:
    CMPBLA(B)    WCB-STATUS, X'20'/NEQ(NEXT-WCBTBL-ENTRY); /*ACTIVE? */
DCL EXCM * EXCID(H'2401') BP(NEXT-WCBTBL-ENTRY) CV(X'00000000');

HAVE-ACTIVE-JOB-ENTRY:
    SETSPPFP    .WCB-PCO, .WCB-PCS;
    CALLI        PROCESS-JOB-ENTRY, *, .PROCESS-JOB-ENTRY;
    B            NEXT-WCBTBL-ENTRY;

DONE-WITH-TABLES:
    RTX          *;

/************************ PROCESS JOB ENTRY *************************/

DCL SPCPTR .DMCQ;
DCL DD      DMCQ CHAR(4096) BAS(.DMCQ);
    DCL DD  DMCQ-FIRST-SHARED-ODP     BIN(4) DEF(DMCQ) POS(153);
    DCL DD  DMCQ-LAST-SHARED-ODP      BIN(4) DEF(DMCQ) POS(157);
    DCL DD  DMCQ-FIRST-NON-SHARED-ODP BIN(4) DEF(DMCQ) POS(161);
    DCL DD  DMCQ-LAST-NON-SHARED-ODP  BIN(4) DEF(DMCQ) POS(165);

DCL DD DMCQ-ENTRY CHAR(96) BAS(.WALK);
    DCL DD      DMCQ-NEXT-ENTRY-OFFSET BIN(4) DEF(DMCQ-ENTRY) POS( 1);
    DCL DD      DMCQ-PREV-ENTRY-OFFSET BIN(4) DEF(DMCQ-ENTRY) POS( 5);
    DCL SYSPTR .DMCQ-ODP                      DEF(DMCQ-ENTRY) POS(49);

DCL DD CHAIN BIN(4);
DCL MSPPTR .WALK;

DCL INSPTR .PROCESS-JOB-ENTRY;
ENTRY       PROCESS-JOB-ENTRY INT;
    CPYBLA       ENTRY-DEVICE,     WCB-DEVICE;
    CPYBLA       ENTRY-USER,       WCB-USER;
    CPYBLA       ENTRY-JOB-NUMBER, WCB-JOB-NUMBER;
    CPYBLA       ENTRY-JOB-TYPE,   WCB-JOB-TYPE;

GET-ODP:
    SETSPPFP    .WALK, @DMCQ; /* TO DMCQ ROOT */
    CPYNV        CHAIN, 144;  /* ODP BASE     */

GET-ODP-CHAIN:
    ADDN(S)      CHAIN, 8;    /* NEXT CHAIN   */
    CMPNV(B)     CHAIN, 160/HI(DONE-WITH-ODPS);
    SETSPPO     .WALK, CHAIN;

DCL EXCM * EXCID(H'2202') BP(WALK-ODP-CHAIN) CV(X'00000000');
WALK-ODP-CHAIN:
    CMPNV(B)     DMCQ-NEXT-ENTRY-OFFSET, -1/EQ(GET-ODP-CHAIN);
    SETSPPO     .WALK, DMCQ-NEXT-ENTRY-OFFSET;
    SETSPPFP    .ODP, .DMCQ-ODP; /* GET SPACE POINTER TO ODP */
    CALLI        PROCESS-THIS-ODP, *, .PROCESS-THIS-ODP;
    B            WALK-ODP-CHAIN;

DONE-WITH-ODPS:
    B           .PROCESS-JOB-ENTRY;

/************************** PROCESS THE ODP *************************/

DCL SPCPTR .ODP;
DCL DD ODP CHAR(1024) BAS(.ODP);
    DCL DD ODP.OPEN-FEEDBACK BIN(4)  DEF(ODP) POS(13);
    DCL DD ODP.IO-FEEDBACK   BIN(4)  DEF(ODP) POS(21);

DCL SPCPTR .OPEN-FEEDBACK;
DCL DD OPEN-FEEDBACK CHAR(256) BAS(.OPEN-FEEDBACK);
    DCL DD OPN-TYPE             CHAR(2) DEF(OPEN-FEEDBACK) POS(  1);
    DCL DD OPN-FILE            CHAR(10) DEF(OPEN-FEEDBACK) POS(  3);
    DCL DD OPN-LIBRARY         CHAR(10) DEF(OPEN-FEEDBACK) POS( 13);
    DCL DD OPN-SPOOL-FILE      CHAR(10) DEF(OPEN-FEEDBACK) POS( 23);
    DCL DD OPN-SPOOL-LIB       CHAR(10) DEF(OPEN-FEEDBACK) POS( 33);
    DCL DD OPN-SPOOL-NBR         BIN(2) DEF(OPEN-FEEDBACK) POS( 43);
    DCL DD OPN-REC-LENGTH        BIN(2) DEF(OPEN-FEEDBACK) POS( 45);
    DCL DD OPN-MEMBER          CHAR(10) DEF(OPEN-FEEDBACK) POS( 49);
    DCL DD OPN-NBR-RECORDS       BIN(4) DEF(OPEN-FEEDBACK) POS( 76);
    DCL DD OPN-MISC-FLAGS1      CHAR(1) DEF(OPEN-FEEDBACK) POS(116);
    DCL DD OPN-MISC-FLAGS2      CHAR(1) DEF(OPEN-FEEDBACK) POS(133);
    DCL DD OPN-MISC-FLAGS3      CHAR(1) DEF(OPEN-FEEDBACK) POS(140);

DCL SPCPTR .IO-FEEDBACK;
DCL DD IO-FEEDBACK CHAR(512) BAS(.IO-FEEDBACK);
    DCL DD IO-FILE-DEPNT-AREA   BIN(2) DEF(IO-FEEDBACK) POS( 1);
    DCL DD IO-WRITE-COUNT       BIN(4) DEF(IO-FEEDBACK) POS( 3);
    DCL DD IO-READ-COUNT        BIN(4) DEF(IO-FEEDBACK) POS( 7);
    DCL DD IO-UPDATE-COUNT      BIN(4) DEF(IO-FEEDBACK) POS(11);
    DCL DD IO-OTHER-COUNT       BIN(4) DEF(IO-FEEDBACK) POS(15);
    DCL DD IO-CUR-OPERATION    CHAR(1) DEF(IO-FEEDBACK) POS(20);
    DCL DD IO-BLOCK-COUNT       BIN(4) DEF(IO-FEEDBACK) POS(133);

DCL DD OP-CODE BIN(2);
DCL DD OP-TEXT(10) CHAR(9) INIT("READ", "RD/DIRECT", "RD/KEYED", "04?",
            "WRITE", "WRT/READ", "UPDATE",  "DELETE", "OTHER", "OPEN");

DCL INSPTR .PROCESS-THIS-ODP;
ENTRY       PROCESS-THIS-ODP INT;
    ADDSPP      .OPEN-FEEDBACK, .ODP, ODP.OPEN-FEEDBACK;
SKIP-IF-LOGICAL-FILE:
    TSTBUM(B)    OPN-MISC-FLAGS1, X'08'/ONES(.PROCESS-THIS-ODP);

USE-THE-FILE:
    ADDSPP      .IO-FEEDBACK, .ODP, ODP.IO-FEEDBACK;
    CMPBLA(B)    IO-CUR-OPERATION, X'00'/ EQ(.PROCESS-THIS-ODP);

    CPYBLA       ENTRY-KIND,       OPN-TYPE;
    CPYNV        ENTRY-RECORDS,    OPN-NBR-RECORDS;
    CPYNV        ENTRY-REC-LENGTH, OPN-REC-LENGTH;

    CPYNV        ENTRY-COUNT, IO-WRITE-COUNT;
    ADDN(S)      ENTRY-COUNT, IO-READ-COUNT;
    ADDN(S)      ENTRY-COUNT, IO-UPDATE-COUNT;
    ADDN(S)      ENTRY-COUNT, IO-OTHER-COUNT;

TRANSLATE-OPERATION:
    CPYBRAP      OP-CODE, IO-CUR-OPERATION, X'00';
    CMPNV(B)     OP-CODE, 9/NHI(=+2);
    CPYNV        OP-CODE, 9;:
    CMPNV(B)     ENTRY-COUNT, 0/HI(=+2);
    CPYNV        OP-CODE, 10;: /* NO COUNT => 'OPEN' */
    CPYBLAP      ENTRY-OPERATION, OP-TEXT(OP-CODE), " ";

    CPYBLA       ENTRY-LIBRARY,     OPN-LIBRARY;
    CPYBLA       ENTRY-FILE,        OPN-FILE;
    CPYBLA       ENTRY-MEMBER,      OPN-MEMBER;

    CMPNV(B)     LAST-ENTRY-NBR, 0/EQ(=+2);
    CMPBLA(B)    ENTRIES(LAST-ENTRY-NBR), THE-ENTRY/
                                 EQ(.PROCESS-THIS-ODP);:

    ADDN(S)      LAST-ENTRY-NBR, 1;
    CMPNV(B)     LAST-ENTRY-NBR, MAX-ENTRY-NBR/HI(=+2);
    CPYBLA       ENTRIES(LAST-ENTRY-NBR), THE-ENTRY;:
    B           .PROCESS-THIS-ODP;




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2022 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.