z/OS JCL command /*VS command fails when issued in a proc

744 views Asked by At

I'm trying to execute a certain command ("VARY devaddr,OFFLINE") to run automatically during system startup. I can't find where the command should be placed. I tried setting the command in a proc, as follows:

//MYPROG PROC MODULE='IEFBR14'  
/*$VS,'V 0A92,OFFLINE'         
//DOIT   EXEC PGM=&MODULE      
//*  

If I issue a START MYPROG I always get an error:

IEFC452I MYPROG - JOB NOT RUN - JCL ERROR 181 $HASP396 MYPROG TERMINATED
IEE122I START COMMAND JCL ERROR

Yet if I remove the command ('/*$VS,...') from the proc, it starts and completes fine. Also, if I create a job instead of a proc, I can submit it and it completes successfully.

My whole purpose is to have this unit taken offline after every IPL, without operator intervention. Does anybody have experience embedding commands in JCL, or an alternative way to accomplish this?

After cshneid's answer, I have edited my proc as follows:

//MYPROG PROC                          
//TEST   COMMAND  'VARY  0A92,OFFLINE' 

And my console output now looks like:

S MYPROG                                                         
IRR812I PROFILE * (G) IN THE STARTED CLASS WAS USED 121          
        TO START MYPROG WITH JOBNAME MYPROG.                     
$HASP100 MYPROG   ON STCINRDR                                    
VARY  0A92,OFFLINE                                               
IEFC452I MYPROG - JOB NOT RUN - JCL ERROR 124                    
IEF281I 0A92 NOW OFFLINE                                         
$HASP396 MYPROG   TERMINATED                                     
IEE122I START COMMAND JCL ERROR                                  
IEA989I SLIP TRAP ID=X33E MATCHED.  JOBNAME=*UNAVAIL, ASID=0059. 

This seems to be the pattern no matter how I arrange the proc.

3

There are 3 answers

5
phunsoft On BEST ANSWER

There is a better way to have the system automatically run commands at initialization (IPL) time: Use the COMMNDxx Parmlib member. See z/OS MVS Initialization and Tuning Reference for details.

Create a COMMNDxx member in SYS1.PARMLIB (or in any of the PARMLIBs in the concatenation) and add the command there:

COM='V 0A92,OFFLINE'

You can place the command in the default member COMMND00 or in any COMMNDxx member and add the xx suffix to the list of command members to execute, i.e to the CMD=... parameter in the IEASYSxx member.

0
viejo On

I finally have it this time. I've simply added an EXEC statement after the COMMAND statement. It looks like this:

//MYPROG PROC                          
//TEST   COMMAND  'VARY  0A92,OFFLINE' 
//STEP1  EXEC     PGM=IEFBR14          

There are no errors now showing on the console when this proc is started:

S MYPROG                                                                
IRR812I PROFILE * (G) IN THE STARTED CLASS WAS USED 229                 
        TO START MYPROG WITH JOBNAME MYPROG.                            
$HASP100 MYPROG   ON STCINRDR                                           
VARY  0A92,OFFLINE                                                      
IEE303I 0A92     OFFLINE                                                
IEF695I START MYPROG   WITH JOBNAME MYPROG   IS ASSIGNED TO USER START1 
 , GROUP SYS1                                                           
$HASP373 MYPROG   STARTED                                               
IEF403I MYPROG - STARTED - TIME=13.44.01                                
IEF404I MYPROG - ENDED - TIME=13.44.01                                  
$HASP395 MYPROG   ENDED - RC=0000                                       
$HASP250 MYPROG PURGED -- (JOB KEY WAS D9BC2A80)                        

Thank you!

4
cschneid On

Confusingly, there are two ways to do this, and they have almost identical names. The not recommended way to do this is the JCL command statement. The recommended way to do this is with the COMMAND statement.

Be advised that the command will be issued at conversion time, before the job runs.

Edit (1) to add...

The documentation for both IEFC452I and IEE122I indicate you have a JCL error somewhere. Wild guess: job has no steps?