In the C/C++ Run-Time Library Reference (V1.13 link here, watch the wrap, search for __miscitems in the page):
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/EDCLB1C0/3.206.3?SHELF=cbcbs1c0&DT=20110617180047&CASE= The "__miscitems" field in the dynalloc parameter structure is said to be defined as "char * __ptr32 * __ptr32" and your "miscitems" is defined as "int miscitems[2]", so you need: ip.__miscitems = (char * __ptr32 * __ptr32)&miscitems; As long as you are using only the ILP32 compiler option and not LP64, you could also probably use the much shorter version: ip.__miscitems = (char **)&miscitems; HTH Peter -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Janet Graff Sent: Monday, September 08, 2014 5:02 PM To: [email protected] Subject: Re: Dynalloc with FREE=CLOSE,SPIN=UNALLOC I have it working now but I have to say, examples of calling dynalloc() from C code using text units is a decidedly badly documented interface. For anyone who attempts this in the future, here is a sample, this subroutine takes a char * containing the intended ddname like, "DD:LOG000001". It must remove the "DD:" before calling dynalloc()/dynfree(). The RBX is what allows the IKJ messages to be printed to the JESYSMSG (which is really handy). Note that the DUNSPIN text unit is only useful on the dynfree() call and will give an error (900) if specified on the dynalloc() call. Some of the parameters I have specified on the dynfree are probably unnecessary but I left them there for documentation purposes. By the way this line ip.__miscitems = &miscitems; gets a compiler warning for imcompatible pointers. Anyone who can tell me how to cast this properly I'll be very grateful. void myDynFree(char *ddname) { __dyn_t ip; __S99rbx_t myrbx; memcpy(myrbx.__S99EID, "S99RBX", 6); myrbx.__S99EVER = 0x01; myrbx.__S99EOPTS = 0x84; myrbx.__S99ESUBP = 0x00; myrbx.__S99EKEY = 0x00; myrbx.__S99EMGSV = 0x00; myrbx.__S99ENMSG = 0x00; myrbx.__S99ECPPL = 0; myrbx.__S99ERES = 0x00; myrbx.__S99ERCO = 0x00; myrbx.__S99ERCF = 0x00; myrbx.__S99EWRC = 0; myrbx.__S99EMSGP = 0; myrbx.__S99EERR = (short)0; myrbx.__S99EINFO = (short)0; int textUnitSpin1 = 0x80130001; /* DUNSPIN text unit*/ int textUnitSpin2 = 0x00018000; int textUnitUnalc = 0x00070000; /* DUNUNALC text unit*/ int miscitems[2]; miscitems[0] = (int)&textUnitUnalc; miscitems[0]= miscitems[0] | 0x80000000; dyninit(&ip); ip.__rbx = &myrbx; ip.__sysout = 'H'; ip.__ddname = ddname+3; /* passed in DD name without the DD: prefix */ ip.__misc_flags = __RELEASE & __CONTIG & __CLOSE; /* RLSE,CONTIG, CLOSE) */ ip.__dsorg = __DSORG_PO; /* DCB=(DSORG=PO, */ ip.__recfm = _F_ + _B_; /* RECFM=FB, */ ip.__lrecl = 255; /* LRECL=255, */ ip.__blksize = 25500; /* BLKSIZE=25500) */ ip.__miscitems = &miscitems; dynfree(&ip); } Janet ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
