Thanks again John. I will try it out.

The problem is when a program is started from OMVS under a USERID and runs 
under a different name, which makes it
difficult for someone to cancel the job or issue modify commands against it.
The system keeps appending numerical values to the USERID and you have to do a 
DA userid* command to find what it is.
I just want to be able to display the actual JOBNAME to the console.

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of John McKown
Sent: Wednesday, January 10, 2018 8: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);
}

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


________________________________

This e-mail, including any attachments, may be confidential, privileged or 
otherwise legally protected. It is intended only for the addressee. If you 
received this e-mail in error or from someone who was not authorized to send it 
to you, do not disseminate, copy or otherwise use this e-mail or its 
attachments. Please notify the sender immediately by reply e-mail and delete 
the e-mail from your system.

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