Uggh.....no wonder people complain about C/C++ :-) Much better to use the IBM EDCDSECT utility to map the DSECTs that you want to use into C structs. We wrote a little REXX wrapper for it that I posted here once so that you can use edcdsect as a shell command in a Makefile:
ihapsa.h: echo " IHAPSA" > asm_temp.s echo " END" >> asm_temp.s edcdsect.rexx asm_temp.s > ihapsa.h .... Kirk Wolf Dovetailed Technologies http://dovetail.com On Sat, Jan 13, 2018 at 9:33 AM, John McKown <[email protected]> wrote: > Just for fun, I wrote the C code below. It does the "chain chasing" to get > some of the information mentioned in this thread. > Given the responses on another thread, I'm basically abandoning the idea > of "system level C interface" routines, such as for ENQ/DEQ et al. I might > even try to get a decent handle on C++ coding for some of my UNIX stuff. > > === stuff.c === > > #include <stdlib.h> > #include <stdio.h> > #include <string.h> > #include <errno.h> > #include <stdint.h> > int main(int argc, char *argv[]) > { > unsigned char *psaaold; > unsigned char *psatold; > unsigned char *ascbjbni; > unsigned char *ascbjbns; > unsigned char *ascbjbn; > unsigned char *ascbcscb; > uint16_t ascbasid; > unsigned char *ascbasxb; > unsigned char *ascbassb; > unsigned char *tcbtio; > unsigned char *a; > static unsigned char jobname[9]; > psaaold = *(unsigned char **)0x224; /* address of PSAAOLD */ > psatold = *(unsigned char **)0x21c; /* address of PSATOLD */ > if (NULL == psaaold) { > printf("PSAAOLD is NULL.\n"); > } else { > ascbasid = *(uint16_t *)(psaaold + 36); > printf("ascbasid=%hu %04.4hx\n",ascbasid,ascbasid); > ascbjbni = *(unsigned char **)(psaaold + 0xac); > printf("ascbjbni=%8.8s\n", > (NULL == > ascbjbni) ? (unsigned char *)"**NULL**" : ascbjbni); > ascbjbns = *(unsigned char **)(psaaold + 0xb0); > printf("ascbjbns=%8.8s\n", > (NULL == > ascbjbns) ? (unsigned char *)"**NULL**" : ascbjbns); > ascbcscb = *(unsigned char **)(psaaold + 56); > if (NULL == ascbcscb) { > printf("ascbcscb is NULL\n"); > } else { > printf("key=%8.8s cls=%8.8s step=%8.8s memnam=%8.8s\n", > ascbcscb + 8, ascbcscb + 16, ascbcscb + 64, > ascbcscb + 64); > } > ascbasxb = *(unsigned char **)(psaaold + 108); > if (NULL == ascbasxb) { > printf("ascbasxb is NULL\n"); > } else { > printf("asxbusr8=%8.8s\n", ascbasxb + 192); > } > ascbassb = *(unsigned char **)(psaaold + 336); > if (NULL == ascbassb) { > printf("ascbassb is NULL\n"); > } else { > printf > ("assbjbni=%8.8s assbjbns=%8.8s assbjobid=%8.8s\n", > ascbassb + 336, ascbassb + 344, ascbassb + 2352); > } > } > if (NULL == psatold) { > printf("PSATOLD is NULL\n"); > } else { > tcbtio = *(unsigned char **)(psatold + 12); /* get the address of the TIOT > */ > printf("TIOT info. Jobname=%8.8s Stepname=%8.8s > Procstep=%8.8s\n",tcbtio,(tcbtio+8),(tcbtio+16)); > } > } > > === example output === > > ascbasid=60 003c > ascbjbni=BUBBAZ3 > ascbjbns=BPXAS > key=BPXAS cls=BPXAS step= memnam= > asxbusr8=BUBBAZ > assbjbni=BUBBAZ3 assbjbns=BPXAS assbjobid=STC02572 > TIOT info. Jobname=BUBBAZ3 Stepname=*OMVSEX Procstep= > > > > -- > I have a theory that it's impossible to prove anything, but I can't prove > it. > > Maranatha! <>< > John McKown > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
