/* REXX -------------------------------- start of block comment ------------ here goes your description. don't close the comment in this part, instead use a separate line to end it (see below) ---------------------------------------- End of block comment -------------*/ parameter1 = arg(1) if parameter1 == "" then do say "Error: Parameter 1 is missing." call DisplayHelp exit 1 end exit /*============================================================================ Begin of Subroiutine Section ============================================================================*/ /*---------------------------------------------------------------------------- Display the first block comment found in the script as the help text ----------------------------------------------------------------------------*/ DisplayHelp: procedure parse source . . PgmName . /*---------------------------------------------------------------------------- Optionally, write some heading lines, if you find these helpful ----------------------------------------------------------------------------*/ say say say 'Help for rexx' PgmName say '==============' || left( "", length( PgmName ), "=" ) say /*----------------------------------------------------------------------------- Search for the beginning of the description at the start of the REXX, which must start within the (arbitrarily chosen) first ten lines. ----------------------------------------------------------------------------*/ do ii = 1 to 10 if pos( '/*', sourceLine( ii ) ) > 0 then leave end /*---------------------------------------------------------------------------- Don't continue if start of comment not found in the given range ----------------------------------------------------------------------------*/ if ii > 10 then do say "Unexpected error in help: Help text not found." return end /*---------------------------------------------------------------------------- Start displaying source lines as help text until the end of comment is found. Note: The line ending the block comment is NOT shown. ----------------------------------------------------------------------------*/ do ii = ii + 1 until pos( '*/', sourceline( ii ) ) > 0 say strip( sourceline( ii ), 'T', ' ') end say return /*---------------------------------------------------------------------------- End of subroutine DisplayHelp ----------------------------------------------------------------------------*/ /*============================================================================ End of Program ============================================================================*/