View previous topic :: View next topic
|
Author |
Message |
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hi,
I am trying capture the output of the console command
/D U,TAPE,ONLINE,,255 - (display tape drives list)
in a dataset using REXX for processing.
I tried the below program hoping that the output of the command would display on the screen, but no output is displayed on the screen. Could you please let me know what is wrong or an alternative solution,
Code: |
/*REXX*/
ADDRESS TSO
'ALLOC FI(INTRDR) WRITER(INTRDR) SYSOUT REUSE'
LIST.1 = '/*D U,TAPE,ONLINE,,255'
LIST.0 = 1
'EXECIO * DISKW INTRDR (FINIS STEM LIST.'
SAY ' RC ' RC
'FREE FI(INTRDR)'
EXIT |
Thanks & Regards, |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Methinks that the output will be displayed on the system log, so you might have to invoke SDSF >> LOG to find the output |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Expat, thanks for your thoughts.
When the /D U,TAPE,ONLINE,,255
command was issued on SDSF, the output was available on ULOG.
Is there anyway we can route it into a dataset? or any other method to get the list of all tape drives and the current status of FREE/ALLOCATED,TYPE,UNIT NAME. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
You are lucky
just found in my tools chest
Code: |
****** ***************************** Top of Data ******************************
000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000002 /* */
000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000004 Trace "O"
000005 Parse Source _sys _how _cmd .
000006 args = "d u,tape,online"
000007 cart = "OPER0001"
000008 _msg = msg("OFF")
000009 zrc = $tsoex("CONSOLE DEACTIVATE ")
000010 zrc = $tsoex("CONSPROF SOLDISP(NO) SOLNUM(9999)" )
000011 zrc = $tsoex("CONSOLE ACTIVATE")
000012 if zrc = 0 then do
000013 zrc = $tsoex("CONSOLE SYSCMD("args") CART("cart") ")
000014 if zrc = 0 then do
000015 zrc = getmsg("console.",,cart,,120)
000016 end
000017 zrc = $tsoex("CONSOLE DEACTIVATE ")
000018 end
000019 do i = 1 to console.0
000020 say i console.i
000021 end
000022 _msg = msg(_msg)
000023 exit
000024
000025 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000026 $tsoex:
000027 tso_0tr = trace("O")
000028 Address TSO arg(1)
000029 tso_0rc = rc
000030 trace value(tso_0tr)
000031 return tso_0rc
000032
000033 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000034 $ispex:
000035 isp_tr = trace("O")
000036 Address ISPEXEC arg(1)
000037 isp_rc = rc
000038 trace value(isp_tr)
000039 return isp_rc
000040 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000041 $isred:
000042 isr_tr = trace("O")
000043 Address ISREDIT arg(1)
000044 isr_rc = rc
000045 trace value(isr_tr)
000046 return isr_rc
000047
****** **************************** Bottom of Data **************************** |
when run it will return
Code: |
1 IEE457I 11.13.17 UNIT STATUS 670
2 UNIT TYPE STATUS VOLSER VOLSTATE
3 0580 349S O-NRD-R /REMOV
4 0581 349S O-NRD-R /REMOV
5 0582 349S O-NRD-R /REMOV
6 0583 349S O-NRD-R /REMOV
READY
|
since the result of the command is in the stem You can do anything You want with it |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Thanks Enrico,
Code looks solid, let me try it out.
Regards, |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Code: |
IKJ55307I THE CONSOLE COMMAND HAS TERMINATED.+
IKJ55307I A CONSOLE SESSION IS NOT ACTIVE.
IKJ55353I THE CONSPROF COMMAND HAS TERMINATED.+
IKJ55353I USER WELLS DOES NOT HAVE CONSOLE COMMAND AUTHORITY. |
Anyway many thanks for the complete code, I will try to work things out.
Regards, |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
IKJ55353I USER WELLS DOES NOT HAVE CONSOLE COMMAND AUTHORITY. |
that' s the issue,
( it works for me because I have CONSOLE authority , I forgot to tell about it )
an alternative might be to used the rexx sdsf interface..
I' ll give it a shot in a while and keep You posted |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
follow on ...
look here
www.redbooks.ibm.com/abstracts/sg247419.html
download the additional material
and look at the @SYSCMD.rex
everybody dealing with SDSF should learn by heart the content of this redbook
the auxiliary material covers about 98% of the requirement for which a solution is asked around here |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Thanks for the link,
I think i have some starting point with partially working code below, let me check the pdf doc.
Code: |
/*REXX*/
ADDRESS TSO
"ALLOC F(ISFIN) TRACKS SPACE(1) REU"
"ALLOC F(ISFOUT) NEW DELETE REU " ,
"TRACKS SPACE(100,100) LRECL(133) RECFM(F,B,A) DSORG(PS)"
"ALLOC F(TEMPPRT) DA('WELLS.SORTIN') SHR"
QUEUE "/D U,TAPE,ONLINE,,255"
QUEUE "EXIT"
"EXECIO" QUEUED()" DISKW ISFIN (FINIS"
ADDRESS ISPEXEC "SELECT PGM(ISFAFD) PARM('++32,255)" /* INVOKE SDSF */
SAY 'RC = ' RC
"FREE DD(ISFIN ISFOUT TEMPPRT)"
EXIT |
Regards, |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the road You are following is the most complicated one
try this one
Code: |
EDIT ENRICO.ISPF.EXEC(ISFT05) - 01.02 Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 /*REXX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000002 /* */
000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000004 Trace "O"
000005 Parse Source _sys _how _cmd .
000006 parse arg args
000007
000008 debug = 1
000009
000010 IsfRC = isfcalls("ON")
000011 if IsfRC ¬= 0 then do
000012 say "isfcalls RC" IsfRC
000013 exit
000014 end
000015
000016 cmd = "/D U,TAPE,ONLINE"
000017 Address SDSF "isfexec '" || cmd || "' "
000018 if RC ¬= 0 then do
000019 say "isfexec RC" RC
000020 say isfmsg
000021 do im = 1 to isfmsg2.0
000022 say isfmsg2.im
000023 end
000024 exit
000025 end
000026
000027 do il = 1 to isfulog.0
000028 say right(il,1) isfulog.il
000029 end
000030 call isfcalls "OFF"
000031 exit
****** **************************** Bottom of Data ****************************
|
quick and dirty as PROOF OF CONCEPT,
should not take too much to enhance with the appropriate error handling |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Could not ask for more :-)
Works great.!! |
|
Back to top |
|
|
|