Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Console command output in REXX.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Wed Nov 02, 2011 12:13 pm    Post subject: Console command output in REXX.
Reply with quote

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
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Nov 02, 2011 2:15 pm    Post subject:
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Wed Nov 02, 2011 2:27 pm    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Wed Nov 02, 2011 2:45 pm    Post subject: Reply to: Console command output in REXX.
Reply with quote

You are lucky icon_biggrin.gif
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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Wed Nov 02, 2011 2:55 pm    Post subject:
Reply with quote

Thanks Enrico,
Code looks solid, let me try it out.

Regards,
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Wed Nov 02, 2011 3:07 pm    Post subject:
Reply with quote

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.

sterb050.gif

Anyway many thanks for the complete code, I will try to work things out.

Regards,
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Wed Nov 02, 2011 3:18 pm    Post subject: Reply to: Console command output in REXX.
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Wed Nov 02, 2011 3:24 pm    Post subject: Reply to: Console command output in REXX.
Reply with quote

follow on ...
look here
http://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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Wed Nov 02, 2011 3:31 pm    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Wed Nov 02, 2011 3:40 pm    Post subject: Reply to: Console command output in REXX.
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Wed Nov 02, 2011 3:58 pm    Post subject:
Reply with quote

Could not ask for more :-)
Works great.!!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us