Using the most recently called procedure as a base (*PGMNAME)

To specify the most recently called procedure as the base call stack entry, use the *PGMNAME special value.

Although you may not know the name of a procedure, you may want to send a message back to the most recently called procedure of an Integrated Language Environment® (ILE) program. The special value *PGMNAME is used with an ILE program name to use the base entry name as the name for the most recently called procedure of the identified program. The programs in this example are: The send operation is accomplished using the special value *PGMNAME and the program name CLPGM51.

The special value *PGMNAME is useful if you convert some CL programs, but not all CL programs, to ILE programs. For example, CLPGM71 is an OPM CL program; CLPGM73 sent messages to CLPGM71 and specifies TOPGMQ(*SAME CLPGM71). If CLPGM71 is converted to ILE, only the Send Program Message (SNDPGMMSG) command with the *PGM name in CLPGM73 (OPM) works. Specifying CLPGM71 as a simple name does not work because there was no entry in the call stack for CLPGM71. If you change the command to TOPGMQ(*SAME *PGMNAME *NONE CLPGM71), CLPGM73 sends messages successfully to CLPGM71 regardless of the names you may have used for procedure names.

The special value *PGMNAME can also be used with an OPM program name. In this case the effect is the same as if you just used the name. For example, TOPGMQ(*SAME *PGMNAME *NONE opmpgm) sends the message to the same place as TOPGMQ(*SAME opmpgm). The use of *PGMNAME should be considered when you cannot determine whether the message is being sent to an OPM program name or and ILE program name.