MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Called Program Name
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
gotluru
Beginner


Joined: 17 Dec 2002
Posts: 29
Topics: 6

PostPosted: Fri Dec 20, 2002 12:51 pm    Post subject: Called Program Name Reply with quote

Hi,

How i am going to know which program is called?

My Environmnet is: Cobol/MVS

Thanks,
Prasad
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Fri Dec 20, 2002 1:46 pm    Post subject: Reply with quote

Gotluru,

There are 2 macro's which will give information about the load modules.

1.CSVINFO -- Obtain Information about Loaded Modules

2.CSVQUERY -- Contents Supervisor Query Service

The macro CSVQUERY will tell you what module (not CSECT) is at a particular address. If the program you are using uses standard linkage conventions, then you can look at Reg 14 on entry (or from your save area) and pass that address to CSVQUERY. You'll get the load module name and starting address. Then you subtract that from your R14 and you get an offset.If standard linkage conventions are in use, the R12 on entry might point to the module name, depending on the compiler used to compile the caller.

Check this link for Retrieving Information About Loaded Modules

To make things simpler, pass the called program name to the calling program as a variable.

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gotluru
Beginner


Joined: 17 Dec 2002
Posts: 29
Topics: 6

PostPosted: Fri Dec 20, 2002 1:57 pm    Post subject: Reply with quote

Hi Kolusu,

Thanks for the information.

How to get return code's to be displayed at runtime? Can you help me with example..

Thanks,
Prasad
Back to top
View user's profile Send private message
hari_uss
Beginner


Joined: 19 Dec 2002
Posts: 78
Topics: 6
Location: Trivandrum, India

PostPosted: Sun Dec 22, 2002 3:39 am    Post subject: Reply with quote

Gotluru,

Check this link..

Return Code

Implicit declaration for Return code is PIC S9(04) COMP. I think you can find a way to display that.
-----
Hari.
Back to top
View user's profile Send private message Send e-mail
gotluru
Beginner


Joined: 17 Dec 2002
Posts: 29
Topics: 6

PostPosted: Mon Dec 23, 2002 10:57 am    Post subject: Reply with quote

Hi Hari,

Thanks for the help.

I am looking in other way. I need program name from where the call is came from?

Thanks,
Prasad
Back to top
View user's profile Send private message
hari_uss
Beginner


Joined: 19 Dec 2002
Posts: 78
Topics: 6
Location: Trivandrum, India

PostPosted: Mon Dec 23, 2002 12:56 pm    Post subject: Reply with quote

Hi Prasad,

I dont know any built-in function to get that info. I would pass the name of the calling program as a parameter through the linkage

Or,

Define an EXTERNAL variable WS-CALLING-PGM in all your calling programs and in the called program.

-----
Hari.
Back to top
View user's profile Send private message Send e-mail
gotluru
Beginner


Joined: 17 Dec 2002
Posts: 29
Topics: 6

PostPosted: Mon Dec 23, 2002 2:15 pm    Post subject: Reply with quote

Hi Hari,

Thanks for immediate reply..

Code:
Define an EXTERNAL variable WS-CALLING-PGM in all your calling programs and in the called program.


How to accomplish this? Is it same as passing parms or differant?
Can you please explain..

Thanks,
Prasad
Back to top
View user's profile Send private message
hari_uss
Beginner


Joined: 19 Dec 2002
Posts: 78
Topics: 6
Location: Trivandrum, India

PostPosted: Mon Dec 23, 2002 11:01 pm    Post subject: Reply with quote

It is different from passing parameters.

Program-1.
Code:

Program-ID. PGM1.
Working-Storage Section.
01 Ws-pgm-name           Pic X(08)  External.

Procedure Division.
    Move 'PGM1'               To Ws-pgm-name.
    Call 'PGM2' Using ws-1 ws-2.
    <<control goes to PGM2>>



Program-2.
Code:

Program-ID. PGM2.
Working-Storage Section.
01 Ws-pgm-name           Pic X(08)  External.

Linkage-Section.
01  ws-1                        Pic x(02).
01  ws-2                        Pic x(02).

Procedure Division using ws-1 ws-2.

      Display 'This program is called by ' Ws-pgm-name .



Since Ws-pgm-name is declared as EXTERNAL, we can access the value in PGM2 also.

The variable name you are using for declaring EXTERNAL should be same in all modules.

Hope this is clear for you...
Hari.
Back to top
View user's profile Send private message Send e-mail
gotluru
Beginner


Joined: 17 Dec 2002
Posts: 29
Topics: 6

PostPosted: Thu Dec 26, 2002 2:17 pm    Post subject: Reply with quote

Hi Hari,

Thanks for your help. External clause is working fine and easier than passing parms.

Thanks,
Prasad
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 699
Topics: 63
Location: USA

PostPosted: Wed Jun 16, 2010 11:20 am    Post subject: Reply with quote

Hi,

I need to verify if a calling program is authorised to call the called program or not. And to prevent unauthorised program from getting access by pretending to be someone else, I don't trust the program name passed by the calling program. So I need a way to find the name of calling program. This should work in any environment (CICS/TSO) and calling method (Call/Link/XCTL/Start).


After going through all the posts on this subject and available material on the web I don't find any example that can get calling program name irrespective of the calling method.

Only method that doesn't seem to care about the calling methods is to use PPA1. Please let me know if that is correct and the right approach. And if someone can provide an example, preferably in COBOL. Another question, will this work if I have a static call?
_________________
Regards,
Diba
Back to top
View user's profile Send private message Send e-mail
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Wed Jun 16, 2010 2:07 pm    Post subject: Reply with quote

Any restrictions should be handled by external security. . . (racf, acf2, tss).

No program needs (or should be permitted) to do this. . .

fwiw.
_________________
All the best,

di
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 699
Topics: 63
Location: USA

PostPosted: Wed Jun 16, 2010 5:11 pm    Post subject: Reply with quote

Quote:

Any restrictions should be handled by external security


di,

This is the argument we are also trying. But I cannot say what will be the final decision. Currently we are trying find if it is feasible to write a program to get caller's name, without any restriction.
_________________
Regards,
Diba
Back to top
View user's profile Send private message Send e-mail
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Wed Jun 16, 2010 5:50 pm    Post subject: Reply with quote

For fun, let us assume i want to "break in". Let us also assume that a program named GOODGUY is allowed to call this "restricted" module.

If i create my own code that does something "bad" and name it GOODGUY, how will this restricted module know that my GOODGUY module should be denied. . .?
_________________
All the best,

di
Back to top
View user's profile Send private message
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 699
Topics: 63
Location: USA

PostPosted: Wed Jun 16, 2010 8:09 pm    Post subject: Reply with quote

This program will never get promoted to production library as a simple comparison with the old GOODGUY would reveal that it is doing something fishy. Without this manual check any security tool would fail in this case.
_________________
Regards,
Diba
Back to top
View user's profile Send private message Send e-mail
nevilh
Beginner


Joined: 11 Aug 2004
Posts: 115
Topics: 0

PostPosted: Thu Jun 17, 2010 6:52 am    Post subject: Reply with quote

Dibakar wrote:
This program will never get promoted to production library.
And what happens if the user copies the GOODGUY to a user library and invokes it from there
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group