On Wed, 12 Feb 2025 at 20:24, Joseph Reichman <
[email protected]> wrote:

> I know there is a way when you scan the TIOT and find a DDNAME entry how
to
> associate it with a DCB

Just to be clear, there is no way to find a DCB that isn't open - that's
completely unknown to the system. It may not even exist yet.

> I think you save the first TIOT entry then while scanning you keep track
of
> the offset  to the  DDNAME you are looking for then get the DEB from the
TCB
> and get the DCB from the DEB and compare DCBTIOT to that offset
>
>
> If not equal, you get the next DEB and do the same

Assuming your DCB of interest is open, then this ancient snippet should
work in an old-style environment, i.e. no XTIOT, and in 24- or 31-bit mode.
Of course there are newer instructions like LLH that could be used.
======
         L     R4,PSATOLD-PSA -> Current TCB           Assumes you want the
current one...
         USING TCB,R4
*        L     R4,TCBJSTCB   -> Job Step TCB           ...or maybe the Job
Step one
         L     R5,TCBDEB     -> 1st DEB on chain
                BZ    NO_DEB        No DEBs
         USING DEBBASIC,R5
         SR    R6,R6         Clear high byte for 24-bit addressing
NEXT_DCB ICM   R6,B'0111',DEBDCBB -> DCB or ACB
         BNZ   CHK_DCB        Got one
NEXT_DEB ICM   R5,B'0111',DEBDEBB -> Next DEB
         BZ    NO_DEB        DEB search exhausted
         B     NEXT_DCB      Try next DCB

CHK_DCB  DS    0H
         USING IHADCB,R6
         TM    DCBDSRG2,DCBACBM Is it an ACB?
         BO    NEXT_DEB      Yes - not interested
         SR    R7,R7         Clear for halfword stuff
         ICM   R7,B'0011',DCBTIOT Get DD entry offset (not LH!)
         AL    R7,TCBTIO     Add TIOT address
         CLC   =CL8'ddname of interest',TIOEDDNM-TIOENTRY(R7) ?
         BNE   NEXT_DEB      No - try further
* Found it
...
NO_DEB  Not found - issue msg
======

No guaranties, etc.

Tony H.

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

Reply via email to