© andywood@newsgroup

The program returns the name of the program from "EXEC PGM=????????".

This way a REXX program is able to distinguish between programs running under IKJEFT01 and IRXJCL (often very useful).

/* REXX
Subject: How to find program execution environment under MVS
Andy Wood
*/
xp      = storage(0000021c,4)
xp2     = ptr(xp,'b4'x)
xp3     = d2x(c2d(xp2) + c2d('168'x))
envname = storage(xp3,8)
say 'jobstepprogname=' envname
exit

ptr: procedure
   address = c2d(arg(1))
   offset  = c2d(arg(2))
return storage(d2x(address+offset),4)
back to The Power of REXX