View previous topic :: View next topic
|
Author |
Message |
Ashish Mohan Sharma
New User
Joined: 30 Sep 2008 Posts: 22 Location: Pune
|
|
|
|
Rexx Code is :
y = msg('on')
x = outtrap('listcdsn.')
"listc lvl('"lis1"')"
"listc lvl('"lis2"')"
x = outtrap('off')
y = msg('off')
Lis1 and Lis2 are EPF.*.M04 and EPF.*.M05 respectively
Thanks in Advance |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
This rexx will execute 2 TSO commands and place the result in a stem variable named "listcdsn."
The 2 commands are:
Code: |
LISTCAT LVL('EPF.*.M04')
LISTCAT LVL('EPF.*.M05') |
I advise you to execute these commands by yourself to see what the output is.
listcdsn.0 will contain the number of lines in the stem var,
listcdsn.1 to listcdsn.x will contain the output of the commands
(where x is equal to the value of listcdsn.0)
When learning rexx, you should always keep (at least) these 2 books open:
TSO/E Command Reference
REXX Language Reference |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Ashish,
In addition to Marso's reply
MSG is to display/to stop display the messages when the macro runs depending on the value (on or off).
Quote: |
x = outtrap('listcdsn.') |
OUTTRAP is for trapping the displayed output messages into a stem variable. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Why did you not try it yourself before posting ? |
|
Back to top |
|
|
Ashish Mohan Sharma
New User
Joined: 30 Sep 2008 Posts: 22 Location: Pune
|
|
|
|
Hi Expat,
I dont have authority to run it. I have to decipher the code and document it.
Hi All
Thanks for your reply . It really worked. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Ashish,
Quote: |
I dont have authority to run it. |
Agreed. But you can code a new EXEC changing the dataset names and test it. That is the best way to learn |
|
Back to top |
|
|
Ashish Mohan Sharma
New User
Joined: 30 Sep 2008 Posts: 22 Location: Pune
|
|
|
|
Aaru,
Agreed..... But the problem is this that I have only the view access to the production datasets. And cannot run TSO commands or run jobs.. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Generally speaking, a TSO command encountering a problem will display a message and terminate with a non-zero return code.
For example:
With MSG('ON'), the command "LISTC LVL(EPF.*.M12)" will write 4 lines with messages like "ENTRY EPF.*.M12. NOT FOUND" and return a RC of 4.
With MSG('OFF'), you will have only the RC of 4.
If OUTTRAP is active, the 4 lines will be added to the stem variable or nothing will be added, according to MSG setting.
As you see, you have different ways to get the same result, and you choose which way to use depending on your needs.
Also, it is considered good behavior to "leave the room in the same state as you found it".
To do this, use the following:
Code: |
msgstat = MSG('OFF') /* set msg to off */
. . . /* do here what you need to do */
Call MSG(msgstat) /* restore msg to original state */ |
|
|
Back to top |
|
|
|