/******************************* REXX ************************************/ /* Bruce A. Woodworth DISPHELP November 8, 2000 */ /* */ /* This EXEC prints the REXX comment at the beginning of a REXX EXEC. */ /* */ /* It can be called from within another exec so that the comment at */ /* the beginning of a REXX exec can be used also as a help file. */ /* */ /* Call this EXEC with 3 parms, one which is the name of a REXX EXEC, a */ /* second optional parm which is a "T" which indicates that we want */ /* translation to occur ( so far just "iii" to initials and "$idid" to */ /* userid), a third parm which will be the initials, and a fourth parm */ /* of logon_id. */ /* */ /* As a matter of fact, this exec uses itself to display this help */ /* information. */ /* */ /**/ /* */ /* Syntax: */ /* DISPHELP exec_name {T} initials logon_id */ /* */ /* Ex: */ /* DISPHELP PANGET T BAW CPI1ED15 */ /* */ /* Where: */ /* PANGET - the EXEC within which this is coded. */ /* T - indicates that translation within the comment is */ /* desired. */ /* BAW - the initials to be substituted for iii within the */ /* comment. */ /* CPI1ED15 - the logon id to be substituted for $idid within the */ /* comment. */ /* */ /**************************************************************************/ /* Bruce A. Woodworth Logon id translation added. July 9, 2001 */ /* Bruce A. Woodworth Initials translation added. August 18, 2002 */ /**************************************************************************/ parse upper arg rexx_exec_name translate_sw init logon_id id_size = length(logon_id) init = setinit() current_id = userid() if rexx_exec_name = "?" then 'disphelp' setrexx(init) ³³ '(disphelp)' else call display_help_info exit display_help_info: clrscrn ds_help = "dataset('" ³³ rexx_exec_name ³³ "')" "allocate ddname(inhelp)" ds_help "shr reu" "execio * diskr inhelp (stem helper. finis" max_help = helper.0 "free ddname(inhelp)" cnt = 1 end_check = " " end_comment = "N" disp_line = substr(helper.cnt,1,79) do while end_comment = "N" & cnt < max_help if end_chk = "/**/" then do say " " say "Hit enter key to continue..." parse pull clrscrn end else do if translate_sw = 'T' then call chk_mod say disp_line end if end_chk = "/***" then end_comment = "Y" else do cnt = cnt + 1 end_chk = substr(helper.cnt,1,4) disp_line = substr(helper.cnt,1,79) end end drop helper. return chk_mod: string_loc = index(disp_line,"iii") do while string_loc <> 0 call modify_init string_loc = index(disp_line,"iii") end string_loc = index(disp_line,"$idid") do while string_loc <> 0 call modify_logon_id string_loc = index(disp_line,"$idid") end return modify_init: one_size = string_loc - 1 first_piece = substr(disp_line,1,one_size) second_piece = init one_size = 79 - (string_loc + 2) new_spot = string_loc + 3 third_piece = substr(disp_line,new_spot,one_size) disp_line = first_piece ³³ second_piece ³³ third_piece return modify_logon_id: one_size = string_loc - 1 first_piece = substr(disp_line,1,one_size) second_piece = logon_id call create_normal_third_piece if id_size > 5 then call shrink_third_piece disp_line = first_piece ³³ second_piece ³³ third_piece return shrink_third_piece: size_dif = id_size - 5 third_size = length(third_piece) work_line = third_piece end_com_loc = index(work_line,"*/") if end_com_loc > 3 then do temp1_size = end_com_loc - 3 temp1_piece1 = substr(work_line,1,temp1_size) temp1_size = third_size - (end_com_loc - 1) temp1_piece2 = substr(work_line,end_com_loc,temp1_size) third_piece = temp1_piece1 ³³ temp1_piece2 end return create_normal_third_piece: one_size = 79 - (string_loc + 4) new_spot = string_loc + 5 third_piece = substr(disp_line,new_spot,one_size) return