The Object in the Source Work Area

I’d like to have access to the name of the object in the Natural source work area. *PROGRAM returns the name of the program that is being executed. So, for example, if you are editing program ABC, then execute program XYZ, how can program XYZ know that program ABC is in the source work area? If XYZ accesses *PROGRAM, it’s value is ‘XYZ’. I can’t find any other system variable that is even close.

Is asking for the object type too much to ask for?

I’m running Natural version 3.1, maintenance level 0005.

I can explain why I want this if it is germane to the solution.

Thanks

This could be done (possibly) by calling USR0080N in the executed program. First I have not tested this, second it would mean that all your modules would need USR0080N in them and third as well as *PROGRAM why don’t we have *PREV-PROGRAM so that we can know which of various routines called the subprogram. Yes we can pass a parm from programs A, B, C that all call X to know that this instance of X was called from B or we can use a user exit to determine that level and much further up the chain but if this information is already held by the system in some fashion. Why not PROGRAM() where (1) would be the current module (2) the calling module, (3) the one prior to that etc etc. We could even code IF PROGRAM() = ‘AXY’ meaning to perform some code only if AXY is anywhere in the call chain.

This looks VERY promising, Mick. The DBA is copying the subroutine to a library to which our application has access.

The application already uses several USR* subroutines for various reasons; e.g., determining the environment (development, test, or production). I wish I’d thought to look at them!

Thanks for your help.

The solution depends on which editor you use. USR0080N works for the old editor, while you can get MEMBER and LIBRARY name from ISP-U008 if you use natural ISPF.

You can get program type from USR0080N:
1 USR0080-PARAM
2

Auto smileys are not allways as smart as they look :wink:
The cooleys in the above post should have been “( A 8 )” (hope it works this time).

Mike Fitzpatrick wrote

Why not PROGRAM() where (1) would be the current module (2) the calling module, (3) the one prior to that etc etc. We could even code IF PROGRAM() = ‘AXY’ meaning to perform some code only if AXY is anywhere in the call chain.

There is a USR, USR0600, that basically does this. It will show you the current “path” of calls, with the *LEVEL values. You could easily modify the code to store the object names and *LEVEL’s in arrays.

steve