>Subject: Fw: JES2 displays captured via batch
>>
>Kenneth Klein
>----- Forwarded by Kenneth Klein/T00/TMMNA on 03/15/2012 08:37 AM -----

>Kenneth Klein/T00/TMMNA
>03/15/2012 08:34 AM

>To
>IBM Mainframe Discussion List <IBM-MAIN@bama.ua.edu>
>cc
>
>Subject
>Re: JES2 displays captured via batch

/<Snippage>

I solve this problem by getting READ access to the Console profile in RACF 
Class TSOAUTH.
Then you can establish an interactive console session as seen in the Rexx 
exec below, issue the command,
and write the results to a dataset.  This exec creates and displays a 
temporary file
with Library management calls but that's easily changed to create a 
permanent file in batch JCL.

/* REXX -------------------------------------------------------------*/ 
/* trace i?  */ 
call Initialize 
call issue_console_cmd cmd1 
call endit 
exit(0) 
/*--------------------------------------------------------------*/ 
/* This paragraph issues commands to the console and stores the */ 
/* response in stem variable getmsg.                            */ 
/*--------------------------------------------------------------*/ 
issue_console_cmd: 
arg command 
cartoken='JIMH' 
address tso 'console name('cartoken')', 
    ' syscmd('command') cart('cartoken')' 
if RC = 56 then do 
                  address console 'deactivate' cartoken 
                  Say 'Console Interface Error = 'RC 
                  say 'Terminating.' 
                  exit(8) 
                  return 
                end 
DO while fc ^= 0 
  fc = GETMSG('getmsg.','SOL',carToken,,20) 
  call Process_What_Returned 
END 
address console 'deactivate' cartoken 
return 
/*--------------------------------------------------------------*/ 
/* This paragraph issues initializes variables required by this */ 
/* exec.                                                        */ 
/*--------------------------------------------------------------*/ 
Initialize: 
call Allocate_Dsn 
cmd1 = "$DQ" 
return 
Process_What_Returned: 
  Do i = 1 to getmsg.0 
    queue getmsg.i 
  End 
Return 
/*--------------------------------------------------------------*/ 
/* Allocate_Dsn: This function allocates a temp file for use by */ 
/*               our happy little exec.                         */ 
/*--------------------------------------------------------------*/ 
Allocate_Dsn: 
cmd_dd1="D"random() 
"ALLOC F("cmd_dd1") REUSE UNIT(VIO) SPACE(1 1) CYLINDER", 
"DSORG(PS) RECFM(F B) LRECL(80)" 
Return 
Endit: 
  "EXECIO" Queued() "DISKW "CMD_dd1" (fini " 
   address ISPEXEC "LMINIT DATAID(DATAID) DDNAME("cmd_dd1")" 
   address ISPEXEC "VIEW DATAID("dataid")" 
   address ISPEXEC "LMFREE DATAID("dataid")" 
   "FREE F("cmd_dd1")" 
return  
 





Jim Holloway - MetLife

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN

Reply via email to