• Keine Ergebnisse gefunden

ADD Statement

Im Dokument U I • System 80 (Seite 193-197)

Arithmetic Statements

6.6.2. ADD Statement

Function

The ADD statement causes two or more numeric operands to be summed and the result to be stored.

Format 1

ADD {identifier-,} [,identifier-2] ..• TO identifier-m [ROUNDED]

literal-1 ,literal-2

I[,identifier-n [~] .•• I[;ON SIZE ERROR imperative-statement]

Format 2

ADD {identifier-,}

literal-' {identifier-2} [,identifier-3] ...

literal-2 ,literal-3

GIVING identifier-m [ROUNDED] I[,identifier-n [~]]I [;ON SIZE ERROR imperative-statement]

Format 3

ADD {CORRESPONDING} identifier-' TO identifier-2 [ROUNDED]

CORR

[;ON SIZE ERROR imperative-statement]

Rules

1. In formats 1 and 2, each identifier must refer to an elementary numeric item, except that in format 2 each identifier following the word GIVING must refer to either an elementary numeric item or an elementary

numeric-edited item. lIn format 3, each identifier must refer to a group item.

I

2. Each literal must be a numeric literal.

3. The composite of fixed-point operands must not contain more than 18 digits.

(See 6.5.4.)

• In format 1, the composite of operands is determined by using all of the fixed-point operands in a given statement.

.. In format 2, the composite of operands is determined by using all of the fixed-point operands in a given statement excluding the data items that follow the word GIVING.

• In format 3, the composite of operands is determined separately for each pair of corresponding data items.

7004 4490-000 6-29

4. CORR is an abbreviation for CORRESPONDING.'

5.

I

See 6.5.1 "ROUNDED Phrase;"16.5.2, "SIZE ERROR Phrase;" 6.5.3,

"CORRESPONDING Phrase;" 6.5.4, "Arithmetic Statements;" 6.5.5,

"Overlapping Operands;" andI6.5.6, "Multiple Results in Arithmetic I

I

Statements."

I

6. If format 1 is used, the values of the operands preceding the word TO are added together, then the sum is added to the current value of identifier-m storing the result immediately into identifier-m, and repeating this process respectively for each operand f onowing the word TO.

7. If format 2 is used, the values of the operands preceding the word GIVING are added together, then the sum is stored as the new value of leach

I

identifier-m,lidentifier-n,I ... , the resultant identifiers.

8. If format 3 is used, data items in identifier-1 are added to and stored in corresponding data items in identifier-2.

Function

The ALTER statement modifies a predetermined sequence of operations.

Format

ALTER procedure-name-1 lQ [~ lQ] procedure-name-2

[,procedure-name-3 lQ [~IQ] procedure-name-4] .. , I Rules

1. Each procedure-name-1,lprocedure-name-3,1 ... , is the name of a paragraph that contains a single sentence consisting of a GO TO statement without the DEPENDING phrase.

2. Each procedure-name-2,lprocedure-name-4,1 ... , is the name of a paragraph or section in the Procedure Division.

3. Execution of the ALTER statement modifies the GO TO statement in the paragraph named procedure-name-1,lprocedure-name-3,1 ... , so that

subsequent execution of the modified GO TO statements transfers control to procedure-name-2,[P!OCedure-name-4, ... , respectively., Modified GO TO statements in independent segments may, under some circumstances, be returned to their initial states. (See 10.2.2.)

6-30 7004 4490-000

A GO TO statement in a section whose is than or an ALTER statement in a section with

All other uses of the ALTER statement are valid and are -no· .. FI"'I.1I"n-.or!

IDI·oc,ealurE~-nlaTIae··~IlIS in an ""H~ ... I,y",n

Function

The statement causes control to be transferred from one program to another within the run-unit.

Format

CAL L { ' - - - ' } literal-'

1

data-name-' ) r - - - l

cd-name-'

I

i dent if i er -2

I

fi le-name-'

L ______ J

data-name-2

I

identifier-3

I

file-name-2

L ______ J

Rules

1. Literal-1 must be a nonnumeric literal.

3. The value a 1- to 6-character load

module name, or the the name of the

if the called program is "'''U''~v'CAU'.' the program.

4. is included in the CALL statement if there is in the Procedure Division header of the called program. The number of nr"" ... ""nrl in each USING must be identical.

5.

6. program whose name is value of literal-1 ~29:~~~~

called program; the program which the CALL oJIJUI...,,-,'"LS.'VLAIJ 'V"",,'UlJlLJlo;;;. program.

7004 4490-000 6-31

Procedure Division

6-32

7. Execution of a CALL statement causes control to pass to the called program.

8. A called program is in its initial state the first time it is called within a run-unit and the first time it is called after a CANCEL to the called program. On all other entries into the called program, the state of the program remains unchanged from its state when last exited. This includes data fields, the status and positioning of files, and alterable switch settings.

9. If, during execution of a CALL statement, it is determined that the available portion of object time storage is incapable of accommodating the program specified in the CALL statement and the ON OVERFLOW phrase is

specified, no action is taken and the imperative statement is executed. If the ON OVERFLOW phrase is not specified, the calling program is terminated and the disposition of the run unit is handled by the operating system.

10. Called programs may contain CALL statements. However, a called program must not contain a CALL statement that directly or indirectly calls the calling program.

11. The data-names specified by the USING phrase of the CALL statement indicate those data items available to a calling program that may be referred to in the called program. The order of appearance of the data-names in the USING phrase of the CALL statement and the USING phrase in the Procedure Division header is critical. Corresponding data-names refer to a single set of data that is available to the called and calling program. The correspondence is positional, not by name. In the case of index-names, no such correspondence is established. Index-names in the called and calling program always refer to separate indexes.

12. The CALL statement may appear anywhere within a segmented program.

When a CALL statement appears in a section with a segment-number greater than or equal to 50, that segment is in its last used state when the EXIT PROGRAM statement returns control to the calling program. When using parameter CALLST=YES in a segmented program, the linkage editor commands must ensure that the called program can be accessed from the overlay that contains the CALL statement (see 10.5.4).

13.1 Literal-lor the content of the data item referenced by identifier-II is used to identify the called program.

r - - - ,

I 14. When the called program is a COBOL program, each of the operands in the

I

USING phrase of the calling program must be defined as a data item in the

I I

File, Working-Storage, or Linkage Section. If the called program is written in

I I

a language other than COBOL, the operands of the USING clause may also I be file-names and the address of the data management keyword attributes :

L

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ (DTF or RIB) is passed to the called program. ---J I

15. Programs called by the literal-1 option exclusively may be linked with the calling program or dynamically loaded. (Refer to Appendix A for the CALLST compiler option parameter.) Programs called by the identifier-1 option are always dynamically loaded.

7004 4490-000

Procedure Division

Im Dokument U I • System 80 (Seite 193-197)