I do it all the time.  With catalog displays and some other system 
displays, I log the output daily to a dataset in batch. Some of the 
command displays are not able to be captured by the REXX TRAP command, but 
this works find for me. 

This works on TSO.  Other versions are for batch, inside other REXX 
commands etc.  Feel free to contact on or off list if you have questions. 

You need SDSF. 

HTH. 

 /* REXX */ 
 Parse Upper Arg command 
 /********************************************************************/ 
 lastupd = '09/28/2011'                    /* date of last update    */ 
 /********************************************************************/ 
 debug = 0 
 rc=isfcalls("on") 
 mycmd.0=1 
 mycmd.1=command 
 ISFCONS = userid() || "OC" 
 Address SDSF ISFSLASH "("mycmd.") (WAIT)" 
 l_cnt = 0 
 If (Debug = 1) Then Do 
   l_cnt = l_cnt + 1 
   l.l_cnt = "isfmsg is: "||isfmsg 
   l_cnt = l_cnt + 1 
   l.l_cnt = "isfmsg2.0 is: "||isfmsg2.0 
   If datatype(isfmsg2.0) = "NUM" then , 
     Do ix=1 to isfmsg2.0 
       l_cnt = l_cnt + 1 
       l.l_cnt = "isfmsg2."||ix||" is: "||isfmsg2.ix 
   End 
 End 
 If datatype(isfulog.0) = "NUM" Then Do 
   If isfulog.0 <> 0 Then Do 
     l_cnt = l_cnt + 1 
     l.l_cnt = substr(isfulog.1,1,43) 
     Do ix=1 to isfulog.0 
       ll = length(isfulog.ix) 
       qdata = substr(isfulog.ix,44,ll-43) 
       l_cnt = l_cnt + 1 
       l.l_cnt = qdata 
     End 
   End 
   Else Do 
     l_cnt = l_cnt + 1 
     l.l_cnt = "No command response available" 
   End 
 End 
 Else Do 
   l_cnt = l_cnt + 1 
   l.l_cnt = "Error in command reponse" 
 End 
 rc=isfcalls("OFF") 
 Call Write_Dataset 
 Exit 
 WRITE_DATASET: 
 CALL DSN_HANDLING 
 If (l_cnt = 0) Then 
  Do 
   l_cnt = l_cnt + 1 
   l.l_cnt = ' /*  no data produced  */' 
  End 
 l.0 = l_cnt 
 Address MVS "ExecIO "l_cnt" DiskW DSCMD (Finis Stem l.)" 
 l_cnt = 0 
 Address TSO "Free Fi(DSCMD)" 
 Address ISPEXEC "VIEW DATASET("dscmddsn")" 
 x = Outtrap('cmd.') 
 Address TSO "DELETE "dscmddsn 
 x = Outtrap('OFF') 
 Return 
 /*********************************************************************/
 /* DSN_HANDLING - Carry out processing for output dataset            */
 /*********************************************************************/
 DSN_HANDLING: 
 dsnc   = 1 
 dsname = "DSCMD.C" || dsnc 
 dsnstat = SysDsn(dsname) 
 Do While (dsnstat = 'OK') 
   dsnc   = dsnc + 1 
   dsname = "DSCMD.C" || dsnc 
   dsnstat = SysDsn(dsname) 
 End 
 Address TSO "Alloc Fi(DSCMD) Lrecl(80) Unit(TSOONLY)", 
       "Space(2,2) Cyl dataset("dsname")", 
       "Blksize(6160) Recfm(F,B) New Reuse Catalog Dsorg(PS)" 
 dscmddsn = dsname 
 Return 0 

Chip Grantham  |  Ameritas  |  Sr. IT Consultant | [email protected] 
5900 O Street, Lincoln NE 68510 | p: 402-467-7382 | c: 402-429-3579 | f: 
402-325-4030

 



Tim Brown <[email protected]> 
Sent by: IBM Mainframe Discussion List <[email protected]>
11/01/2011 05:51 AM
Please respond to
IBM Mainframe Discussion List <[email protected]>


To
[email protected]
cc

Subject
console command output






Is there a way in batch to issue a console command and direct the output 
to a file

 

Like d m

 

Or any other standard display command

 

Thanks,

 

Tim Brown
Systems Specialist - Project Leader
Central Hudson Gas & Electric
284 South Ave
Poughkeepsie, NY 12601
Email: [email protected] <<mailto:[email protected]>>
Phone: 845-486-5643
Fax: 845-486-5921
Cell: 845-235-4255

 


This message contains confidential information and is only for the 
intended recipient. If the reader of this message is not the intended 
recipient, or an employee or agent responsible for delivering this message 
to the intended recipient, please notify the sender immediately by 
replying to this note and deleting all copies and attachments. 

 




----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

*******
This message may contain confidential information intended only
for the use of the addressee(s) named above and may contain
information that is legally privileged. If you are not the
addressee, or the person responsible for delivering it to the
addressee, you are hereby notified that reading, disseminating,
distributing or copying this message is strictly prohibited.  If you
have received this message by mistake, please immediately notify
us by replying to the message and delete the original message
immediately thereafter.  Thank you.
*******


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to