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 lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to