Use the most recently called procedure as a base

You can specify the most recently called procedure as the base call stack entry by using 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 ILE program. The special value *PGMNAME is used with a 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 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.

Related concepts
Use a control boundary as a base