Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perform a checklist via Rexx

Status
Not open for further replies.

Zurdo

Technical User
Dec 23, 2009
8
BR
Hi,

I was wondering if I could get a REXX to perform a checklist, it is not much just issue the commands and save it in a dataset (I'll do that later, now I guess I should start getting a way to send the commands) I've get to this to send the commands, not sure if it will work. I have the authority to issue those commands on the system that I plan to use it, but I don't have access to the system.

Code:
/***REXX***/
"CONSOLE ACTIVATE"
"CONSOLE SYSCMD(d a,l)"
"CONSOLE SYSCMD($di)"
"CONSOLE SYSCMD(d t)"
"CONSOLE SYSCMD(d iplinfo)"
"CONSOLE SYSCMD(d u,tape,online,,99)"
"CONSOLE SYSCMD(d xcf)"
"CONSOLE SYSCMD($du,tp)"
"CONSOLE SYSCMD(*i q h)"
"CONSOLE SYSCMD(*s bdt,i,l=all)"
"CONSOLE SYSCMD(d r,r,tn)"
"CONSOLE DEACTIVATE"

I don't see why it wouldn't work of course that it will just issue the commands, I'm just wondering if this is the right way.
 
First, I would try what you have - perhaps with only one command to start with.
If that works then you are on your way.
Second, if it doesn't then come back here with the error(s).
You probably should set a default of address - if CONSOLE is a program that runs under TSO then use 'Address TSO'.
 
Ok, Tested and it works, even with all the commands it showed me the displays, now I got to work with GETMSG to save then into a dataset.

Which I'm not being able to use... any clue on how to use the GETMSG?
 
What you need is Appendix C of the TSO E Rexx Reference (IKJ4A330). This shows how to use CONSOLE and GETMSG. If you look at the reference for CONSOLE you will also see that you could rewrite your exec as:
'console activate'
address console
'mvs command'
:
:
'mvs command'
etc.
 
Ok, Thanks nclouston, I got that to work now, I was able to create the dataset, issue the displays, get the messages and send it via xmit to my e-mail, now my problem is how to get this working as a CLIST on AUTOMATION... but I'm working on that already.
 
CLIST? Ugh!! Try the Clist manual - sorry, but I do not have the number for it.
 

Hmmm.... I read that and said "CLIST must be an AUTOMATION-specific thing". Please don't tell me somebody out there is still writing in TSO/E CLIST.

Please....


Frank Clarke
--America's source for adverse opinions since 1943.
 
I must admit I haven't written a real CLIST for a lot of years, but from memory a CLIST runs authorised and a REXX doesn't. So there are (or at least used to be) some circumstances where if you need to call an authorised program it has to be done from a CLIST. Although I may be out of date on this, maybe someone can confirm or correct me?

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Nah, the CLIST that I meant is actually an automation tool as rexxhead said...
But it stopped working again, I got an error now, maybe someone can help me on this that is my code.

Code:
/***REXX***/                                                
/*DISPLAY TIME*/                                            
/*DATASET ALLOCATION FOR COMMANDS OUTPUT */                 
'ALLOC DA(TCE014.TESTE) F(TESTE) MOD REUSE'                 
"CONSOLE ACTIVATE"                                          
/*CHECKLIST COMMANDS VARIABLES*/                            
COMMAND = 'D IPLINFO'                                       
COMMAND2 = 'D T'                                            
COMMAND3 = 'D U,TAPE,ONLINE,,999'                           
COMMAND4 = 'D XCF'                                          
COMMAND5 = 'D R,L,TN'                                       
COMMAND6 = '$DLINE1-*'                                      
COMMAND7 = '$DA'                                            
/*COMMANDS EXECUTION */                                     
QUEUE '-----------------DISPLAY IPLINFO--------------------'
ADDRESS CONSOLE                               
INTERPRET '"'COMMAND'"'                       
CMD = GETMSG('MENSA.','SOL',,,2)              
ADDRESS TSO                                   
IF CMD = 0 THEN                               
DO I = 1 TO MENSA.0                           
QUEUE MENSA.I                                 
END                                           
ELSE SAY '****** COMMAND ERROR'               
QUEUE '-----------------DISPLAY TIME----------
ADDRESS CONSOLE                               
INTERPRET '"'COMMAND2'"'                      
CMD = GETMSG('MENSA.','SOL',,,2)              
ADDRESS TSO                                   
IF CMD = 0 THEN                               
DO I = 1 TO MENSA.0                           
QUEUE MENSA.I                                 
END                                         
ELSE SAY '****** COMMAND ERROR'             
QUEUE '-----------------DISPLAY TAPES ------
ADDRESS CONSOLE                             
INTERPRET '"'COMMAND3'"'                    
CMD = GETMSG('MENSA.','SOL',,,2)            
ADDRESS TSO                                 
IF CMD = 0 THEN                             
DO I = 1 TO MENSA.0                         
QUEUE MENSA.I                               
END                                         
ELSE SAY '****** COMMAND ERROR'             
QUEUE '-----------------DISPLAY SYSPLEX ----
ADDRESS CONSOLE                             
INTERPRET '"'COMMAND4'"'                    
CMD = GETMSG('MENSA.','SOL',,,2)            
ADDRESS TSO                                 
IF CMD = 0 THEN                             
DO I = 1 TO MENSA.0                         
QUEUE MENSA.I                               
END                                         
ELSE SAY '****** COMMAND ERROR'             
QUEUE '-----------------DISPLAY REPLIES ----
ADDRESS CONSOLE                             
INTERPRET '"'COMMAND5'"'                    
CMD = GETMSG('MENSA.','SOL',,,2)            
ADDRESS TSO                                 
IF CMD = 0 THEN                             
DO I = 1 TO MENSA.0                         
QUEUE MENSA.I                               
END                                         
ELSE SAY '****** COMMAND ERROR'             
QUEUE '-----------------DISPLAY JES LINES-------
ADDRESS CONSOLE                                 
INTERPRET '"'COMMAND6'"'                        
CMD = GETMSG('MENSA.','SOL',,,2)                
ADDRESS TSO                                     
IF CMD = 0 THEN                                 
DO I = 1 TO MENSA.0                             
QUEUE MENSA.I                                   
END                                             
ELSE SAY '****** COMMAND ERROR'                 
ADDRESS CONSOLE                                 
QUEUE '-----------------DISPLAY ACTIVE JOBS-----
INTERPRET '"'COMMAND7'"'                        
CMD = GETMSG('MENSA.','SOL',,,2)                
ADDRESS TSO                                     
IF CMD = 0 THEN                                 
DO I = 1 TO MENSA.0                               
QUEUE MENSA.I                                     
END                                               
ELSE SAY '****** COMMAND ERROR'                   
/*WRITE COMMAND OUTPUT ON DATASET TESTE */        
DO QUEUED()                                       
'EXECIO * DISKW TESTE ( FINIS'                    
END                                               
"CONSOLE DEACTIVATE"

For some reason (could not figure out why) the only commands that are actually getting written on the dataset are 'D T' and 'D U,TAPE,ONLINE,,99' they return just 1 line of output (and maybe that's why they work and the others don't)

Any clues?
 
Well, that's rather nasty, isn't it. Is there any reason you don't set the commands up as a stem variable and just loop through them? Suppose you had 200 commands, how big would your program be? Consider storing the commands on a separate file that you can just EXECIO in at the start.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Well Steve, not sure if I could understand what you said, but you are suggesting me to do like 1 loop of the program and then use all commands as a variable? because it is like 10 commands, so I don't think that creating a new file with the commands would help much, the loop idea can be a good one, the program will look smaller, will work on that, but anyways, any clue of why it is not writing down the commands into the dataset? I mean it always keep going the error message
'****** COMMAND ERROR'
instead of writting the command down.
 
This is a collapsed version of what you have:
/***REXX***/
/*DISPLAY TIME*/
/*DATASET ALLOCATION FOR commandS OUTPUT */
'ALLOC DA(TCE014.TESTE) F(TESTE) MOD REUSE'
"CONSOLE ACTIVATE"
/*CHECKLIST commandS VARIABLES*/
command.0 = 7
cOMMAND.1= 'D IPLINFO'
command.2 = 'D T'
command.3 = 'D U,TAPE,ONLINE,,999'
command.4 = 'D XCF'
command.5 = 'D R,L,TN'
command.6 = '$DLINE1-*'
command.7 = '$DA'
description.0 = 7
description.1 '-----------------DISPLAY IPLINFO--------------------'
description.2 '-----------------DISPLAY TIME----------
description.3 '-----------------DISPLAY TAPES ------
description.4 '-----------------DISPLAY SYSPLEX ----
description.5 '-----------------DISPLAY REPLIES ----
description.6 '-----------------DISPLAY JES LINES-------
description.7 '-----------------DISPLAY ACTIVE JOBS-----
/*commandS EXECUTION */
Do i = 1 To commands.0
ADDRESS CONSOLE
Queue description.i
command.i
CMD = GETMSG('MENSA.','SOL',,,2)
ADDRESS TSO
IF CMD = 0 THEN
DO I = 1 TO MENSA.0
QUEUE MENSA.I
End
ELSE SAY '****** command ERROR'
End
/*WRITE command OUTPUT ON DATASET TESTE */
DO QUEUED()
'EXECIO * DISKW TESTE ( FINIS'
END
"CONSOLE DEACTIVATE"
Exit

To implement Steve's idea of storing the commands externally all you have to do is replace the command.x initialisation lines to an EXECIO read '*' into stem command.

Which results are not being written - or is it all?
When writing it is a good idea to count the number of lines queued and explicitly state the number of lines EXECIO is to write - a record might have the hex for EOF in it and EXECIO will stop at that point unless you specify the full number of lines to write.

You could include TRACE 'R' or TRACE 'I' in your code to get a trace of activity out. You could also put a few SAYs in to display variable values in the sysprint (in batch) or terminal (foreground)
 

Oh, yeah....

I keep saying (and writing) NEVERNEVERNEVERNEVER use "EXECIO * DISKW...". There is ALWAYS enough information available to allow you to do either
"EXECIO" queued() "DISKW" or
"EXECIO" some_other_var "DISKW".

"EXECIO * DISKW" invites errors at the most inconvenient times and places.


Frank Clarke
--America's source for adverse opinions since 1943.
 
Ok, Got the collapsed version, I tried to do it yesterday but got nothing, on your coding I got an:
"Error running REXX, line 24: Bad arithmetic conversion"
Which is line DO I = 1 TO COMMANDS.0
but that is not what is bothering me now...

Now I got the rexx beign able to writte almost all the commands, actually all of then (that are not JES2 ones) are working fine... I got on another thread here that the GETMSG gets just 1 item of the display if we talking about JES2 Commands and I need all of the items recorded into the dataset I heard somewhere that as a resolution I could try issuing 2 GETMSG, the first one just to get the response queued and then create the 2nd one inside a loop where with the condition that if GETMSG worked ok, loop again if it did not, continue the program... I tried to make it work but was not able to I tried something like this
Code:
QUEUE '-----------------DISPLAY JES LINES----------------'
ADDRESS CONSOLE                                           
INTERPRET '"'VAR6'"'                                      
CMD = GETMSG('MENSA.','SOL',,,10)                         
ADDRESS TSO                                               
IF CMD = 0 THEN                                           
DO I = 1 TO MENSA.0                                       
QUEUE MENSA.I                                             
END                                                       
ELSE SAY 'ERROR'                                          
LOOP = GETMSG('TESTA.','SOL',,,10)                        
WHILE LOOP = 0 DO I = 1 TO TESTA.0                        
QUEUE TESTA.I
but the LOOP did not worked, I could try issuing the number of GETMSG equal of the number of LINES or INITS (which are the 2 most important commands, $Dline1-* and $di1-*) but the program in some of the systems that this shall be used in production will have like 1000 lines of GETMSG... so I guess that this loop will make it in a better way... well, I use the TRACE I on the system and if you guys want it i can post it here as well, the output dataset info is not confidential so if you want to check how it is beign written i can provide that too.

Collapsing the post:
My issue is with the Jes2 commands returning the response of the display as it was multiple displays, any clue on how to solve that problem with putting one getmsg for each item on the Jes2 command response?

and thanks for the tip REXXHEAD I changed the code from 'EXECIO * DISKW' to 'EXECIO' QUEUED() 'DISKW' 'TESTE (FINIS', did not saw anything different in a first view, but it is better to do an execio in somthing deffined instead of *...
;)
 
zurdo said:
"Error running REXX, line 24: Bad arithmetic conversion"
That's because you set up COMMAND.n variables, and then try to use COMMAND[red]S[/red].0; this gets treated as a literal and causes the bad conversion.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Will try fixing that later, anyone has any clue on how to make the loop for the GETMSG? I was able to do it, but it keeps looping at the same message, never goes out of LINE2 on the display, then I have to abort the rexx.
 
You are doing:

WHILE LOOP = 0....

Do you ever change the value of LOOP in the WHILE loop? It is not shown in your code snippet.
 
LOOP on the code is the GETMSG command, I think that if the getmsg tries to get a message and fail then the RC will not be 0, it will be -3 or -1 on this condition the LOOP will not be 0 and then it will continue processing the program... at least that is what I was thinking when I wrote that
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top