Okay! It's all working.

The C++ program that needs to make this determination does the following:

- Calls a C++ method to get the PGM= name from the JSCB and stores it in
char pgmEqualName[9];
- Calls an assembler subroutine that issues CXVQUERY
INEPNAME=(R2),SEARCH=JPALPA,OUTMJNM=(R6) where R2 points to pgmEqualName and
R6 points to char jobstepMajorName[9].
- Calls an assembler subroutine that issues CSVQUERY
INADDR=(R2),SEARCH=JPALPA,OUTMJNM=(R6) where R2 is the address of a constant
in the C++ code and R6 is char ourMajorName[9];
- Compares ourMajorName to jobstepMajorName and if they are equal concludes
that we are the jobstep program.

I have tested it both with

- Executing the C program directly but using an alias. The C++ program
correctly concludes that it is the jobstep program.
- Using a Rexx front-end to LINKMVS to the C++ program. The C++ program
reports that the PGM= name is IRXJCL, that its real major name is IRXINIT,
and that it ain't us.

QED

Thanks all for your help, especially Peter who pointed me at JSCBPGNM,
Gerhard who suggested CSVQUERY, and Jeremy who pointed out that I was headed
down a primrose path that would have failed with EXEC PGM=alias.

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On
Behalf Of Charles Mills
Sent: Wednesday, December 05, 2012 1:41 PM
To: [email protected]
Subject: Re: Who loaded me?

Suppose I modify the logic as follows. Does anyone see a problem with this?

Issue CSVQUERY OUTMJNM=name to determine the major name associated with some
address in "me." (Any old address.)

Get the jobstep program name from the JSCB. Issue CSVQUERY
INEPNAME=jscbpgnm,SEARCHMINOR=YES,OUTMJNM=eight_char_field to get the major
name associated with the possibly minor name from PGM=.

Compare the two. Equality means I am the jobstep program. (Neglecting the
"two programs/two libraries/one name" case.)

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to