Here's a command and REXX procedure I wrote to change an observable OPM program's variable storage area to either all automatic or all static. (Changing an RPG program's variables to automatic will enable it for recursive calls.) This uses only REXX and CL commands and requires the *ALLOBJ special authority to run.
 CMD PROMPT('Modify Program Storage') PARM KWD(PGM) TYPE(Q1) MIN(1) PROMPT('Program') PARM KWD(STG) TYPE(*CHAR) LEN(5) RSTD(*YES) + VALUES(*AUTO *STAT) MIN(1) PROMPT('Storage type') Q1: QUAL TYPE(*NAME) MIN(1) QUAL TYPE(*NAME) MIN(1) PROMPT('Library') /*------------------------------------------------------------------------*/ 
Arg "PGM(" Library "/" Program ") STG(" Storage ")" "DLTF FILE(QTEMP/STDIN)" "DLTF FILE(QTEMP/STDOUT)" "RMVMSG CLEAR(*NEW)" Signal On Error "CRTPF FILE(QTEMP/STDIN) RCDLEN(80) SIZE(*NOMAX) LVLCHK(*NO)" "OVRDBF FILE(STDIN) TOFILE(QTEMP/STDIN)" "CALL PGM(QSCMATPG) PARM(&Program &Library STDIN QTEMP STDIN '*REPLACE')" /* parse the program template */ Data = '' Do Count = 0 By 80 Until Record == '' Parse Linein Record If Record ^= '' Then Data = Insert(Record, Data, Count, 80); End Count ODV = C2D(Substr(Data, 133, 4), 4) + 17 OES = C2D(Substr(Data, 137, 4), 4) + 17 Flip = D2C(Wordpos(Storage, "*AUTO")) Sum = D2C(C2D(Substr(Data, 117, 4), 4) + C2D(Substr(Data, 121, 4), 4), 4) If C2D(Flip) Then Data = Overlay(Right(Sum, 8, '00'x), Data, 117) Else Data = Overlay( Left(Sum, 8, '00'x), Data, 117) /* flip automatic/static bits in object definition table */ Do X = ODV+4 By 4 For C2D(Substr(Data, ODV, 4), 4) / 4 - 1 If Substr(Data, X, 1) < 'F0'x Then Y = X Else Y = OES + C2D(Subst(Data, X+1, 3), 3) Type = Substr(Data, Y, 1) If Verify(Bitand('F0'x, Type), '001090'x, 'M') &, Verify(Bitand('07'x, Type), '0001'x, 'M') Then, Data = Overlay(Bitor(Flip, Bitand('FE'x, Type)), Data, Y); End X /* encapsulate the program */ "CRTPF FILE(QTEMP/STDOUT) RCDLEN(80) SIZE(*NOMAX) LVLCHK(*NO)" "OVRDBF FILE(STDOUT) TOFILE(QTEMP/STDOUT)" Do X = 1 To Count By 80; Say Substr(Data, X, 80); End X "DLTPGM PGM("Strip(Library)"/"Strip(Program)")" "CALL PGM(QSCCRTPG) PARM(&Program &Library STDOUT QTEMP STDOUT)" "SNDPGMMSG MSG('Done.')" Return Error: "CALL PGM(QMHMOVPM)", "PARM(' ' '*DIAG *ESCAPE ' X'00000002' * X'00000001' X'00000000')"