!++ ! Define a language for DCL command procedures ! Based on file from Frank Nagy ! ! Original Author: Frank Nagy (Fermi Labs) ! Modifications by: Dave Stevens (Stevens Institute of Technology) ! ! Description: ! LSE definition for the DCL programming language ! ! Creation Date: ! ????? Who knows when Wizards create their spells ! ! Modification Date: ! 12-October-1990 ! !-- ! ! First define the language ! DEFINE LANGUAGE DCL - /COMMENT=( - NOFIXED, - NOLINE, - TRAILING=("$ !", "$", "$ !+", "$ !-")) - /CAPABILITIES=NODIAGNOSTICS - /EXPAND_CASE=AS_IS - /FILE_TYPES=(.COM,.JOB) - /HELP_LIBRARY=HELPLIB - /IDENTIFIER_CHARACTERS= - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%$_0123456789" - /LEFT_MARGIN=CONTEXT_DEPENDENT - /OPT=("[~","~]") - /OPTL=("[~","~]...") - /PUNCTUATION_CHARACTERS="',;()[]" - /QUOTED_ITEM=(QUOTES="'") - /REQ=("{~","~}") - /REQL=("{~","~}...") - /RIGHT_MARGIN=132 - /TAB_INCREMENT=4 - /VERSION="V1.1-0" - /INITIAL_STRING = "{~DCL_Template~}" - /WRAP ! ! Create default Template DCL procedure ! DEFINE PLACEHOLDER DCL_TEMPLATE - /LANGUAGE = DCL - /TYPE = NONTERMINAL - /DESCRIPTION = "DCL Command Procedure Template format" "[~dcl_header~]" "$ !" "$ ! Define Error and Control Y exit error conditions" "$ !" "$ ON ERROR THEN GOTO JOB_ERROR" "$ ON CONTROL_Y THEN GOTO JOB_ABORT" "$ !" "$ ! {~dcl_text~}" "$ !" "$ {~dcl_content~}" "$" "$ !+" "$ !" "$ ! Job Error and Aborting exit locations" "$ !" "$ !--" "$JOB_ABORT:" "$JOB_ERROR:" "$ EXIT $STATUS" "$" END DEFINE DEFINE PLACEHOLDER DCL_HEADER - /LANGUAGE = DCL /TYPE = NONTERMINAL - /DESCRIPTION = "Header information for Command Procedure" "$ !++" "$ !" "$ ! DESCRIPTION:" "$ ! {~dcl_description~}" "$ !" "$ ! AUTHOR:" "$ ! {~dcl_author~}" "$ !" "$ ! CREATION DATE:" "$ ! {~dcl_creation~}" "$ !" "$ ! USAGE:" "$ ! {~dcl_usage~}" "$ !" "$ !--" END DEFINE ! ! Place Holder explanations for the Header information ! DEFINE PLACEHOLDER DCL_DESCRIPTION - /LANGUAGE = DCL /TYPE = TERMINAL - /DUPLICATION = VERTICAL - /DESCRIPTION = "Text explaining what the procedure is for" "Explanation of what this procedure is going to do" END DEFINE DEFINE PLACEHOLDER DCL_AUTHOR - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Name of the DCL Procedures Author" "Enter the name of the person writing this procedure" END DEFINE DEFINE PLACEHOLDER DCL_CREATION - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Creation date of the procedure" "Enter Creation date of this procedure" END DEFINE DEFINE PLACEHOLDER DCL_USAGE - /LANGUAGE = DCL /TYPE = TERMINAL - /DUPLICATION = VERTICAL - /DESCRIPTION = "DCL usage statements" "Enter text explaining how to run this procedure" END DEFINE ! ! Place Holders for DCL expansions ! DEFINE PLACEHOLDER DCL_SYMBOL - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "DCL Symbol text" "Enter the DCL symbol that you are creating" END DEFINE DEFINE PLACEHOLDER DCL_TEXT - /LANGUAGE = DCL /TYPE = TERMINAL - /DUPLICATION = VERTICAL - /DESCRIPTION = "ASCII text string" "Enter an explanation consisting of ASCII text" END DEFINE DEFINE PLACEHOLDER DCL_CONTENT - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Body of the DCL procedure" "Now enter the body of the Command Procedure" END DEFINE DEFINE PLACEHOLDER FULL_IF_STATEMENT - /LANGUAGE = DCL /TYPE = NONTERMINAL - /DESCRIPTION = "DCL If Then Else statement" "IF {~dcl_text~} {~dcl_evaluator~} {~dcl_text~}" " THEN" " {~dcl_content~}" "[~ELSE_clause~]" " ENDIF" END DEFINE DEFINE PLACEHOLDER NORMAL_IF_STATEMENT - /LANGUAGE = DCL /TYPE = NONTERMINAL - /DESCRIPTION = "Normal DCL If statement" "IF {~dcl_text~} {~dcl_evaluator~} {~dcl_text~} THEN {~dcl_text~}" END DEFINE DEFINE PLACEHOLDER DCL_EVALUATOR - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "DCL evaluation symbol" "Enter appropriate symbol .EQS. .NES. .EQ. .AND. etc" END DEFINE DEFINE PLACEHOLDER ELSE_CLAUSE - /LANGUAGE = DCL /TYPE = NONTERMINAL - /DESCRIPTION = "DCL ELSE clause for an IF statement" " ELSE" " {~dcl_content~}" END DEFINE DEFINE PLACEHOLDER SUBROUTINE_NAME - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "DCL Subroutine Name" "Enter the name of the DCL Subroutine you are creating" END DEFINE ! ! Placeholders for the LEXICAL functions ! DEFINE PLACEHOLDER LEX_WITH_RETURN_VALUE - /LANGUAGE = DCL /TYPE = NONTERMINAL - /DESCRIPTION = "Determines if Lexical is used with a return value" "{~dcl_symbol~} = " END DEFINE DEFINE PLACEHOLDER INPUT_TIME - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Specify Input time in standard Format" "Enter Input time to be used (use standard VMS Time formats)" END DEFINE DEFINE PLACEHOLDER OUTPUT_TIME - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Specify output time format" "Specify output time format, ABSOLUTE, COMPARISON, DELTA" END DEFINE DEFINE PLACEHOLDER FIELD - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Which option field is to be used in Lexical function" "Specify FIELD desired, see help on lexical for valid entries" END DEFINE DEFINE PLACEHOLDER OFFSET - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Offset to first character of string to be extracted" "Specify offset to first character in string to be extracted" END DEFINE DEFINE PLACEHOLDER LENGTH - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Length of the string you want" "Specify the length of the string you are manipulating" END DEFINE DEFINE PLACEHOLDER SOURCE_STRING - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "DCL Symbol that holds the string you are manipulating" "DCL Symbol that holds the string you are manipulating" END DEFINE DEFINE PLACEHOLDER LEX_ITEM - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Item code to be used" "Specify the proper Item Code, consult DCL Lexical for valid Item codes" END DEFINE DEFINE PLACEHOLDER LNM_TABLE - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Logical name table to be searched" "Enter Logical name table to be searched" END DEFINE DEFINE PLACEHOLDER LNM_INDEX - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Equivelence name to be returned" "Equivelence name to be returned, defaults to ZERO" END DEFINE DEFINE PLACEHOLDER LNM_MODE - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Access mode of the logical name" "Enter access mode of logical name to be searched for" END DEFINE DEFINE PLACEHOLDER LNM_CASE - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Determines if case sensative translation is performed" "Determines if case sensative translation is performed" END DEFINE DEFINE PLACEHOLDER EDIT_LIST - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "What editing functions are desired" "Enter Edit functions desired, consult HELP for valid inputs" END DEFINE DEFINE PLACEHOLDER INPUT_LOGICAL - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Logical name to be manipulated" "Enter the logical name to be manipulated" END DEFINE DEFINE PLACEHOLDER VERIFY_STATE - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Verification state to be used in Procedure" "Please enter verification state for procedure to run in" END DEFINE DEFINE PLACEHOLDER ELEMENT_NUMBER - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Which element of a list to extract" "Specify Number of the element to be extracted" END DEFINE DEFINE PLACEHOLDER ELEMENT_DELIMITER - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Character that delimits elements in a list" "Specify element delimiter for the list" END DEFINE DEFINE PLACEHOLDER CONTROL_STRING - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "FAO control string" "Enter FAO control string that will control the operation" END DEFINE DEFINE PLACEHOLDER ARGUEMENT_LIST - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "List of arguements to be inserted" "Enter the arguements for this function, consult HELP for valid arguements" END DEFINE DEFINE PLACEHOLDER FILE_SPECIFICATION - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "File specification" "Please enter the file specification of the file to be manipulated" END DEFINE DEFINE PLACEHOLDER DEVICE_NAME - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Name of device to be specified" "Device name to be manipulated" END DEFINE DEFINE PLACEHOLDER PROCESS_ID - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Process Identification number" "Process identification number to be manipulated" END DEFINE DEFINE PLACEHOLDER NODE_NAME - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "DECnet Node Name" "DECnet node name to be manipulated" END DEFINE DEFINE PLACEHOLDER NUMERIC_EXPRESSION - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Numerical expression" "Please enter Number (as text) to be converted to an Integer" END DEFINE DEFINE PLACEHOLDER STATUS_CODE - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "DCL Status code" "Enter a valid DCL status code" END DEFINE DEFINE PLACEHOLDER CONTEXT_SYMBOL - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "DCL context symbol" "Enter Context symbol" END DEFINE DEFINE PLACEHOLDER PRIVILEGE_LIST - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "List of set privileges" "Enter list of privileges to be checked" END DEFINE DEFINE PLACEHOLDER STREAM_ID - /LANGUAGE = DCL /TYPE = TERMINAL - /DESCRIPTION = "Context variable for Searches" "Enter optional context variable for the search" END DEFINE ! ! Define a few instant expandable Tokens ! DEFINE TOKEN HEADER - /LANGUAGE = DCL - /DESCRIPTION = "DCL Header Comment Section" "!++" "!" "! DESCRIPTION:" "! {~dcl_description~}" "!" "! AUTHOR:" "! {~dcl_author~}" "!" "! CREATION DATE:" "! {~dcl_creation~}" "!" "! USAGE:" "! {~dcl_usage~}" "!" "!--" END DEFINE DEFINE TOKEN COMMENT - /LANGUAGE = DCL - /DESCRIPTION = "DCL Comment text" - /TOPIC_STRING = "DCL Comment text" " !" " ! {~dcl_text~}" " !" END DEFINE DEFINE TOKEN "$ !" - /LANGUAGE = DCL - /DESCRIPTION = "Comment line for DCL procedure" "$ !" "$ ! {~dcl_text~}" "$ !" END DEFINE DEFINE TOKEN "$!" - /LANGUAGE = DCL - /DESCRIPTION = "Comment line for DCL procedure" "$ !" "$ ! {~dcl_text~}" "$ !" END DEFINE DEFINE TOKEN "$" - /LANGUAGE = DCL - /DESCRIPTION = "DCL Command line, any valid DCL command can be used" "$ {~dcl_content~}" END DEFINE DEFINE TOKEN SUBROUTINE - /LANGUAGE = DCL - /DESCRIPTION = "DCL Subroutine" "$ !**************************" "$ !" "$ ! DESCRIPTION:" "$ ! {~dcl_description~} "$ !" "$ ! SIDE EFFECTS:" "$ ! {~dcl_text~}" "$ !" "$ !**************************" "${~subroutine_name~}" "$ {~dcl_content~}" "$ !" "$ ! Return to caller" "$ !" "$ RETURN" END DEFINE DEFINE TOKEN "$SUBROUTINE" - /LANGUAGE = DCL - /DESCRIPTION = "DCL Subroutine" "$ !**************************" "$ !" "$ ! DESCRIPTION:" "$ ! {~dcl_description~} "$ !" "$ ! SIDE EFFECTS:" "$ ! {~dcl_text~}" "$ !" "$ !**************************" "${~subroutine_name~}" "$ {~dcl_content~}" "$ !" "$ ! Return to caller" "$ !" "$ RETURN" END DEFINE ! ! DCL Command expansion tokens ! DEFINE TOKEN IF_THEN - /LANGUAGE = DCL - /DESCRIPTION = "Standard DCL IF - THEN statement" "[~normal_if_statement~]" END DEFINE DEFINE TOKEN IF_THEN_ELSE - /LANGUAGE = DCL - /DESCRIPTION = "Full DCL IF - THEN - ELSE - ENDIF statement" "[~full_if_statement~]" END DEFINE ! ! DCL LEXICAL FUNCTION DEFINITIONS ! DEFINE TOKEN F$CVTIME - /LANGUAGE = DCL - /DESCRIPTION = "Convert one time format to another" "[~lex_with_return_value~]F$CVTIME([~input_time~], [~output_time~], [~field~])" END DEFINE DEFINE TOKEN F$DIRECTORY - /LANGUAGE = DCL - /DESCRIPTION = "Return current default dictionary" "[~lex_with_return_value~]F$DIRECTORY()" END DEFINE DEFINE TOKEN F$EDIT - /LANGUAGE = DCL - /DESCRIPTION = "Edit a source string" "[~lex_with_return_value~]F$EDIT({~source_string~}, {~edit_list~})" END DEFINE DEFINE TOKEN F$ELEMENT - /LANGUAGE = DCL - /DESCRIPTION = "Extract an element from a list" "[~lex_with_return_value~]F$ELEMENT({~element_number~}, {~element_delimiter~}, {~source_string~})" END DEFINE DEFINE TOKEN F$ENVIRONMENT - /LANGUAGE = DCL - /DESCRIPTION = "Gather information about current environment" "[~lex_with_return_value~]F$ENVIRONMENT({~lex_item~})" END DEFINE DEFINE TOKEN F$EXTRACT - /LANGUAGE = DCL - /DESCRIPTION = "Extract a substring from a text string" "[~lex_with_return_value~]F$EXTRACT([~offset~], {~length~}, {~source_string~})" END DEFINE DEFINE TOKEN F$FAO - /LANGUAGE = DCL - /DESCRIPTION = "Generate a formated output string" "[~lex_with_return_value~]F$FAO({~control_string~}, [~argument_list~])" END DEFINE DEFINE TOKEN F$FILE_ATTRIBUTES - /LANGUAGE = DCL - /DESCRIPTION = "Gather information about a file" "[~lex_with_return_value~]F$FILE_ATTRIBUTES({~file_specification~}, {~lex_item~})" END DEFINE DEFINE TOKEN F$GETDVI - /LANGUAGE = DCL - /DESCRIPTION = "Get device information" "[~lex_with_return_value~]F$GETDVI([~device_name~], {~lex_item~})" END DEFINE DEFINE TOKEN F$GETJPI - /LANGUAGE = DCL - /DESCRIPTION = "Get Job and Process information" "[~lex_with_return_value~]F$GETJPI([~process_id~], {~lex_item~})" END DEFINE DEFINE TOKEN F$GETSYI - /LANGUAGE = DCL - /DESCRIPTION = "Get System information" "[~lex_with_return_value~]F$GETSYI({~lex_item~}, [~node_name~])" END DEFINE DEFINE TOKEN F$INTEGER - /LANGUAGE = DCL - /DESCRIPTION = "Convert Text Expression into Interger value" "[~lex_with_return_value~]F$INTEGER({~numeric_expression~})" END DEFINE DEFINE TOKEN F$LENGTH - /LANGUAGE = DCL - /DESCRIPTION = "Determine length of text string" "[~lex_with_return_value~]F$LENGTH({~source_string~})" END DEFINE DEFINE TOKEN F$LOCATE - /LANGUAGE = DCL - /DESCRIPTION = "Locate a substring within a text string" "[~lex_with_return_value~]F$LOCATE({~source_string~})" END DEFINE DEFINE TOKEN F$MESSAGE - /LANGUAGE = DCL - /DESCRIPTION = "Convert Status code to its output message" "[~lex_with_return_value~]F$MESSAGE(~{status_code~})" END DEFINE DEFINE TOKEN F$MODE - /LANGUAGE = DCL - /DESCRIPTION = "Determine current mode of operation" "[~lex_with_return_value~]F$MODE()" END DEFINE DEFINE TOKEN F$PID - /LANGUAGE = DCL - /DESCRIPTION = "Return job Process identification number" "[~lex_with_return_value~]F$PID({~context_symbol~})" END DEFINE DEFINE TOKEN F$PRIVILEGE - /LANGUAGE = DCL - /DESCRIPTION = "Boolean return depending on what privs are set" "[~lex_with_return_value~]F$PRIVILEGE({~privilege_list~})" END DEFINE DEFINE TOKEN F$PROCESS - /LANGUAGE = DCL - /DESCRIPTION = "Return your current process name string" "[~lex_with_return_value~]F$PROCESS()" END DEFINE DEFINE TOKEN F$SEARCH - /LANGUAGE = DCL - /DESCRIPTION = "Search a directory for the specified file" "[~lex_with_return_value~]F$SEARCH({~file_specification~}, [~stream_id~])" END DEFINE DEFINE TOKEN F$SETPRV - /LANGUAGE = DCL - /DESCRIPTION = "Turn on the privileges specified" "[~lex_with_return_value~]F$SETPRV({~privilege_list~})" END DEFINE DEFINE TOKEN F$TIME - /LANGUAGE = DCL - /DESCRIPTION = "Get current date and time, in ABSOLUTE format" "[~lex_with_return_value~]F$TIME()" END DEFINE DEFINE TOKEN F$TRNLNM - /LANGUAGE = DCL - /DESCRIPTION = "Translate logical name" "[~lex_with_return_value~]F$TRNLNM({~input_logical~}, [~lnm_table~], [~lnm_index~], [~lnm_mode~], [~lnm_case~], [~lex_item~])" END DEFINE DEFINE TOKEN F$TYPE - /LANGUAGE = DCL - /DESCRIPTION = "Determines what type the specified variable is" "[~lex_with_return_value~]F$TYPE({~dcl_symbol~})" END DEFINE DEFINE TOKEN F$USER - /LANGUAGE = DCL - /DESCRIPTION = "Return UIC value of the current user" "[~lex_with_return_value~]F$USER()" END DEFINE DEFINE TOKEN F$VERIFY - /LANGUAGE = DCL - /DESCRIPTION = "Enable or Disable command file verification" "[~lex_with_return_value~]F$VERIFY({~verify_state~})" END DEFINE ! ! Now Save the environment ! SAVE ENVIRONMENT/NEW LSEDCL.ENV