John, your command wasn't found because VARY is an MVS command, not a TSO command, and IKJEFT01 is TSO.
If, as others pointed out, the // COMMAND suggestion doesn't work due to
authorization issues or timing issues, you may want to try it in TSO batch
again, using the CONSOLE command (for which you're authorized maybe).
Something like this:
//your-jobcard JOB ...
//STEP01 EXEC PGM=IEBUPDTE,PARM=NEW
//SYSPRINT DD DUMMY
//SYSUT2 DD DISP=(,PASS),SPACE=(TRK,(1,1)),
// RECFM=FB,LRECL=80,DSORG=PO,DSNTYPE=LIBRARY
//SYSIN DD DATA,DLM='¬¬'
./ ADD NAME=MVSCMD
/* rexx */
/* issues MVS commands */
arg dd
call ReadInput
if result ^= 0 then exit result
call CountCmds
say "# of MVS commands to issue: "result
cartpfx = userid
cartcnt = 0
address tso
do k = 1 to inplines.0
"CONSOLE ACTIVATE NAME("userid"Z)"
'CONSPROF SOLDISP(NO) UNSOLDISP(NO) SOLNUM(1024) UNSOLNUM(1024)'
conscmd = inplines.k
'CONSOLE SYSCMD('conscmd') CART('conscart')'
gc = getmsg('R.','SOL',conscart,,5)
if gc = 4 then gc = getmsg('R.','EITHER',conscart,,5)
if gc = 0 then do
say " Issuing command #"k"..."
say " "conscmd
do i = 1 to r.0
conscmdn = r.mdbgtimh ""r.i
say conscmdn
end
if gc > 0 then say 'Unable to retrieve message - GETMSG RC:' gc
end
'CONSPROF SOLDISP(YES) UNSOLDISP(YES) SOLNUM(1000) UNSOLNUM(1000)'
'CONSOLE DEACTIVATE'
end
exit
/**/
CountCmds: procedure expose inplines.
j = 0
do i = 1 to inplines.0
if (left(inplines.i,2) ^= "&&") then j=j+1
end
return j
/**/
ReadInput: procedure expose dd inplines.
maxcc = 0
address mvs "EXECIO * DISKR "dd" (STEM INPLINES. FINIS"
if rc ^= 0 then do
say "RXLENZ01 ERROR READING INPUT FROM DD "dd
maxcc = 16
end
if inplines.0 = 0 then do
say "RXLENZ02 NO INPUT PROVIDED IN DD "dd
maxcc = 16
end
return maxcc
/**/
¬¬
//*
//STEP02 EXEC PGM=IKJEFT01,PARM='%MVSCMD MVSCMDS'
//SYSEXEC DD DSN=*.STEP01.SYSUT2,DISP=(OLD,DELETE)
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//MVSCMDS DD *
VARY SMS,VOLUME(SMC1G5),DISABLE,NEW
//
Regards,
Boris
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
