Skip to main content

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

[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:
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?

[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:
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?

[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:
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?

[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:
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. :-)

[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:
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.

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