Highlighted
Absent Member.
Absent Member.
628 views

[archive] Which Program Am I ?

[Migrated content. Thread originally posted on 22 March 2004]

You could be surprised by my question but I persist :
Is there a way to know in which program I am ... ?
[ I can get the caller program ( C$calledby ) but not in which program I am ]

I have about 3000 programs using files , theses programs have the declaratives in an copy file 'DECLA.IO' which display errors ... and I would like to display the name of the program.

there is severals ways to know it but it's not great ( coding the name in a variable, calling a program using C$CALLEDBY with a linkage, using ...)

I need something like WHEN-COMPILED function .

Your Ideas will interest me.

THANK YOU:confused:
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Which Program Am I ?

Assuming that you have individual window titles for your program (e.g. assuming all your programs has a window 🙂 ), you could use the window handle to inquire for its name (the text in the caption).

Would that do?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Which Program Am I ?

Actually, this sounds like an oppourtunity for some refactoring of your error handling. Instead of using a copy file that requires recompile of many, many programs to use it, create a seperate program that gets called and handles error displays and uses c$calledby to display the program name. Your declarative copy file simply becomes a call statement to an error handler program. This program can perhaps do even more like error logging etc, all in one place without any need to recompile many, many programs when you make changes to your error handing code.
In other words, look at this from another direction and turn it into an oppurtunity for a better solution. 🙂
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Which Program Am I ?

hi mcapisani
would it be good for you to call a routine to do so?
If so it could be something like this:

call "whoami" using ws-myself


<<<<<<<<<<<<<<<<


identification division.
linkage section.
01 lk-whoareyou pic x(50).
procedure division.
main.
call "c$calledby" using lk-whoareyou
goback.

<<<<<<<<<<<<<<<<<
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.