HP 3000 Manuals

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


Micro Focus COBOL Language Reference

General Formats (Continued) 

For OSVS and VSC2 only:  The SERVICE Statement 

Function.   

The SERVICEstatement is used to establish addressability to Linkage
Section items usually in a CICS program.

General Format.   

[]
Syntax Rules. 1. SERVICE LABEL is generated by the mainframe CICS preprocessor to indicate control flow. It is not intended for general use. 2. The SERVICE LABEL statement can appear only in the Procedure Division, not in the Declaratives Section. 3. Identifier should either be the first 01-level item representing the BLL-cell block in the Linkage Section, or another Linkage Section 01-level item for which addressability needs to be reestablished following an EXEC CICS statement. General Rules. 1. At the statement following the SERVICE LABEL statement, all registers that can no longer be valid are reloaded. 2. If the OS/VS COBOL BLL mechanism is used in a CICS program, addressability to the parameter list must be established at the start of the Procedure Division. This is done by adding a SERVICE RELOAD identifier statement at the start of the Procedure Division where the identifier is the first item in Linkage Section and it includes pointers to all other entries in the Linkage Section. 3. If a locate-mode EXEC CICS statement is included in a program compiled with the OSVS directive, then a SERVICE RELOAD statement must follow each such CICS command and the identifier must be the same pointer (BLL-cell reference) used in the CICS command. 4. In a CICS program compiled with the OSVS directive, any time a reference is made to a Linkage Section which is greater than 4096 bytes long, a SERVICE RELOAD statement should be made to re-establish addressability to that portion of the data item greater than 4096 byte. 5. The SERVICE RELOAD statement is documentary only in a program compiled with the VSC2 directive. The SET Statement Function. 1. For ANS85 only: The SET statement is used to alter the status of external switches. 2. For ANS85 only: The SET statement is used to alter the value of conditional variables. 3. For VSC2 and MF only: The SET statement is used to assign the address of a data item to a pointer data item. It is also used to adjust the contents of a point data item. 4. The SET statement is used to adjust the contents of a pointer variable. 5. For MF only: The SET statement establishes reference points for table handling operations by setting indices associated with table elements. General Formats. Format 1 (ANS85).
[]
Format 2 (ANS85).
[]
Format 3 (VSC2) (MF).
[]
Format 4 (MF).
[]
Format 5.
[]
Format 6.
[]
Format 7 (MF).
[]
Directives. 1. In addition to system directives which provide flagging and modify the reserved word list, the following directives may impact either the syntax or semantics described in this section. See your COBOL System Reference for details. * STICKY-LINKAGE - determines whether addresses of data items placed inpointer data items by the SET statement are retained between invocations of a subprogram. Syntax Rules. All Formats. 1. The figurative constant NULL or NULLS or the data item referenced by pointer-name-2 or procedure-pointer-name-2 represents the sending area. ADDRESS OF identifier-2, ENTRY identifier-8, ENTRY literal-1 or the value held in the sending area, represents the sending value. The data item referenced by pointer-name-1, pointer-name-3 or procedure-pointer-name-1 or the COBOL system area implied by ADDRESS OF identifier-1 represents the receiving area. Identifier-3, integer-1 or LENGTH OF identifier-4 represents the increment value. For ANS85 only: Format 1. 2. Mnemonic-name-1 must be associated with an external switch, the status of which can be altered. For MF only: See the section The Special-Names Paragraph for details of which external switches can be referenced in the SET statement. Format 2. 3. For ANS85 only: Condition-name-1 must be associated with a conditional variable. 4. For MF only: If the FALSE phrase is specified, the FALSE phrase must be specified in the VALUE clause of the Data Description entry for condition-name-1. 5. For ANS85 and MF only: Each FALSE or TRUE phrase applies to the occurrences of condition-name-1 that precede that phrase and follow a previous FALSE or TRUE phrase, if any. For VSC2 and MF only: Format 3. 6. Identifier-1 must reference a level 01 or level 77 data item that is declared in the Linkage Section. 7. Identifier-2 must reference a data item with a level of 77 or between 01 and 49 inclusive that is declared in the Linkage-Section (VSC2 only). 8. Pointer-name-1, pointer-name-2 must each be an identifier that references an elementary data item with USAGE IS POINTER. For MF only: Format 4. 9. Pointer-name-3 must be an identifier that references an elementary data item with USAGE IS POINTER. 10. Identifier-3 must be an elementary numeric integer. 11. Integer-1 may be signed. Format 5. 12. Identifier-5 and identifier-6 must each reference an index data item or an elementary item described as an integer. If both are specified, they must not both reference an elementary item. Formats 5 and 6. 13. Integer-2 and integer-3 may be signed. Integer-2 must be positive. Format 6. 14. Identifier-7 must reference an elementary numeric integer. For MF only: Format 7. 15. Procedure-pointer-name-1 and procedure-pointer-name-2 must each be an identifier that references an elementary data item with USAGE IS PROCEDURE-POINTER. 16. Identifier-8 must be defined as an alphanumeric data item such that its value can be a COBOL or a non-COBOL program name. 17. Literal-1 must be a nonnumeric literal. General Rules. For ANS85 only: Format 1. 1. The status of each external switch associated with the specified mnemonic-name-1 is modified such that the truth value resulting from evaluation of a condition-name associated with that switch will reflect an on status if the ON phrase is specified, or an off status if the OFF phrase is specified. (See the section Switch-Status Condition earlier in this chapter.) For ANS85 only: Format 2. 2. The literal in the VALUE clause associated with condition-name-1 is placed in the conditional variable according to the rules of the VALUE clause (see the section The VALUE Clause earlier in this chapter.) If more than one literal is specified in the VALUE clause, the conditional variable is set to the value of the first literal that appears in the VALUE clause. 3. If multiple condition-names are specified, the results are the same as if a separate SET statement had been written for each condition-name-1 in the same order as specified in the SET statement. 4. For MF only: If the FALSE phrase is specified, the literal in the FALSE phrase of the VALUE clause associated with condition-name-1 is placed in the conditional variable according to the rules for the VALUE clause. (See the section The VALUE Clause earlier in this chapter.) For VSC2 and MF only: Format 3. 5. The sending value represents the address of a data item. If pointer-name-2 is specified, the sending value is the value contained with the data item referenced by pointer-name-2. If ADDRESS OF identifier-2 is specified, the sending value represents the address of identifir-2. 6. If pointer-name-1 is specified, the sending value is moved to the data name referenced by pointer-name-1. 7. If ADDRESS OF identifier-1 is specified, the sending value is moved to a COBOL system area and the object program subsequently operates such that the area of storage referenced by identifier-1 is located at the address represented by the sending value. For MF only: Whether or not the link is retained between invocations of a subprogram is dependent on the STICKY-LINKAGE directive. See your COBOL System Reference for details. For MF only: Format 4. 8. Before execution of the SET statement, the value of the data item referenced by pointer-name-3 must represent the address of a data item within a logical record, the original address. After execution of the SET statement, the value of the data item referenced by pointer-name-3 represents the new address. If the original address and the new address do not both lie within the same logical record, (or for environments in which address space is segmented within the same segment; see yourCOBOL System Reference) then the results of using the value of the data item referenced by pointer-name-3 are undefined. 9. If the UP clause is specified, the new address is formed by adding the number of bytes given by the increment value to the original address. 10. If the DOWN clause is specified, the new address is formed by subtracting the number of bytes given by the increment value from the original address. Format 5. 11. a. Index-name-1 is set to a value causing it to refer to the table element that corresponds in occurrence number to the table element referenced by index-name-2, identifier-6, or integer-2. If identifier-6 references an index data item, or if index-name-2 is related to the same table as index-name-1, no conversion takes place. b. If identifier-5 references an index data item, it can be set equal to either the contents of index-name-2 or identifier-6 where identifier-6 also references an index item; no conversion takes place in either case. c. If identifier-5 does not reference an index data item, it can be set only to an occurrence number that corresponds to the value of index-name-2. Neither identifier-6 nor integer-2 can be used in this case. d. The process is repeated for all recurrence of index-name-1, or identifier-5, if specified. Each time the value of index-name-2 or identifier-6 is used as it was at the beginning of the execution of the statement. Any subscripting or indexing associated with identifier-5 and so on is evaluated immediately before the value of the respective data item is changed. 12. Data in the following table represents the validity of various operand combinations in the SET statement. The general rule reference indicates the applicable general rule. Table 4-18 : SET Index Statement Valid Operand Combinations ----------------------------------------------------------------- | | | | Sending Item | Receiving Item | | | | ----------------------------------------------------------------- | | | | | | | Integer Data | Index-Name | Index Data | | | Item | | Item | | | | | | ----------------------------------------------------------------- | | | | | | Integer | No/9c | Valid/9a | No/9b | | Literal | | | | | | | | | ----------------------------------------------------------------- | | | | | | Integer Data | No/9c | Valid/9a | No/9b | | Item | | | | | | | | | ----------------------------------------------------------------- | | | | | | Index-Name | Valid/9c | Valid/9a | Valid/9b(1) | | | | | | ----------------------------------------------------------------- | | | | | | Index Data | No/9c | Valid/9a(1)| Valid/9b(1) | | Item | | | | | | | | | ----------------------------------------------------------------- (1) No conversion takes place. Formats 5 and 6. 13. Index-names are associated with a given table by being specified in the INDEXED BY phrase of the OCCURS clause for that table. 14. If index-name-1 is specified, the value of the index after the execution of the SET statement must correspond to an occurrence number of an element in the table associated with index-name-1. The value of the index associated with an index-name after the execution of a PERFORM or SEARCH statement may be set to an occurrence number that is outside the range of its associated table. (See the sections The PERFORM Statement and The SEARCH Statement earlier in this chapter.) If index-name-2 is specified, the value of the index before the execution of the SET statement must correspond to an occurrence number of an element in the table associated with index-name-1. If index-name-3 is specified, the value of the index both before and after the execution of the SET statement must correspond to an occurrence number of an element in the table associated with index-name-3. Format 6. 15. The contents of index-name-3 are incremented (UP BY) or decremented (DOWN BY) by a value that corresponds to the number of occurrences represented by the value of integer-3 or the data item referenced by identifier-7; thereafter, the process is repeated for each recurrence of index-name-3. For each repetition, the value of the data item referenced by identifier-7 is used as it was at the beginning of the execution of the statement. For MF only: Format 7. 16. The sending value represents the address of the start of a procedure within a COBOL or non-COBOL program. 17. The sending value is moved to the data item referenced by procedure-pointer-name-1. 18. If procedure-pointer-name-2 is specified, the sending value is the value contained within the data item referenced by procedure-pointer-name-2. 19. Literal-1 or the content of the data item referenced by identifier-8 is the name of the referenced procedure. If the referenced procedure is a COBOL procedure, the name of the referenced procedure must contain the program-name contained in the PROGRAM-ID paragraph of the referenced program or the entry-name contained in the ENTRY statement of the referenced procedure. If the program being called is not a COBOL program, the rules for the formation of the program or procedure name are given in your COBOL System Reference. If the referenced procedure has been previously made available and remains available at the time of execution of the SET statement, then the sending value represents the address of the referenced procedure. If the referenced procedure is not available at the time of execution of the SET statement, then the sending value represents the address of a COBOL system error procedure. The SORT Statement Function. The SORT statement creates a sort file by executing input procedures or by transferring records from another file, sorts the records in the sort file on a set of specified keys, and in the final phase of the sort operation, makes available each record from the sort file, in sorted order to some output procedures or to an output file. For MF only: The SORT statement can also be used to sort the elements of a table. Examples:. 1. Examples of using the SORT verb to order elements in a table are provided in the Examples chapter in your Language Reference - Additional Topics. General Formats. Format 1.
[]
For MF only: Format 2.
[]
Directives. 1. In addition to system directives which provide flagging and modify the reserved work list, the following directives may impact either the syntax or semantics described in this section. See your COBOL System Reference for details. * CALLSORT - specifies the program to be used to handle SORT and MERGE operations>


MPE/iX 5.0 Documentation