/****************************** REXX ********************************/ /* Bruce Albert Woodworth SETREXX April 26, 2003 */ /* */ /* This REXX EXEC returns a REXX help library. This EXEC is meant */ /* to be called from within another EXEC. */ /* */ /* Sample: */ /* rexx_lib = setrexx(init) */ /* */ /**************************************************************************/ trace off parse upper arg user_init user_info = "@WCS001.BAW.USERINFO" id = userid() abort_sw = "N" user_eof = "N" if user_init = ? then do say "/****************************** REXX ********************************/" say "/* Bruce Albert Woodworth SETREXX April 26, 2003 */" say "/* */" say "/* This REXX EXEC returns a REXX help library. This EXEC is meant */" say "/* to be called from within another EXEC. */" say "/* */" say "/* Sample: */" say "/* rexx_lib = setrexx(init) */" say "/* */" say "/**************************************************************************/" exit end else do dsni = "'" ³³ user_info ³³ "'" ds_dsni = "dataset(" ³³ dsni ³³ ")" goodlib = listdsi(dsni) if goodlib = 0 then call check_table else do say "Error, can't find" dsni "aborting job!" rexx_lib = "N" end return(rexx_lib) end check_table: "allocate ddname(userfile)" ds_dsni "old" call read_user_table do while chk_com = "/*" & abort_sw = "N" & user_eof = "N" call read_user_table end if abort_sw = "N" & rexx_lib = " " then do error_msg = "Your REXX library is not in the user file" dsni ³³ "." call create_new_help_name end else call chk_rexx_lib_name "execio 0 diskr userfile (finis" "free ddname(userfile)" return chk_rexx_lib_name: rexx_chk = "'" ³³ rexx_lib ³³ "'" goodlib = listdsi(rexx_chk) if goodlib = 0 then lib_chk = "OK" else do error_msg = "Your REXX library (" ³³ rexx_lib ³³ ") is not valid!" call create_new_help_name end return create_new_help_name: say error_msg call get_lib_from_user do while lib_chk = "BAD" call get_lib_from_user end push rexx_lib "execio 1 diskw userfile" return get_lib_from_user: default_lib = id ³³ "." ³³ user_init ³³ ".REXX" say "Please type in your REXX Library DSN" say " or null (enter without typing) to use" default_lib parse upper pull rexx_lib if rexx_lib = "" then rexx_lib = default_lib rexx_chk = "'" ³³ rexx_lib ³³ "'" goodlib = listdsi(rexx_chk) if goodlib = 0 then lib_chk = "OK" else do say "Can't find" rexx_chk say "Ignore error? (Y/N)" parse upper pull response if response = "Y" then lib_chk = "OK" else lib_chk = "BAD" end return read_user_table: "execio 1 diskru userfile" if rc = 2 then user_eof = "Y" else if rc > 0 then do say "Bad rc on" dsni "aborting job." abort_sw = "Y" end else do parse pull user_record chk_com = substr(user_record,1,2) rexx_lib = space(user_record) end return