HP 3000 Manuals

General Formats (Continued) [ Micro Focus COBOL Language Reference ] MPE/iX 5.0 Documentation


Micro Focus COBOL Language Reference

General Formats (Continued) 

The ENTER Statement 

Function.   

The ENTER statement provides a means of allowing the use of more than one
language in the same program.

For ANS85 only:  The ENTER statement is classed as an obsolete element in
the ANSI'85 standard and is scheduled to be deleted from the next full
revision of the ANSI Standard .

For MF only:    All dialects in this COBOL implementation support this
syntax for documentation purposes only.  Refer to your COBOL Reference 
for details on using the FLAGSTD directive to detect all occurrences of
this syntax .

For XOPEN only:  Although it is a part of the standard COBOL definition,
this feature is explicitly excluded from the X/Open COBOL language
definitions and should not be used in an X/Open COBOL conforming source
program .

General Format.   

[]
Syntax Rule. Language-name and routine-name can be any user-defined word or alphanumeric literal. General Rule. This statement is treated as for documentation purposes only. Access to other languages can be achieved by means of the CALL statement. For OSVS, VSC2, and MF only: The ENTRY Statement Function. The ENTRY statement establishes an alternate entry point into a called COBOL program. General Format. Format 1.
[]
Format 2.
[]
Directives. 1. In addition to system directives which provide flagging and modify the reserved word list, the following directive may impact either the syntax or semantics described in this section. See your COBOL System Reference for details. * STICKY-LINKAGE - controls whether addressability to Linkage Section items is maintained between calls to different entry points in the same program. * LITLINK - controls the number of significant characters in an entry-name when.obj files are generated. Syntax Rules. All Formats. 1. The ENTRY statement cannot be used in a program that is nested within another program. 2. Literal-1 must be non-numeric and must not be a figurative constant. In some environments, only the first 8 characters are significant. 3. The USING phrase is necessary only if the object program, the called program, is being invoked by another program, the calling program, that passes parameters. If the calling program is COBOL, parameters are passed if the called program is invoked by the CALL statement or the CHAIN statement (MF only) and that statement includes a USING phrase. If the calling program is not COBOL then see the documentation for that language to determine if parameters are passed. 4. The USING phrase of the ENTRY statement is equivalent to the USING phrase of the PROCEDURE DIVISION header and the two are subject to common syntax rules as indicated in the section The PROCEDURE DIVISION Header. All the data-names, integers, and typedef-names in the general format of the ENTRY statement correspond to data-names, integers, and typedef-names in the PROCEDURE DIVISION header. Format 2 of the ENTRY statement corresponds to Format 2 of the PROCEDURE DIVISION header. General Rules. All Formats. 1. The content of literal-1 gives the entry-name, a name which identifies an entry point into the program that is an alternative to the default COBOL entry point at the start of the PROCEDURE DIVISION. The program-name given in the PROGRAM-ID paragraph can be considered to identify the default COBOL entry point. Note that program files containing executable COBOL code typically have names that are essentially the same as the program-name. When a CALL is made and the program-name or entry-name is not already loaded into memory, program files are located by filename but can appear to be located by program-name. In such circumstances, a CALL that references a program-name may succeed but a CALL that references an entry-name may fail. The entry-name is largely equivalent to a program-name and the two are subject to common rules for formation of the name as indicated in the section The Program-ID Paragraph and Nested Source Programs. Literal-1 corresponds to literal-1 of the general format for the PROGRAM-ID paragraph. 2. When the calling program invokes the called program by a CALL statement naming the entry-name given by literal-1, control is transferred to the next executable statement following the ENTRY statement. 3. The USING phrase of the ENTRY statement is equivalent to the USING phrase of the PROCEDURE DIVISION header and the two are subject to common general rules as indicated in the section The PROCEDURE DIVISION Header. All the data-names, integers, and typedef-names in the general format of the ENTRY statement correspond to data-names, integers, and typedef-names in the PROCEDURE DIVISION header. Format 2 of the ENTRY statement corresponds to Format 2 of the PROCEDURE DIVISION header. 4. Data items that are declared in the Linkage Section but are not declared in the USING phrase of the ENTRY statement can only be referenced if they have been linked to a data item by executing a SET statement or if the STICKY-LINKAGE directive is used (see your COBOL System Reference). For ANS85 only: The EVALUATE Statement Function. The EVALUATE statement describes a multi-branch, multi-join structure. It can cause multiple conditions to be evaluated. The subsequent action of the object program depends on the results of these evaluations. General Format.
[]
Syntax Rules. 1. The operands or the words TRUE and FALSE which appear before the first WHEN phrase of the EVALUATE statement are referred to individually as selection subjects and collectively, for all those specified, as the set of selection subjects. 2. The operands or the words TRUE, FALSE, and ANY which appear in a WHEN phrase of an EVALUATE statement are referred to individually as selection objects and collectively, for all those specified in a single WHEN phrase, as the set of selection objects. 3. The words THROUGH and THRU are equivalent. 4. Two operands connected by a THROUGH phrase must be of the same class. The two operands thus connected constitute a single selection object. 5. The number of selection objects in each set of selection objects must be equal to the number of selection subjects. 6. Each selection object in a set of selection objects must correspond to the selection subject having the same ordinal position in the set of selection subjects according to the following rules: a. Identifiers, literals, or arithmetic expressions appearing in a selection object must be valid operands for comparison to the corresponding operand in the set of selection subjects. (See the section Relation Condition earlier in this chapter.) b. Condition-1, condition-2, or the words TRUE or FALSE appearing as a selection object must correspond to a conditional expression or the words TRUE or FALSE in the set of selection subjects. c. The word ANY can correspond to a selection subject of any type. d. For MF and VSC2 only: Where identifiers are permitted, they can reference floating- point data items. e. For MF and VSC2 only: Where numeric literals are permitted, floating-point literals are permitted. f. For MF and VSC2 only: Where identifiers are permitted, they can reference pointer data items. 7. For MF only: If partial-expression-1 or partial-expression-2 is specified as a selection object, it must correspond to a selection subject that is an identifier, a literal or an arithmetic expression. Partial-expression-1 and partial-expression-2 must be a sequence of COBOL words which, when following the corresponding selection subject, make the resultant text a valid conditional expression. General Rules. 1. The execution of the EVALUATE statement operates as if each selection subject and selection object were evaluated and assigned a numeric or nonnumeric value, a range of numeric or nonnumeric values, or a truth value. These values are determined as follows: a. Any selection subject specified by identifier-1, identifier-2, and any selection object specified by identifier-3, identifier-5, without either the NOT or the THROUGH phrases, are assigned the value and class of the data item referenced by the identifier. b. Any selection subject specified by literal-1, literal-2, and any selection object specified by literal-3, literal-5, without either the NOT or the THROUGH phrases, are assigned the value and class of the specified literal. If literal-3, literal-5, is the figurative constant ZERO, it is assigned the class of the corresponding selection subject. c. Any selection subject in which expression-1, expression-2, is specified as an arithmetic expression and any selection object, without either the NOT or the THROUGH phrases, in which arithmetic-expression-1, arithmetic-expression-3, is specified are assigned a numeric value according to the rules for evaluating an arithmetic expression. (See the section Arithmetic Expressions earlier in this chapter.) d. Any selection subject in which expression-1, expression-2 is specified as a conditional expression and any selection object in which condition-1, condition-2, is specified are assigned a truth value according to the rules for evaluating conditional expressions. (See the section Conditional Expressions earlier in this chapter.) e. Any selection subject or any selection object specified by the words TRUE or FALSE is assigned a truth value. The truth value "true" is assigned to those items specified with the word TRUE, and the truth value "false" is assigned to those items specified with the word FALSE. f. Any selection object specified by the word ANY is not further evaluated. g. If the THROUGH phrase is specified for a selection object, without the NOT phrase, the range of values is all values which, when compared to the selection subject, are greater than or equal to the first operand and less than or equal to the second operand according to the rules for comparison. (See the section Relation Condition in this chapter.) If the first operand is greater than the second operand, no values are in the range. h. If the NOT phrase is specified for a selection object, the values assigned to that item are all values not equal to the value, or range of values, which would have been assigned to the item had the NOT phrase not been specified. 2. The execution of the EVALUATE statement then proceeds as if the values assigned to the selection subjects and selection objects were compared to determine if any WHEN phrase satisfies the set of selection subjects. This comparison proceeds as follows: a. Each selection object in the set of selection objects for the first WHEN phrase is compared to the selection subject having the same ordinal position in the set of selection subjects. i. If the items being compared are assigned numeric or nonnumeric values, or a range of numeric or nonnumeric values, the comparison is satisfied if the value, or one of the range of values, assigned to the selection object is equal to the value assigned to the selection subject according to the rules for comparison. (See the section Relation Condition in this chapter.) ii. If the items being compared are assigned truth values, the comparison is satisfied if the items are assigned the identical truth value. iii. If the selection object being compared is specified by the word ANY, the comparison is always satisfied regardless of the value of the selection subject. b. If the above comparison is satisfied for every selection object in the set of selection objects being compared, the WHEN phrase containing that set of selection objects is selected as the one satisfying the set of selection subjects. c. If the above comparison is not satisfied for one or more selection objects in the set of selection objects being compared, that set of selection objects does not satisfy the set of selection subjects. d. This procedure is repeated for subsequent sets of selection objects, in the order of their appearance in the source program, until either a WHEN phrase satisfying the set of selection subjects is selected or until all sets of selection objects are exhausted. 3. After the comparison operation is completed, execution of the EVALUATE statement proceeds as follows: a. If a WHEN phrase is selected, execution continues with the first imperative-statement-1 following the selected WHEN phrase. b. If no WHEN phrase is selected and a WHEN OTHER phrase is specified, execution continues with imperative-statement-2. c. The scope of execution of the EVALUATE statement is terminated when execution reaches the end of the scope of the selected WHEN phrase or WHEN OTHER phrase or when no WHEN phrase is selected and no WHEN OTHER phrase is specified. (See the section Explicit And Implicit Scope Terminators in the chapter Concepts of the COBOL Language.) 4. If the selection object is specified by partial-expression-1 or partial-expression-2, the corresponding selection subject is considered to be the word TRUE. The selection object is considered to be condition-1 or condition-2 respectively, where condition-1 or condition-2 is the conditional expression resulting from partial expression-1 or partial-expression-2 following the original corresponding selection-subject-1 or selection-subject-2 respectively. For OSVS only: The EXAMINE Statement Function. The EXAMINE statement replaces or counts the number of occurrences of a given character in a data item. General Formats. Format 1.
[]
Format 2.
[]
Syntax Rules. All Formats. 1. The identifier must be described, explicitly or implicitly, as USAGE IS DISPLAY. 2. Each literal must consist of a single character. If identifier is a numeric item, the literals must be numeric literals, nonnumeric literals whose value is a single numeric digit, or the figurative constant ZERO. If identifier belongs to any other class, then the literals can be numeric or nonnumeric, or any figurative constant without the word ALL. General Rules. All Formats. 1. Examination proceeds as follows: a. For nonnumeric data items, examination starts at the leftmost character and proceeds to the right. Each character in the data item specified by the identifier is examined in turn. b. If a data item referred to by the EXAMINE statement is numeric, it must consist of numeric characters and can possess an operational sign. Examination starts at the leftmost character (excluding the sign) and proceeds to the right. Each character except the sign is examined in turn. Regardless of where the sign is physically located, it is completely ignored by the EXAMINE statement. 2. The TALLYING option creates an integral count which replaces the value of a special register called TALLY. The count represents the number of: a. Characters not equal to literal-1 encountered before the first occurrence of literal-1 when the UNTIL FIRST option is used. b. Occurrences of literal-1 when the ALL option is used. c. Occurrences of literal-1 prior to encountering a character other than literal-1 when the LEADING option is used. 3. When either of the REPLACING options is used, the replacement rules are as follows: a. When the ALL option is used, then literal-2 is substituted for each occurrence of literal-1. b. When the LEADING option is used, the substitution of literal-2 terminates as soon as a character other than literal-1 or when the right-hand boundary of the data item is encountered. c. When the FIRST option is used, the first occurrence of literal-1 is replaced by literal-2. d. When the UNTIL FIRST option is used, the substitution of literal-2 terminates as soon as literal-1 or the right-hand boundary of the data item is encountered. For MF only: The EXEC(UTE) Statement Function. The EXEC(UTE) statement is provided as a linkage mechanism to allow control to be passed to non-COBOL subsystems. General Format.
[]
Syntax Rule. Text-data can be any textual data not containing the string END-EXEC. General Rule. 1. The statement will be compiled as a CALL "text-name" USING text-data-buffer statement (see the section The CALL Statement earlier in this chapter), where text-data-buffer contains all the text-data from the EXEC statement (space compressed) for further parsing by the CALLed program text-name. This means that the called subprogram (text-name) will be passed a text string which includes the entire COBOL statement beginning with the EXEC(UTE) verb and ending with the END-EXEC phrase. The called program must parse and then process all of the included information. If an identifier-name is included in text-data, then it is the name of the identifier, not the value of the data in the identifier that is passed to the subprogram. 2. The special case EXEC SQL is normally treated differently by the compiler. If you wish EXEC SQL statements to be treated as described here you must ensure that the system directive NOSQL is explicitly set. For OSVS and MF only: The EXHIBIT Statement Function. The EXHIBIT statement causes an (optionally conditional) display of the literals, and/or identifiers (optionally preceded by the identifier name) specified in the statement. General Format.
[]
Syntax Rules. 1. Each identifier specified in the EXHIBIT statement can be any class of data. TALLY and RETURN-CODE are the only special registers that can be used as identifiers. 2. CHANGED and NAMED can both be omitted. General Rules. 1. Literals and identifiers displayed by the EXHIBIT statement are separated by a space on the displayed line. 2. Each literal can be any figurative constant other than ALL. 3. If the literal is numeric, it must be an unsigned integer. 4. Each execution of an EXHIBIT NAMED statement displays each identifier or literal specified, with each identifier (including any qualifiers and subscripts) followed by an "=" (equal sign) and its current value. They all appear on a single line in the order in which they appear in the statement. 5. Each execution of an EXHIBIT CHANGED NAMED statement displays each identifier or literal specified, with each identifier (including any qualifiers and subscripts) followed by an "=" (equal sign) and its current value. They all appear on a single line in the order in which they appear in the statement. However, the display for each identifier (name and value) is conditional on the value of that identifier having changed since the last execution of the current EXHIBIT statement. If one or more of the identifier values have not changed, neither the name nor the value is printed for those identifiers. If none of the identifier values has changed, and no literals are specified, no display takes place (display of a blank line is suppressed). 6. Each execution of an EXHIBIT CHANGED statement displays the current value of each identifier or literal specified. They all appear on a single line in the order in which they appear in the statement. However, the value display for each identifier is conditional on the value of that identifier having changed since the last execution of the current EXHIBIT statement. If one or more of the identifier values have not changed, the value for those identifiers is not printed; spaces are inserted instead. If none of the identifier values has changed, and no literals are specified, a blank line is displayed (display of a blank line is not suppressed). 7. Each execution of an EXHIBIT statement with neither the CHANGED nor the NAMED option displays each identifier or literal specified. They all appear on a single line in the order in which they appear in the statement.


MPE/iX 5.0 Documentation