Thanks. Yes, I have used the counter technique also. It only works if you have some piece of static storage shared among the various allocators (which is always possible of course but is sometimes a project of its own). If that is not available I have also used the technique of Dxxxxxxx where xxxxxxx is 7/8 of the (32-bit!) hex address of something unique to a particular DD-name generator.
I think in this case I can live with a hard-coded DD name. I am wrestling with a different problem at the moment and have not given this issue sufficient dedicated thought. I've got one of those wrappers too. That's the thing that I think I made a mess of when I was new to C++. Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of David Crayford Sent: Wednesday, May 06, 2015 11:26 PM To: [email protected] Subject: Re: Possible to get DCB address after C fopen() On 7/05/2015 1:34 AM, Charles Mills wrote: > Annoying that BPXWDYN cannot return a DD name. Have to do some serious > thinking about the implications of a hard DD name. I generate my own unique DDnames. It's as simple as keeping a static counter and incrementing it on each call to getNextNameToken(), which returns a string in the form CNNNNNNN. I use those tokens for all sorts of things that require unique standard MVS names. > Resigned to the possibility of having to use C dynalloc(). I remember > it as being a PITA but the only other time I used it I was brand new > to C and especially C on Z and so it may not be so bad as I recall dynalloc() is not without it's flaws. I don't like the way it uses char * for parameter strings. You can easily get burned with dangling pointers. One of the problems with using fopen() magic allocation is that if it fails it's hard to debug. All you can do is check the __amrc structure and try to make sense of it. I've seen cases where a RACF violation was reported as a failure in CAMLST. Better to use dynalloc() IMO. If you setup dynalloc to use the S99RBX extension you can get back the IKJ* error messages if it fails. I've got a C++ dynalloc() wrapper that throws and exception with those messages. Contact me offlist if you're interested. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
