3

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.

viejo
  • 123
  • 1
  • 10
  • 1
    Here to explain why it didn’t work. /*$VS is a JES2 command (technically called JECL, Job Entry Control Lanuage). It is processed only by an internal reader owned by JES2. The started task reader (STCINRDR) is not a JES2 reader, so it doesn’t know JECL. That’s why the command fails. – zarchasmpgmr May 19 '21 at 20:06

3 Answers3

2

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.

phunsoft
  • 978
  • 1
  • 5
  • 15
  • I had placed this command in the COMMNDxx concatenation. However during IPL I got a message that IEA863I COM='V 0A92,OFFL SPECIFICATION INVALID IN COMMNDCI. Then I noticed that all the other commands in COMMNDxxx were either START or DUMPDS. So I decided to try converting the VARY to a proc. I guess COMMNDxx only allows a subset of commands? – viejo May 20 '21 at 14:29
  • The manual mentions only few restrictions. A `VARY` command should definitely work. How exactly did the line in the `COMMNDCI` member look like? – phunsoft May 20 '21 at 19:42
  • Well, building on your recommendation I created a new COMMNDxx member and added it to the CMD=(xx,yy,...) concatenation. The exact same statement that failed when added to the existing COMMNDCI behaved properly in my new COMMNDxx member. I now have exactly what I wanted, plus a new member for any further customization. So, thank you! – viejo May 22 '21 at 12:58
  • I still don't know why VARY failed when called from COMMNDCI. Only thing is, that member starts JES2, VLF, HZR, VTAM, DLF. I added VARY after those. Maybe it failed because JES2 was not yet active. By the time my new COMMNDxx gets activated JES2 would have enough traction to handle it? – viejo May 22 '21 at 13:10
  • `VARY` is an MVS command. It doesn't need JESx to be active. The commands in all the `COMMNDxx` members are issued one after the other; there is no dependency. Further debuggin on your system would be needed to find out what was going on. – phunsoft May 22 '21 at 18:06
1

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?

cschneid
  • 9,037
  • 1
  • 28
  • 34
  • Ok, I've switched to using COMMAND. This actually works, but I'm still getting that pesky IEFC452I error. My proc is now //MYPROG PROC //TEST COMMAND 'VARY 0A92,OFFLINE' – viejo May 19 '21 at 17:25
  • and here is the whole output. You can see that the COMMAND worked and also did not require operator intervention (yay). But it generated errors and always triggers the 33E slip trap: – viejo May 19 '21 at 17:25
  • [I've put the new proc and console output into my original question.] – viejo May 19 '21 at 17:37
  • Yep, I think you're correct, job had no steps. Adding the EXEC statement fixed it. – viejo May 20 '21 at 14:56
0

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!

viejo
  • 123
  • 1
  • 10