home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
TSO.ZIP
/
TSO.CMD
Wrap
OS/2 REXX Batch file
|
1991-06-05
|
3KB
|
146 lines
/* REXX Last update 05/03/91 - JEL
**
** This command will signon to TSO
** based upon input to the command. The password will be
** prompted for if not supplied.
*/
'@ECHO off'
/*
** Get command line input. Set trace if requested.
*/
parse upper arg trace .
if trace = 'TRACE' then do
trace ?r
parse upper arg trace parm1 parm2 parm3
end
else do
parse upper arg parm1 parm2 parm3
end
call program_initialization
if connect_session() then do
call logon_to_tso
end
if download = 'Y' then do
check_cnt = 60
string_txt = 'PRIMARY OPTION'
call check_for_string
call REXHLLAPI 'Sendkey', '6' '@E'
string_txt = 'TSO COMMAND'
call check_for_string
call REXHLLAPI 'Disconnect_ps'
say 'Calling Download Program - DL.CMD.'
call DL session_id telonsrc
call REXHLLAPI 'Connect_ps', session_id
call REXHLLAPI 'Sendkey', '@3'
end
call disconnect_session
exit
/*
** End of Mainline
*/
program_initialization:
/*
** Initialize variables, set boolean switches, strip leading
** and trailing blanks from input parms (if necessary) etc.
*/
/*
** load REXHLAPI.DLL external function if not already loaded
*/
if rxfuncquery('REXHLLAPI') then ,
call rxfuncadd 'REXHLLAPI','REXHLAPI', 'REXHLLAPI'
true = 1
false = 0
session_id = 'B'
logon_id = 'X04516'
password = strip(parm1)
download = strip(parm2)
telonsrc = strip(parm3)
if password = '' then do
say
say 'Enter password:'
pull password
end
return
logon_to_tso:
say
say 'Logging on to TSO...'
call REXHLLAPI 'Sendkey', 'TSO' logon_id '@E'
string_txt = 'TSO/E LOGON'
call check_for_string
if string_not_found then do
say 'Host not responding. Logon cancelled.'
return false
end
call REXHLLAPI 'Sendkey', password '@E@E@E'
string_txt = '$$DRVR'
check_cnt = 30
call check_for_string
call REXHLLAPI 'Sendkey', '@E'
say 'TSO Logon Completed.'
return true
connect_session:
if REXHLLAPI('Connect_ps', session_id) <> 0 then do
return false
end
return true
disconnect_session:
call REXHLLAPI 'Disconnect_ps'
return
check_for_string:
string_not_found = true
string_found = false
if datatype(search_pos) <> 'NUM' then do
search_pos = 1
end
if datatype(check_cnt) <> 'NUM' then do
check_cnt = 10
end
do cnt = 1 to check_cnt while string_not_found
if REXHLLAPI('Search_ps', string_txt, search_pos) <> 0 then do
string_not_found = false
string_found = true
end
else do
call REXHLLAPI 'Pause', 2
end
end
check_cnt = 10
search_pos = 1
if string_not_found then do
return false
end
return true