On 6 May 2015 at 09:50, Charles Mills <[email protected]> wrote:
> I suspect I know the answer to this question. Is there any
> generally-accepted way to get the DCB address following a C fopen()? (I say
> "generally accepted" because I assume there is no supported way. I could
> live with something with some risk, but not a total hack.)

The supported (in the sense that all fields and control blocks are PI
or at least very well known for decades) is to chase the DEB chain.
Each DEB points to an open DCB (or ACB) and each such xCB has a TIOT
offset to the DDNAME entry. So if you know the DDNAME you can find any
open DCBs for it without reference to any C or LE control blocks.

But if it was dynalloc'd then you won't know the DDNAME, presumably.
You can go a step further and do the same thing with DSNAMEs, though
it's trickier. If you know the DSNAME, obviously.

Otherwise I'd check the LE Vendor Interfaces book. Though the more I
think about it, the more I think I/O in general is probably language
dependant, and may not be handled by LE. And there is no C/C++ Vendor
Interfaces book, afaik.

> Why? I'd like to be able to use the terrific features of C fopen()
> (transparent dynamic allocation, etc.) but use the DCB with LINK (in an
> assembler function called from C).

My, you are pressing things hard. There are warnings about mixing OS
services with those of LE, and presumably of C itself. But it's a neat
idea.

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