GB/T 4092.12-1992 Programming language COBOL Inter-program communication module
Some standard content:
1 Introduction
1.1 Function
National Standard of the People's Republic of China
Programming language COBOL
Inter-program communication module
I'rogramming language COBOL
Inter-program communication moduleGB/T4092.12-92
Replaces GB4092.12-83
The inter-program communication module provides the ability for one program to communicate with one or more other programs. This communication is provided through the following two aspects: (a) The ability to transfer control from one program to another within a run unit. (b) The ability to pass parameters between programs to make certain data values available to the called program. The inter-program communication module also allows two programs to communicate through data sharing and file sharing. 1.2 Level Features
Level 1 inter-program communication provides the ability to transfer control to one or more programs whose names are known at compile time and the ability to share data between these programs.
Level 2 inter-procedural communication provides the ability to transfer control to one or more procedures whose names are unknown at compile time, and the ability to determine the availability of target storage space for the program to which control is to be transferred. Level 2 inter-procedural communication also provides for the nesting of external attributes, fully qualified procedure names, and source programs.
1.3 Language Concepts
1.3.1 Nested Source Programs
A COBOL source program is a syntactically correct set of COBOL statements. A COBOL source program can include other COBOL source programs, and these included programs can reference certain resources of the program that includes them. When a program B is included in another program A, it can be included directly or indirectly. If no program A contains B, then program B is directly included. Included in program A. If there is a program included in A that also includes B, then program B is indirectly included in program A.
1.3.2 File Link Area
A file link area is a storage area that contains information about a file and is used as a link between a file name and a physical file, and between a file name and its related record area. 1.3.3 Full Name and Local Name
A data name names a data item. -A file name names a file link area. These names are divided into full name, local name, and local name. or the same part. A full name can be used to refer to the standard associated with it, either from the program that declares the full name or from any other program that contains the program that declares the full name. A local name can only refer to the standard associated with it from the program that declares the local name. Some names are always global, some names are always local, and some names can be both global and local, depending on how they are declared in the program. Approved by the National Technical Supervision Bureau on August 4, 1992 and implemented on 1993-D5-01 | |tt||GB/T4092.12—92
For a record name, if the GLOBAL clause is specified in the record description clause that specifies the record name, or, in the case of a record description clause of a file section, if the GLOBAL clause is specified in the file description clause of the file name associated with the record description, then the record name is global. For a data name, if the GLOBAL clause is specified in the data description clause that specifies the data name, or if the GLOBAL clause is specified in another description clause under the data description clause, then the record name is global. A data name is global if a GLOBAL clause is specified in the file description. A condition name declared in a data clause is global if the clause is subordinate to another clause that specifies a GLOBAL clause. However, certain rules sometimes prohibit the specification of a GLOBAL clause for certain data clauses, file clauses, and record clauses. A file name is global if a GLOBAL clause is specified in the file description of the file name. A data name, file name, or condition name declared in a data clause is not global, then the name is local. Full names can be passed between programs contained within other programs. 1.3.4 External and Internal Labels
Access to data items often requires the storage of data in a specific representation, and file link areas often require the storage of some specific information associated with the file. The storage associated with a data item or file link area may be external or internal to the program that declared the label. A data item or file link area is external if the storage associated with that item is associated with the run unit and not with a particular program in the run unit. An external item can be referenced by any program in the run unit that describes it. References to external items are always references to the same item, with separate object descriptions used in different programs. In a run unit, an external item has only one representation.
An item is internal if the storage associated with it is associated only with the program that describes it. External and internal items can have either full or local names.
A data record described in a working storage section is given the external attribute by the EXTERNAL clause of its data description clause. Any data item described by a data description clause subordinate to the description clause that describes the external record also acquires the external attribute. If a record or data item does not have the external attribute, it is part of the internal data of the program that describes it. File link areas are given the external attribute by the EXTERNAL clause of the associated file description clause. If a file connection section does not have the external attribute, it is internal to the program describing the associated file name. Data records described as belonging to a file description clause that does not contain an EXTERNAL clause or a sort-merge file description clause, and any data items described as belonging to data description clauses of these records, are always internal to the program describing the file name. If the EXTERNAL clause is included in the file description clause, the data records and data items acquire the external attribute. Data records, subordinate data items, and various related control information described in the connection section, communication section, and report section of a program are considered to be always internal to the program describing the data. Special considerations are made for data described in the connection section, where a connection is established between the described data and other data items accessible to other programs. 1.3.5 Common and Initial Programs
All programs that make up a running unit may have none or one or more of the following attributes, common and initial. A common program is a program that, although it is directly contained in another program, can be called by any program directly or indirectly contained in another program. Common properties are obtained by specifying the COMMON clause in the identification part of the program. The COMMON clause simplifies the writing of subroutines that will be used by all programs contained in the same program. An initial program is a program whose program state is initialized when it is called. Thus, when an initial program is called, its program state is the same as when it is first called in that run unit. In the process of initializing an initial program, the internal data of that program are initialized, so that the internal data of a program containing a VALUE clause in the description are initialized to defined values, but data items without a VALUE clause in the description are initialized to an undefined value. Files in the internal file link area associated with the program are not in open mode. The control mechanisms of all FERFORM statements contained in the program are reset to their initial state. Initial properties are obtained by specifying the INITIAL clause in the identification part of the program. 1.3.6 Shared data
GB/T 4D092.12—92
Two programs in a running unit can reference common data in the following circumstances: (1) If an external data record is described in a program, the data content of the external data record can be referenced from the program. (2) If a program is included in another program, then both programs can reference such data, which has global attributes in the including program or in any program that directly or indirectly includes the included program. (3) A common data item is established from the calling program to the called program through a mechanism of passing parameters by reference: the called program can use different identifiers to reference the data item in the calling program. 1.3.7 Shared files
Two programs in a running unit can reference a common file link area in the following circumstances: (1) The external file link area can be referenced by any program that describes the file link area. (2) If a program is included in another program, then both programs may refer to the Common Link section by referring to the relevant program documentation in the included program or in any program that directly or indirectly includes the included program. 1.3.8 Scope of Names
When a program is directly or indirectly included in another program, each program can use the same user-defined words to name objects, regardless of the use of these user-defined words by other programs (see 6.4.2.2.1.1 User-defined words in GB/T4092-1). When there are objects with the same name, the program's reference to this name, even if it is a different user-defined word type, is a reference to the object described by that program, not a reference to the object with the same name described in another program. The following types of user-defined words can be referenced only by statements and descriptive clauses in the program that declares the user-defined word:cd name
The following types of user-defined words can be referenced by any CO)RO) program, assuming that the compilation system supports the corresponding library or other system and the referenced entity is known to that systemlibrary name
text name
When the following types of user-defined words are defined in a return section, they can only be referenced by statements and descriptive clauses in the program that contains the communication section:
Condition name
Data name
Record name
When in When the configuration section defines the following types of names, they can only be referenced by statements or descriptions in the program that contains the piping section or in programs included by that program:
Alphabetic name
Category name
Condition name
Mnemonic name
Symbol character
When the above conditions do not apply, specific conventions will apply to the following types of user-defined words for description and reference:Condition name
Data name
File name
Label name
Program name
Record name
Report name
1. 3. 8. 1 Conventions for program names
GB/T4092.12—92
. The program name of a program is described in the Program Identification (PROGRAM-ID) section of the program's identification section. A program name can only be referenced by CALL statements, CANCEL statements, and program termination headers. The program names assigned to programs that make up an execution unit do not have to be unique. However, when two programs in an execution unit have the same name, at least one of the two programs is directly or indirectly included in another separately compiled program that does not include the other of the two programs. The following rules govern the use of program names: (1) If the program name is the name of a program that does not have a public attribute and is directly included in another program, the program name can only be referenced by statements in the program that includes the program. (2) If the program name is the name of a program that has a public attribute and is directly included in another program, the program name can only be referenced by statements in the program that includes the program and any programs that are directly or indirectly included in it (but excluding programs with public attributes and programs included in it). (3) If a program name is the name of a separately compiled program, the program name can be referenced by statements in any other program in the execution unit (except programs that it directly or indirectly includes). 1.3.8.2 Agreement on condition names, data names, file names, record names and report names When condition names, data names, file names, record names and report names are declared in a source program, these names can only be referenced by the source program, except when one or more names are full program names or the program includes other programs and are assigned as condition names, data names by a single program. The management requirements for the uniqueness of file names, record names and report names are explained in other parts of this specification (see 6.4.2.2.1.1 User-defined characters in GB/T1092.1). A program cannot reference condition names, data names, file names, record names and report names declared in another program it contains. A full program name can be referenced in the program that declares it or in any program that is directly or indirectly included in the program. When a program B is directly included in another program A, the two programs can use the same condition name, data name, file name, record name or report name defined by the same user-defined character. When such a duplicate name is referenced in program B, the following rules are used to determine the object being referenced:
(1) The set of names used to determine the object being referenced consists of all names defined in program B, the full names defined in program A, and any programs that directly or indirectly include A. This set of names is used, applying the usual qualification rules and other rules for making references unique, until one or more objects are identified. (2) If only one object is identified, it is the object of reference. (3) If more than one object is identified, no more than one object has a name that is local to program B. If zero or one object has a name that is local to program B, the following rules apply:a. If the name is declared in program B, the object in program B is the object of reference. b. Otherwise, if program A is included in another program, the object of reference is: 1) if the name is declared in program A, then the object in program A; 2) if the name is not declared in program A but is declared in a program that includes program A, then the object in the including program. This rule applies to the next higher level of included programs until a unique valid name is found. 1.3.8.3 Conventions for placeholder names
If a data item with either or both external or global attributes contains a table that uses a placeholder, the placeholder also has either or both attributes accordingly. Therefore, the scope of the placeholder name is the same as the scope of the data name that names the table whose placeholder is named by the placeholder name, and the scope rules for the data name apply to the placeholder name. Placeholder names cannot be qualified. Nested source programs
General description
GB/T4092.12—92
A COBOL source program is a collection of syntactically correct COBOL statements. A COBOL source program can include other COBOL source programs, and these included programs can reference certain resources of the program that includes them. 2.2 Organization
Except for COPY and REPLACE statements and the end-of-program header, the statements, descriptions, paragraphs, and sections of a COBOL source program are divided into four parts, arranged in the following order:
Identification part
Environment part
Data part
Procedure part
The end of a COBOL source program is marked by the end-of-program header (if specified), or by no additional source program lines. 2.3 Structure
Given below is the general format and order in which the descriptions and statements that make up a COBOL source program appear. The general terms identification part, environment part, data part, procedure part, source program, and end-of-program header refer to the identification part of a COBOL program, the environment part of a COBOL program, the data part of a COBOL program, the procedure part of a COBOL program, the COBOL source program, and the end-of-program header of a COBOL program, respectively. 2:3.1—General format
Identification section
[Environment section]
[Data section]
[Procedure section]
[Source program]
[End of program header]
2.3.2 Syntax rules
(1) The end of program header must be present in the following cases: a.
The COBOL source program contains one or more other COBOL source programs, or the COBOL source program is contained in another COBOL source program. General rules
(1) The beginning of a section in a program is indicated by an appropriate radical. The end of a section is indicated by one of the following: The radical of the subsequent section in the program.
The identification radical indicating the beginning of another source program. End of program header.
d. The physical location after which no other source program lines appear. (2) The specification of a COBOL source program (considered to be a separate program) that is directly or indirectly included in another program may additionally refer to certain resources defined in the including program. (3) The target code resulting from compiling a program included in another program is considered to be inseparable from the target code resulting from compiling the including program in terms of specification. 2.4 Initial state of a program
The initial state of a program is the state of the program when it is first called in an execution unit. 2.4.1 Characteristics of a program
(1) The internal data contained in the working storage section and the communication section of the program are initialized. If GB/T 4092.12-92
VALUE clause, the data item is initialized to the defined value. If a data item has no VALUE clause, the initial value of the data item is undefined.
(2) The file with internal file link area associated with the program is not in open mode. (3) The control mechanisms of all PERFORM statements in the program are set to their initial state. (4) The GOTO statement contained in the same program and referenced by the ALTER statement is set to its initial state. 2.4.2 Initial state program
A program is in the initial state in the following cases: (1) The program is called for the first time in an execution unit. (2) The program is called for the first time after the execution of a CANCEL statement that references the program or a CANCEL statement that references a program that directly or indirectly contains the program.
(3) Each time a program with the initial attribute is called. (4) The first call to a program after a CALL statement that references a program with the initial attribute or that directly or indirectly includes the program is executed.
2.5 Program End Header
2.5.1. Function
The program end header indicates the end of the COBOL source program named by the right. 2.5.2 General Format
END IROGRAM program name.
2.5.3 Syntax Rules
(1) The program name must conform to the rules for user-defined characters. (2) The program name must be the same as a program name described in the previous FROGRAM-II) paragraph. (3) If the PROGRAM-ID segment that describes a specific program name is stated between the PROGRAM-ID segment that describes and references another program name and the program end header, the program end header that references the earlier program name must appear before the program end header that references the later program name.
2.5.4 General Rules
(1) A program-end header must appear in every program, whether it contains another program or is contained in another program
(2) A program-end header indicates the end of the specified COBOL source program. (3) If a program terminated by a program-end header is contained in another program, the next statement must be either an identifier or a program-end header that terminates the outsourced program. (4) If a program terminated by a program-end header is not contained in another program, and the next source statement is a COBOI statement, it must be an identifier of a program that is compiled separately from the program terminated by the program-end header. Identification of Interprogram Communication Modules
3.1 PROGRAM-ID Segment and Nested Source Programs
3.1.1 Functionality
The PROGRAM-ID segment specifies the name that identifies a program and assigns selected program attributes to the program. 3-1.2 General format
PROGRAM ID.
3.1.3 Syntax rules
Program name
COMMON
INITLAL
(1) The program name must conform to the rules for forming user-defined words. PROGRAM
GB/T 4D92. 12—92
(2) A program included in another program may not be assigned a name that is identical to any other program name included in the separately compiled program that includes it.
(3) The optional COMMON clause is used only when the program is included in another program. 3.1.4 General rules
(1) The program name identifies the source program, object program, and all listings associated with a particular program. (2) The COMMON clause indicates that the program is common. A common program is contained in another program but can be called from a program other than the one that contains it (see 1.3.8 Scope of names). (3) The INITIAI clause indicates that the program is initial. When an initial program is called, it and any programs it contains are reset to their initial state (see 2.4 Initial state of a program). 4 Data section of a module for communication between programs
4.1 Link section
The link section is the data section of a source program. The link section appears in a called program and describes data items referenced by both the calling program and the called program.
The link section in a program makes sense only if and when the object program is acting under the control of a .CAII. statement and the CALL statement in the calling program contains a USING phrase. The link section is used to describe data that is made available by the calling program but is referenced in both the calling program and the called program. The mechanism for establishing a correspondence between the data items described in the link section of the called program and the data items described in the calling program is described elsewhere (see 5.1 Procedure header and 5.2 CALL statement). In the case of label names, no such correspondence is established, and the label names in the called program and the calling program always refer to different labels. The structure of the connection section is the same as the working storage section described above, starting with a section header followed by independent data items and/or record description clauses. The general format of the connection section is as follows.
LINKAGE
77 Level Description Clause
SECTION
L Record Description Clause I
If a data item in a connection section is accessed by a program other than the called program, the results are undefined. 4.1.1 Independent Linked Storage
Data items in a connection section that are not hierarchically related to each other do not have to be grouped into records. They are divided and defined as independent elementary items. Each such item is defined in a separate data description clause that begins with a specific level number 77. In each data description clause, the following data clauses are required: level number 77
data name
PRCTURE clause or USAGEISINDEX clause. Other data description clauses are optional and can be used to complete the description of the data item when necessary. 4.1.2 Connection records
Data elements in a connection section that have a certain hierarchical relationship with each other must be composed into records according to the rules for composing record descriptions. Data elements in a connection section that have no hierarchical relationship with other data items can also be described as records of a single elementary item. 4.1.3 Initial value
VALUE clauses cannot be specified in a connection section except for the condition name description clause (level 88). 4.2 File description clauses in inter-program communication modules 4.2.1 Function
In an inter-program communication module, the file description clauses in the file section determine the internal or external attributes of the file connection area, related data records, and related data items. The file description clauses also determine whether a file name is a local name or a global name. 4.2.2
General format
Format 1:
FD file name 1
EXTERNALwww.bzxz.net
GB/T 4092. 12 -92
CONTAINS[integer 1
TO integer 2
RECORDS
CHARACTERS
CONTAINS integer 3CHARACTERS
RECORD
ISVARYINGINSIZE[[FROM integer 4][TO integer 5] CHARACTERSJ[DEPENDING ON data name 1[CONTAINS integer 6 TO integer 7 CHARACTERSRECORD IS
RECORDS ARE
VALUE'OF
STANDARD
IOMITTED
「data name 2]
【implementation name】IS【
word value 1
RECORDS
RECORDS ARE!
data name 41
LINAGE IS
integer 8
[LINES AT TOP|data name 6]
[CODE-SETIS alphabet name 17
Format 2:
FD file name 1
[ISEXTERNAL
GLOBA!
(data name 3]
data name 51
[WITH FOOTING AT.
integer 9
LINES AT BOTTOM
BLOCK CONTAINS [integer]
integer 2
data name 71
integer 11
RECORDS
CHARACTERS
CONTAINS integer 3 CHARACTERS
RECORD
IS VARYING IN SIZE [[FROM integer 4][TO integer 5
[DEPENDINGON data name 1]
CHARACTERST
(CONTAINS integer 6 TO integer 7 CHARACTERSRECORD IS
RECORDS ARE
[STANDARD
OMITTED
Format 3:
VALUE OF
FD file name 1
[IS EXTERNAL ]
FIS GLOBALJ
GB/T 4092. 12—92
【implementation name】TS
RECORDIS
RECORDS ARE
data name 21
learning value 1
(data name 3)
BLOCK CONTAINS [ integer 1 TO ] integer 2RECORDS
CHARACTER
(CONTAINS integer 3 CHARACTERS
RECORD
IS VARYING IN SIZE [[FROM integer 4 TO integer CHARACTERSJDEPEADING ON data name 1]ICONTAINS integer 6 TO integer 7 CHARACTERSRECORD IS
(STANDARD)
IRECORDS ARE: IOMITTED
YALUE OF
implementation name 1IS
[CODE-SETIS alphabet name 1]
[REPORT IS
[REPORTS ARE,
4.2.3 Syntax Rules
Data Name 21
Word Value 1
fReport Name 1}-.
(1) Format 1 is a document description clause for a sequential document. The availability of certain clauses in this document description clause depends on the level of sequential J-modules supported by the implementation (see GB/T 4092.4). (2) Format 2 is a document description clause for a relative document or a prime reference document. The availability of certain clauses in this document description clause depends on the level of reference I-O modules or indexed I-O modules supported by the implementation (see GB/T 1092.5 and GB/T 4092.6). (3) Format 3 is a document description clause for a report document. The availability of the file description clause for a report file depends on whether the implementation supports a report compilation module (see GB/T 4092.8).
4.2.4 General rules
(1) If the file description clause for a sequential file contains a LINAGE clause and an EXTERNAL clause, the LINAGECOUNTER data item is an external data item. If the file description clause for a sequential file contains a LINAGE clause and a GLOBAL clause, the special register LINAGE-COUNTER is a global name. (2) The EXTERNAL clause is given in 4.5. The GLOBAL clause is given in 4.6. All other clauses in the file description clause are given in the description of the appropriate module.
43 Data description clause for interprogram communication modules 4.3.1 Function
In an interprogram communication module, the 01-level data description clause in a working storage section or file section determines whether data records and their subordinate data items have local names or global names.
In the inter-program communication module, the 01-level data description clause in the working storage section determines whether the data record and its subordinate data items have internal or external attributes.
General format
5Data name 1
LFILIER
[REDEFINES
'IS EXTERNAL
[IS GLOBAL
[PICTURE
USAGE IS]
[SIGN IS
GB/T4092.12—92
Data name 2]
BINARY
COMPUTATIONAL
DISPLAY
PACKED-DECIMAL!
LEADING
TRAILING
OCCURSInteger 2TIMES
TASCENDING
IDESCENDING
[SEPARATE CHARACTER
KEY IS (dataname3)
[INDEXED BY bitname1}
OCCURS integer-1 TO integer-2TIMES
DEPENDINGON dataname4
ASCENDING
IDESCENDING
KEYIS(dataname3)
INDEXEDBY:(bitname1)
[SYNCHRONIZED)
LJUSTIFIED
[BLANK WHEN ZERO]
[VALUE IS word value1].
4.3.3 Syntax Rules
(1) The availability of certain clauses in a data description clause depends on the level of core modules supported by the implementation (see core modules). (2) The EXTERNAL clause may only be specified in a data description clause with level 01 in a working storage section. (3) The EXTERNAL clause and the REDEFINES clause cannot be specified in the same data description item. (4) The GLOBAL clause can only be specified in the data description item with level number 01. (5) The data name must be specified for any description item containing a GLOBAL clause or an EXTERNAL clause, as well as for the record description associated with a file description item containing an EXTERNAL clause or a GLOBAL clause. 4.3.4
General rules
1) The EXTERNAL clause is given in 4.5. The GLOBAL clause is given in 4.6. All other clauses of the data description item are given in the core module.
4.4 Report description item for inter-program communication module 4.4.1 Function
GB/T 4092.12--9.2
In the inter-program communication module, the report description item in the report section determines whether the report name is a local name or a global name. 4.4.2 General format
RD report name 1
[IS GLORAT
[(ODE word value 1]
CONTROL IS
ICONTROLS ARE!
FIIMIT' Is
data name 1}
[FINAL[data name]
integer 1
LIMITS ARE
[HEADING integer 2]
FIRSTDETAIL integer 3JLASTDETAIL integer 4][FOOTING integer 5]
4.4.3 Syntax Rules
(1) The availability of the report description clause depends on whether the implementation supports the report compilation module. 4.4.4
(1) If the report description clause contains a GLOBAL clause, the special registers LINE-COUNTER and FAGECOUINTER are fully qualified names.
(2) The GLOBAL clause may be given in 4.6. All other clauses in the report description clause are given in the report compilation module. 4.5 EXTERNAL Word
4.5.1 Function
The EXTERNAL clause indicates that a data item or a file link area is external. The component data items and combined data items of an external data record are available to all programs in the run unit that describe that record. 4.5.2
General format
IS EXTERNAL
4.5.3 Syntax rules
(1) The EXFERNAL clause may be specified only in a file description clause or in a record description clause in a working storage section. (2) Within the same program, a data name specified as the subject of a data description clause containing an EXTERNAL clause at level 01 may not be the same as a data name specified in any other data description clause containing an EXTERNAL clause. (3) The VALUE clause may not be used in a data description clause containing an FXTFRNAI. clause or in its subordinate data description clauses. The VALUE clause may be used for conditional names associated with these data description clauses. 4.5.4 General rules
(1) The data contained in the record named by the data name clause is external and may be accessed and processed by any program in the execution unit that describes it or redefines it subject to the following general rules. (2) In an operational unit, if two or more programs describe the same external data record, the record names of the associated record description clauses must be identical and the records must define the same number of standard data format characters. Therefore, a program describing an external record may contain a data description clause that includes a REFINES clause that redefines the entire external record without the need for this complete redefinition to appear in other programs in the operational unit (see 5.10 REDEFINES clause in GB/T 4092.2). (3) The use of the EXTERNAL clause does not imply that the associated file name or data name is a full name (see 4.GG.OBAI clause).
(4) The file link area associated with this description clause is the external file link area 4.6 GLOBAL clause
4.6-1 Function
GB/T 4092.12—92
The GLOBAL clause specifies that a data name, file name or report name is a full name. A fully qualified name is available to every program contained in the program that describes it.
4.6.2 General format
IS GLOBAL
4.6.3 Syntax rules
(1) The GLOBAL clause may be specified only in a data description clause at level 01 of a file section or working storage section, or in a file description clause or a report description clause.
(2) The GLOBAL clause may not be included in the data description clauses of two data items that specify the same data name in the same data section.
(3) If the SAMERECORDAREA clause is specified for several files, the GLOBAL clause may not be included in the record description clauses or file description clauses of these files.
4. 6. 4 General rules
(1) A data name, file name, or report name described using the GLOBAL clause is a fully qualified name. All data names that are subordinate to a full procedure name are full procedure names. All condition names associated with a full procedure name are full procedure names. (2) Statements in a procedure that is directly or indirectly contained in a procedure that describes a full procedure name may directly refer to the name without describing it (see 1.3.8 Scope of names).
(3) If the GLOBAL subclause is used in a data description clause that contains a REDEFINES clause or an RFNAMES clause, only the body of the REDEFINES or RENAMES clause has the global attribute. 5 Procedure division of inter-program communication modules
5.1 Procedure division front
A procedure division is identified by the following radical and must begin with it: PROCEDURE DIVISION [ USING data name 1) ] The USING phrase is only necessary if the procedure is to be called by a CALL statement. The USING phrase in the procedure radical identifies the names of the parameters passed by the calling procedure that the procedure will use. The parameters passed to the called program are identified in the USING phrase of the calling program's CALL statement. The correspondence between the two name tables is based on positional relationships.
Dataname1 must be specified in the connection section as a 01-level description or a 7-level description. A specific user-defined function cannot appear more than once in the form of dataname1. The data description of dataname1 must not contain a REDEFINES clause, but dataname1 can appear as the object of a REDEFINES clause at other locations in the connection section. The following additional rules apply:
(1) If the reference to the corresponding data item in the nested CALL statement specifies that the parameter be passed by content, the value of the data item is passed when the CALL statement is executed and is placed in the system-defined storage item with this attribute specified for dataname1 in the reverse connection section. The data description of each parameter in the BYCONTENT phrase of the CALL statement must be exactly the same as the data description of the corresponding parameter in the USING phrase of the procedure radical, that is, no conversion, expansion or truncation is required (see 5.2 CALI. Directions). (2) If the reference to the corresponding data item in the CALL statement specifies that the parameter is passed by reference, the target program executes as if the data item in the called program and the data item in the calling program occupy the same storage area. The data item description in the called program and the corresponding data item description in the calling program must describe the same number of character positions. (3) At any time during the execution of the called program, the use of data name 1 must be carried out according to the data item description given in the connection section of the called program.1Procedure Division
A procedure division is identified by the following radical and must begin with it: PROCEDURE DIVISION [ USING data name 1) ] The USING phrase is only necessary if the procedure is to be called by a CALL statement. The USING phrase in the procedure radical identifies the names of the parameters passed by the calling program to be used by the procedure. The parameters passed to the called program are identified in the USING phrase of the calling program's CALL statement, and the two name tables are mapped based on position.
Data name 1 must be defined in the connection section as a 01-level description or a 7-level broadcast description. A specific user-defined function cannot appear more than once in the form of data name 1. The data description of data name 1 cannot contain a REDEFINES clause, but data name 1 can appear as the object of a REDEFINES clause elsewhere in the connection section. The following additional rules apply:
(1) If the reference to the corresponding data item in the nested CALL statement specifies that the parameter be passed by content, then the value of the data item is passed when the CALL. statement is executed and is placed into the system-defined storage item with this attribute specified for data name 1 in the inverse connection section. The data description of each parameter in the BYCONTENT phrase of the CALL statement must be exactly the same as the data description of the corresponding parameter in the USING phrase of the procedure radical, that is, no conversion, expansion or truncation is required (see 5.2 CALL. Directions). (2) If the reference to the corresponding data item in the CALL statement specifies that the parameter be passed by reference, then the target program is executed as if the data item in the called program and the data item in the calling program occupy the same storage area. The data item description in the called program and the corresponding data item description in the calling program must describe the same number of character positions. (3) At any time during the execution of the called program, the use of data name 1 must be carried out according to the data item description given in the connection section of the called program.1Procedure Division
A procedure division is identified by the following radical and must begin with it: PROCEDURE DIVISION [ USING data name 1) ] The USING phrase is only necessary if the procedure is to be called by a CALL statement. The USING phrase in the procedure radical identifies the names of the parameters passed by the calling program to be used by the procedure. The parameters passed to the called program are identified in the USING phrase of the calling program's CALL statement, and the two name tables are mapped based on position.
Data name 1 must be defined in the connection section as a 01-level description or a 7-level broadcast description. A specific user-defined function cannot appear more than once in the form of data name 1. The data description of data name 1 cannot contain a REDEFINES clause, but data name 1 can appear as the object of a REDEFINES clause elsewhere in the connection section. The following additional rules apply:
(1) If the reference to the corresponding data item in the nested CALL statement specifies that the parameter be passed by content, then the value of the data item is passed when the CALL. statement is executed and is placed into the system-defined storage item with this attribute specified for data name 1 in the inverse connection section. The data description of each parameter in the BYCONTENT phrase of the CALL statement must be exactly the same as the data description of the corresponding parameter in the USING phrase of the procedure radical, that is, no conversion, expansion or truncation is required (see 5.2 CALL. Directions). (2) If the reference to the corresponding data item in the CALL statement specifies that the parameter be passed by reference, then the target program is executed as if the data item in the called program and the data item in the calling program occupy the same storage area. The data item description in the called program and the corresponding data item description in the calling program must describe the same number of character positions. (3) At any time during the execution of the called program, the use of data name 1 must be carried out according to the data item description given in the connection section of the called program.
Tip: This standard content only shows part of the intercepted content of the complete standard. If you need the complete standard, please go to the top to download the complete standard document for free.