Why not psatold to TCB, tcbtio to TIOT, then tiocnjob?

I have C code that does that. I would post it here but it is dependent on 
structs created from SYS1.MACLIB with CDSECT.

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of John McKown
Sent: Wednesday, January 10, 2018 5:58 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: C code to get running job name.

Sorry, but I deleted the email which had the original question. Just for
"fun" (but no profit), I wrote the following C code to display the name of
the job under which the program is running. It can be improved a bit, but
it shows the basics.

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {
char *psaaold;
char *ascbjbni;
char *ascbjbns;
char *ascbjbn;
char jobname[9];
psaaold=*(char **)0x224; /* address of PSAAOLD */
//printf("%s\n",psaaold);
ascbjbni=*(char **)(psaaold+0xac);
ascbjbns=*(char **)(psaaold+0xb0);
ascbjbn =ascbjbni;
//printf("%s\n",ascbjbni);
if (ascbjbn == NULL) ascbjbn=ascbjbns;
memcpy(jobname,ascbjbn,8);
*(jobname+8)='\0';
printf("%s - %8.8s\n",jobname,ascbjbn);
}

----------------------------------------------------------------------
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