Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Finding the Called Program if no parameters passed
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
anu2
Warnings : 1

New User


Joined: 10 Jun 2007
Posts: 36
Location: Chennai

PostPosted: Mon Jun 18, 2007 12:22 pm    Post subject: Finding the Called Program if no parameters passed
Reply with quote

Hi,

When a program calls another program without passing any parameter then how would one know seeing the called program that it has been called by some other program ?



Regards,
anu
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Jun 18, 2007 2:00 pm    Post subject: Re: Finding the Called Program if no parameters passed
Reply with quote

anu2 wrote:
When a program calls another program without passing any parameter then how would one know seeing the called program that it has been called by some other program ?
I can't see any way to "know".....except possibly by the called program's logical expectation of events or conditions to have already occured or been met.....
Back to top
View user's profile Send private message
pcoreddy

New User


Joined: 14 Mar 2007
Posts: 24
Location: Mysore

PostPosted: Mon Jun 18, 2007 5:36 pm    Post subject: Re: Finding the Called Program if no parameters passed
Reply with quote

called program should be end with EXIT,it wont end with other than this


but in cae of calling program it should be end with STPORUN or GOBACK
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Jun 18, 2007 5:39 pm    Post subject:
Reply with quote

GOBACK works just fine for both cases.
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1105
Location: The Netherlands at Hole 19

PostPosted: Mon Jun 18, 2007 6:55 pm    Post subject: Re: Finding the Called Program if no parameters passed
Reply with quote

anu2 wrote:
Hi,

When a program calls another program without passing any parameter then how would one know seeing the called program that it has been called by some other program ?



Regards,
anu


Have it abended and check the static storage of that module in your dump. You may also check the trace list there.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jun 18, 2007 9:35 pm    Post subject:
Reply with quote

Hello,

This
Quote:
called program should be end with EXIT,it wont end with other than this
is at least misleading if not completely untrue.

Your organizatin may have a standard that dictates the use of EXIT, but it is not a COBOL requirement.
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 149
Location: Ottawa Canada

PostPosted: Tue Jun 19, 2007 12:29 am    Post subject:
Reply with quote

Anu2,

To better help you, let me ask you this: Why do you care who your caller is? Do you want to know whether your program was invoked directly from the JCL or from a COBOL program?

One of the guys I work with is working on some logic that walks some system control blocks in order to answer the question: What programs are in memory and how much memory are they using? Maybe that approach might be helpful to you.
Back to top
View user's profile Send private message
anu2
Warnings : 1

New User


Joined: 10 Jun 2007
Posts: 36
Location: Chennai

PostPosted: Tue Jun 19, 2007 4:00 pm    Post subject: Re: Finding the Called Program if no parameters passed
Reply with quote

Hi,
Let me put it in more simple words.

How can one make out seeing a program that it has been called from some other program and given a case it doesn't accept any parameters .


Regards,
anu.
Back to top
View user's profile Send private message
Raphael Bacay

New User


Joined: 04 May 2007
Posts: 58
Location: Manila, Philippines

PostPosted: Tue Jun 19, 2007 4:06 pm    Post subject:
Reply with quote

I don't think it is possible for the called program to access the program calling it. You can put the name of the calling program in a file accessible to both programs i guess...
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Jun 19, 2007 4:50 pm    Post subject: Re: Finding the Called Program if no parameters passed
Reply with quote

anu2 wrote:
How can one make out seeing a program that it has been called from some other program and given a case it doesn't accept any parameters .
Like TG Murphy pointed out, the only way would be to walk back up system control blocks to find who or what initiated you.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 685
Location: Earth

PostPosted: Tue Jun 19, 2007 5:00 pm    Post subject: Re: Finding the Called Program if no parameters passed
Reply with quote

Quote:
How can one make out seeing a program that it has been called from some other program and given a case it doesn't accept any parameters .

let me put it this way,
You can make sure that it doesn't accept any parameters if PROCEDURE DIVISION doesn't include USING phrase. ( I assume passing parameter = passing variables)
If it is getting called then you have to scan all of your program code for the program name you want to find out. This is also not foolproof because I have seen some programs getting called dynamically using a parameter table.
Usually subprogram end is indicated by GOBACK instead of STOP RUN.
( However it is not mandatory, you can use STOP RUN as well. A main program can end with a GOABCK too icon_smile.gif )
If you are sure that all subprograms end with GOBACK and all subprograms are getting called through some main program and PROCEDURE division does not contain USING clause then you can say
"a program that it has been called from some other program and given a case it doesn't accept any parameters ."
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Tue Jun 19, 2007 5:36 pm    Post subject:
Reply with quote

I see lots of answers, but I for one have no idea what the question actually is, or the motivation for the question.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jun 19, 2007 10:22 pm    Post subject:
Reply with quote

Hi Phil,

If i understood correctly, the original question was "if you look at a program (that uses no parameters/linkage section), how would you know if the program was called".

Maybe Anu will post what generated the question. . .
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Tue Jun 19, 2007 10:38 pm    Post subject:
Reply with quote

I also think that's the question, but I must be missing something, because I don't see what the parameter issue is.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jun 19, 2007 11:38 pm    Post subject:
Reply with quote

I believe the issue with the parameter (or lack thereof) is that without any parameter/linkage, how would you know a program was called (i.e that it was the "callee").
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Jun 20, 2007 12:46 am    Post subject:
Reply with quote

dick scherrer wrote:
I believe the issue with the parameter (or lack thereof) is that without any parameter/linkage, how would you know a program was called (i.e that it was the "callee").


I think the op has disappeared.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jun 20, 2007 2:32 am    Post subject:
Reply with quote

Quite possibly. Maybe tomorrow. . .
Back to top
View user's profile Send private message
anu2
Warnings : 1

New User


Joined: 10 Jun 2007
Posts: 36
Location: Chennai

PostPosted: Wed Jun 20, 2007 12:03 pm    Post subject: Re: Finding the Called Program if no parameters passed
Reply with quote

yes, that is the question.......
Back to top
View user's profile Send private message
anu2
Warnings : 1

New User


Joined: 10 Jun 2007
Posts: 36
Location: Chennai

PostPosted: Wed Jun 20, 2007 3:06 pm    Post subject: yes, that's right ..., that's what i would like to know...
Reply with quote

yes, that's right ..., that's what i would like to know...
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Wed Jun 20, 2007 5:25 pm    Post subject:
Reply with quote

Still dense here - even with parms, how do I know it was called without some kind of action:

1. obviously, modify parm, and have caller show that somehow
2. but parm might just be input, so I need some other file change or output by callee

I must be missing something here.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm
No new posts How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts CICS NEW SIT PARAMETERS CICS BEHAVIOR... Kyle Carroll CICS 0 Fri Nov 04, 2016 11:55 pm
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us