title>GB/T 4092.5-1992 Programming language COBOL relative IO module - GB/T 4092.5-1992 - Chinese standardNet - bzxz.net
Home > GB > GB/T 4092.5-1992 Programming language COBOL relative IO module
GB/T 4092.5-1992 Programming language COBOL relative IO module

Basic Information

Standard ID: GB/T 4092.5-1992

Standard Name: Programming language COBOL relative IO module

Chinese Name: 程序设计语言COBOL 相对I-O模块

Standard category:National Standard (GB)

state:in force

Date of Release1992-08-04

Date of Implementation:1993-05-01

standard classification number

Standard ICS number:Information technology, office machinery and equipment >> 35.060 Languages ​​for information technology

Standard Classification Number:Electronic Components and Information Technology>>Information Processing Technology>>L74 Programming Language

associated standards

alternative situation:GB 4092.5-1983

Procurement status:ISO 1989-8-1985,EQV

Publication information

other information

Release date:1983-12-26

Review date:2004-10-14

Drafting unit:Nanjing University

Focal point unit:National Information Technology Standardization Technical Committee

Publishing department:State Bureau of Technical Supervision

competent authority:National Standardization Administration

Introduction to standards:

GB/T 4092.5-1992 Programming language COBOL Relative IO module GB/T4092.5-1992 standard download decompression password: www.bzxz.net

Some standard content:

1 Introduction
1.1 Function
National Standard of the People's Republic of China
Programming language COBOLwwW.bzxz.Net
Relative I-0 module
GB/T4092.5-92
Replaces GR 4092. 5-83
Relative I-0 module provides functions for accessing records of files on disk storage in a random or lazy order manner. Each record in a relative file is uniquely identified by an integer greater than zero, which indicates the serial position of the record in the file. 1.2 Level characteristics
Level 1 relative IO provides local functions for file control sections, file description sections, and sections in the I-OCONTROL segment. In the procedure section, the 1st level relative IO provides partial functions for CLOSE, OPEV, READ, REWRITE, USE and WRITE statements, and provides complete functions for DELETE.
The 2nd level tree provides complete functions for the file control section, file description section and each section in the I-OCONTROL section. In the procedure section, the 2nd level relative IO provides complete functions for CLOSE, DELETE, (PEN, READ, REWRITE, START, USE and WRITE statements.
1.3 Language concepts
1. 3. 1 Organization
A relative organization file is a mass storage file. Any record can be stored or retrieved by providing a relative record number value. This file can also be considered to be composed of a series of areas. Each area can store a logical record. Each area is named with a relative record number. Records are stored and retrieved according to this number. For example, the 10th record is a record with a relative record number of 10 and in the 10th record area. It does not matter whether the 1st to 9th record areas have been written. In order to more efficiently access records in relative files, the number of character positions reserved on the media for storing a specific logical record can be different from the number of character positions of the record described in the program. 1.3:2 Access mode
For relative organization, in its sequential access mode, the order of record access is the relative record of all existing records in the file. In ascending order of numbers. Only records currently existing in the file are valid. The START statement can be used to establish a starting point for a series of subsequent sequential retrievals. In random access mode, input and output statements are used to access records in the order specified by the programmer. To access the required record, its relative record is stored in the relative key data item. In dynamic access mode, the programmer can use appropriate input and output statements to arbitrarily change sequential access to random access. 1.3.3 File position indicator
The file position indicator is a concept used in this standard to facilitate the indication of the next record to be accessed in a given file in a certain input and output operation. The concept of file position indicator is meaningless for files opened in output or extension mode. File location State Bureau of Technical Supervision Approved on August 4, 1992, 1993 05-01 Implementation
GB/T 4092.5—92
The value of the IO status indicator is affected only by CLOSE, OPEN, START, and READ statements. 1.3.410 Status
The IO status is a binary conceptual entity. The value assigned to it indicates the status during the execution of a CLOSE, DELETE, READREWRITE, START, or WRITE statement, the status before the execution of any command statement associated with the IO statement, or the status before the execution of any applicable USEAFTERSTANDARDEXCEPTION procedure. The IO status value is made available to the COBOL program by using the FILESTATUS clause in the file control clause of the file. The IO status also determines whether an applicable USEAFTERSTANDARDEXCEPTION procedure is executed. If it is not covered by any of the conditions under the heading "Successful completion", the procedure is executed according to the rules described elsewhere. If it is a condition listed under the heading "Successful completion", the procedure is not executed (see 4.6 USE statement). Certain classes of I() status values ​​indicate critical error conditions. These are: any error condition beginning with the mathematical 3 or 4 and any error condition beginning with the number 9 defined by the implementer as critical. If the I_0 status value for an I/O operation indicates this error condition, the implementer determines the action to be taken after executing any applicable USEAFTERSTANDARDEXCEPTIO>N procedures, or if none of the above procedures are available, the implementer determines what action to take after the standard processing of the I/O control system error. The IO status indicates one of the following conditions depending on the completion of the I/O operation: (1) Successful completion. The I/O statement is successfully executed. (2) Terminal reached. As a result of the terminal condition, a subsequent READ statement is not successfully executed. (3) Invalid key. As a result of a valid condition, the I/O statement is not successfully executed. (4) Permanent error. The I/O statement is not successfully executed because an error has occurred that prevents further processing of the file, and the specified exception procedure is executed. The condition remains in effect for the remainder of the I/O operation unless the implementer-defined technique for correcting the permanent error condition is invoked.
(5) Logical error. An input/output statement was not successfully executed as a result of an inappropriate input/output operation being performed on a file or as a result of a violation of an application-defined restriction. (6) Implementer-specified. An input/output statement was not successfully executed because an implementer-specified condition was satisfied. The following are the I-state values ​​for the conditions listed above, which are generated after an input/output operation is performed on a corresponding file. If more than one value applies, it is up to the implementer to determine which of the available values ​​to put in the I-0 state. (1) End of the function
a. [-] state -00. The input/output statement was successfully executed and no further information is available regarding the input/output operation. b. IO state -04. The KEAD statement was successfully executed, but the length of the record processed was inconsistent with the inherent file attributes of the corresponding file.
T: "[-O status = 05. The OPEN statement was successfully executed. When executing OPEN, the referenced optional file did not appear. If the open mode is 1I-0 or extended mode, the file has been created. (2) Terminal condition for unsuccessful termination
aI-O status = 10. An attempt was made to execute a sequential REAT) statement, and the next logical record does not exist in the file. Because: 1) the end of the file has been reached, or
2) an attempt was made to execute a sequential REAT) statement for the first time on an optional input file that does not appear. bI-( Status = 14. An attempt was made to execute a lazy READ statement for a relative file, and the number of significant digits in the relative record number was greater than the length of the relative key data item described for the file. (3) Invalid key condition that ended unsuccessfully
. 1.0 Status = 22. An attempt was made to write a record that established a duplicate key on a relative file. bI-0 Status = 23. This condition exists because: 1) an attempt was made to randomly access a record that does not exist in a file; or 2) an attempt was made to execute a START or random READ statement for an optional input file that does not exist. GB/T 4092.5—92
c, I-0 state = 24. An attempt was made to write beyond the limits defined for the relative file. The implementor defines the method for defining limits, or an attempt was made to execute sequential WRITE statements for a relative file and the number of significant digits in the relative record number was greater than the length of the relative key data item described for the file.
(4) Permanent error conditions that terminated unsuccessfully a, I-0 state = 30. A permanent error has occurred and no further information is available regarding the input or output operation. b, I-0 state = 35. A permanent error has occurred because an attempt was made to execute an OPEN statement with the IN-PUT, IO, or EXTEND phrase for a non-any file that is not present. c, I-0 state = 37. A permanent error has occurred because an attempt was made to execute an OPEN statement and the file does not support the open mode specified in the OPEN statement. Possible error conditions are: 1) The EXTEND or OUTPUT phrase was specified, but the file does not support write operations. 2) The 1-0 phrase is specified, but the file does not support the input and output operations allowed by the relative file opened in 1-0 mode. 3) The INPUT phrase is specified, but the file does not support read operations. d.1-0O state = 38. A permanent error exists because an attempt was made to execute an OPEN statement on a file that was previously closed with a key. e.
conflict.
I-0 state = 39. The OPEN statement was not executed successfully because of a logical error condition between the inherent file attributes and the attributes specified for the file in the program (5) Unsuccessful termination a, IO state 41. An attempt was made to execute an OPEN statement on an open file. bI-O state 42. An attempt was made to execute a CLOSE statement on a file that was not in the open state. cI-O state - 43. In sequential access mode, the last input/output statement executed before the execution of a DELETE or REWRITE statement was not a successful READ statement. dI-0 state = 44. Boundary violation because: 1) An attempt was made to write or overwrite a record that was larger than the maximum record allowed by the RECORDISVARYING clause specified for the file name, or smaller than the minimum record.
2) An attempt was made to overwrite a record in level 1 to a relative file and the length of the record being replaced does not match that of the record being replaced. . 1-0 status = 46. An attempt was made to execute a sequential READ statement on a file opened in input mode or IO mode and a valid next record has not yet been established. Because:
1) The previous START statement was unsuccessful, or 2) The previous READ statement was unsuccessful but did not cause a terminal condition, or 3) The previous READ statement caused a terminal condition. f.1-O status = 47. An attempt was made to execute a READ or START statement on a file that was not opened in input or IO mode.
gI-status = 48. An attempt was made to execute a WRITE statement on a file that was not opened in IO, export or extension mode. h, IO status = 49. An attempt was made to execute an ELETE or REWRITE statement on a file that was not opened in IO mode. (6) Unsuccessful terminal conditions defined by the implementor a, J-0 status = 9X. An implementer-defined condition exists. This condition cannot overlap with any of the 1-0 status values ​​00 to 49. The value of X is implementer-defined. 1.3.5 Invalid Key Condition
The INVALIDKEY condition may occur as a result of executing a START, READ, WRITE, REWRITE, or DELETE statement. When an invalid key condition occurs, execution of the input/output statement that recognizes the condition is unsuccessful and the file is not affected (see 4.3 DELETE statement; 1.5 READ statement: 4.6 REWRITE statement: 4.7 START statement, 4.9 WRITE statement). If an invalid key condition occurs after executing an input/output operation specified by an input/output statement, it is processed in the order given below:
CB/T 4092. 5-92
(1) A value is placed in the 10 status of the file link area of ​​the relevant statement to indicate an invalid key condition (see 1.3.4 I-0 status). (2) If the INVALIDKEY phrase is specified in the statement that generates the condition, control is transferred to the INVALIDKEY directive statement, and any USEAFTEREXCEPTION procedure specified for that statement is not executed. Execution then continues according to the rules for each statement specified in the directive statement. If a branch procedure or conditional statement that causes an explicit transfer of control is executed, control is transferred according to the rules of that statement: otherwise, until the directive statement specified in the INVALIDKEY phrase is completed, control is transferred to the end of the input/output statement and the VOTINVALIDKEY phrase (if specified) is ignored. (3) If the INVALIDKEY phrase is not specified in the input/output statement, a USEAFTEREXCEPTIC>N procedure must be associated with the file link area, that procedure is executed and control is transferred according to the rules of the USE statement. If the NOTINVALID phrase is specified, it is ignored (see 4.8 USE statement). If the invalid key condition does not exist after the input/output operation specified by the input/output statement is executed, the specified INVALIDKEY phrase is ignored. The IO status of the file connection area associated with the statement is updated and the following actions occur: (1) If an exception condition exists that is not a valid key condition, control is transferred according to the rules of the USE statement after executing any USEAFTEREXCEPTION procedures associated with the file connection (see 4.8 USE statement). (2) If no exception condition exists, control is transferred to the end of the input/output statement or to the command statement specified in the NOTINVALIDKEY phrase (if specified). In the latter case, execution continues according to the rules for each statement specified in that command statement. If a branch procedure is executed or a conditional statement that causes an explicit control transfer is executed, control is transferred according to the rules of that statement; otherwise, control is not transferred to the end of the input/output statement until the command statement in the NOTINVALIDKEY phrase is executed.
1.3.6 Terminal Condition
The terminal condition can be generated as a result of the execution of a READ statement. For details on the generation of this condition, see 4.5 READ statement. 1.3.7 File attribute conflict conditions
File attribute conflict conditions may occur when executing OPEN, REWRITE, or WRITE statements. When a file attribute conflict condition occurs, the input and output statements that recognize this condition are executed unsuccessfully and the file is not affected (see 4.4 OPEN statement; 4.GREWRITE statement, 4.9 WRITE statement).
When a file attribute conflict condition is recognized, the following sequence of actions occurs: (1) The 1-0 status associated with the file name is assigned to indicate the file attribute conflict condition (see 1.3.4 1-0 status). (2) The USEAFTEREXCEPTON procedure associated with the file name (if any) is executed. 2 Environment section of relative 1-0 module
2.1 Input-output section
For information related to the input-output section, see 2.1 of the sequence 1-0 module. 2.2 FILE-CONTROL segment
For information related to the FILE-CONTROL segment, see 2.2 of the sequence I-) module. 2.3 File control clause
2.3.1 Function
The file control clause describes the relevant physical properties of a relative file. 2.3.2 General format
SELECT OPTIONAL]File name1
[Implementation name1]
ASSIGNTO
[Word value1
RESERVEInteger1
GE/T 4092. 5-92
[ORGANIZATION IS RELATIVE
SEQUENTIAL[RELATIVEKEYISData name1(RANDOM
ACCESS MODE IS
DYNAMIC
[FIL.E STATUS IS Data name 2].
2.3.3 Syntax rules
RELATIVEKEYIS data name 1
(1) The SELECT clause must be specified first in the file control clause. The clauses following the SELECT clause can appear in any order.
(2) Each file described in the data section must be named only once in the FILE-CONTROL segment. Each file specified in the SELECT clause must have a file description clause in the data section of the same program. (3) Word value 1 must be a non-numeric word value and cannot be a symbolic constant. Implementation name 1 The meaning and rules of the allowed contents and the value of word value 1 are defined by the implementer.
2.3.4--General rules
(1) If the file link referenced by file name 1 is an external file link (see the inter-program communication module 4.5 EXTERNAL clause), then all file control clauses in the execution unit that reference this file connector must: have the same description of the OPTIONAL phrase.
Have a consistent description of implementation name 1 or word value 1 in the ASSIGN clause. The implementer specifies the same value for integer 1 in the RESERVE clause. Same organization.
Same access method.
The data name 1 in the RELATIVEKEY phrase has the same external data item. (2) Data items on external media use the native character set. (3) The OPTIONAL phrase is only used for input,IO or extended mode. This phrase is necessary for files that are not used in every run of the target program. (4) The ASSIGN clause specifies the association between the file referenced by file name 1 and the storage medium referenced by implementation name 1 or word value 1.
(5) The RESERVE clause of the relative 1-O module is the same as the RESERVE clause of the sequential 1-O module. Therefore, the definition of the RESERVE clause is in 2.9 of the sequential 1-O module. (6) The FILESTATUS clause of the relative IO module is the same as the FILESTATUS clause of the sequential IO module. Therefore, the content of the FILESTATUS clause is in the sequential IO module: the content of the FILESTATUS sub-data item of the relative file is in 1.3.41-0 status.
(7) The ACCESSMODE clause and the ORGANIZATIONISRELATIVE clause are listed below. 2.4ACCESSMODE clause
2.4. 1 Function
The ACCESS MODE clause specifies the access sequence of records in a file. 2.4.2 General format
ACCESS MODE IS
2.4.3 Syntax rules
SEQUENTIAL[RELATIVE KEY IS datanameI](RAND)M
DYNAMIC
RELATIVEKEYIS dataname1
(1) Dataname1 can be restricted.
GB/T4092.5--92
(2) Dataname1 must refer to an unsigned integer data item whose description does not contain the PICTURE symbol \P\. (3) Dataname1 cannot be defined in the record description clause of the file name. (4) The ACCESSMODEIS RANDOM clause cannot be specified for a file name specified in a USING or GIVING clause in a SORT or MERGE statement.
(5) If a relative file is referenced in a START statement, the RELATIVE KEY phrase in the ACCESSMODE clause must be specified for the file.
2.4.4 General Rules
(1) If no ACCESS MODE clause is specified, sequential access is assumed. (2) If the access mode is sequential, the records in the file are accessed in the order specified by the file organization. For a relative file, this order is in ascending order of the relative record numbers of the records already in the file. (3) If the access mode is random, the value of the relative key data item of the relative file specifies the record to be accessed. (4) If the access mode is dynamic, the records in the file may be stored sequentially and/or randomly. (5) All records stored in the relative file are uniquely identified by relative record numbers. The relative record number given to a record specifies the logical sequential position of the record in the file. The first logical record has relative record number 1, and subsequent logical records have relative record numbers 2, 3, 4, and 5. (6) The data item specified by data name 1 is used to communicate relative record numbers between the user and the mass storage control system (MSCS).
(7) The relative key data item associated with the execution of input and output statements is the data item referenced by data name 1 in the ACCFSSMODE statement.
(8) If the associated file connector is an external file connector, each file control clause in the operation unit associated with the file connector must specify the same access mode. In addition, data name 1 must reference an external data item and in each case the RELATIVE KEY phrase in each associated file control clause must reference the same external data item. 2.5 (ORGANIZATIONISRELATIVE) Clause 2.5.1 Function The ORGANIZATIONISRELATIVE clause specifies that the logical structure of a document is a relative organization. 2.5.2 General format [ORGANIZATIONISRELATIVE] 2.5.3 General rules (1) The ORGANIZATIONISRELATIVE clause specifies that the logical structure of a document is a relative organization. The document organization is established when the document is created and cannot be changed thereafter. (2) Relative organization is a permanent logical structure. A volume structure in which each record is uniquely identified by an integer value greater than zero that specifies the logical sequential position of the record in the file. 2.6 IO-CONTROL SEGMENT
2.6.1 Function
The IO-CONTROL. segment indicates the point at which reruns are established and the storage area shared by different files. The RERUN clause in the IO-CONTROL segment is considered obsolete in this version of Standard COBOL because it will be deleted in future revisions of Standard COBOL.
2.6.2 General Format
IO-CONTROL.
RECORDS>F Document name 2
integer 1
Document name 1iEVERY integer 2
RERUN ON
implementation name 1]
CLOCK-UNITS
(Condition name 1
GB/T 4092. 5—92
[SAME[RFCORDAREAFOR Document name 3
{Document name 4}]]
2.6.3—General rules
(1) The RERUN clause of the relative IO module is a sub-nest of the RERUN clause of the sequential IO module. Therefore, the definition of the RERUN clause is as given in 2.12 RERUN clause of the sequential IO module. (2) The SAME clause of the relative IO module is the same as that of the sequential IO module. The SAME clause of the block is the same. Therefore, the provisions of the SAME clause refer to 2.13 SAME clause of the sequence I-0. 3 Data section of the relative I-0 module
3.1 File section
For information about the file section, refer to 3.1 File section of the sequence I-0 module. 3.2 File description clause
: 3.21 Function
The file description clause provides information about the physical structure, identification and record name of a relative file, 3.2. 2 General format
FD file name1
BLOCKCONTAINS[integer1 TO] integerCONTAINS integer3 CHARACTERS
(RECORDS
CHARACTERS
[RECORD
ISVARYINGINSIZEFROM integer4LTO integer5JCHARACTERS[DEPENDINGON data name1]
CONTAINS integer6 TO integer7 CHARACTERSLABEI
RECORDIS
(STANDARD
RECORDS AREOMITTED
VALUEOF implementation name1
RECORDIS
data name2
word value1
1data name31
RECORDS ARE
3.2.3 Syntax Rules
(1) The level indicator FD marks the beginning of the file description clause and must be located before the file name 1. (2) The order in which the clauses following the file name 1 appear is arbitrary. (3) The file description clause must be followed by one or more record description clauses. 3.2.4 General Rules
(1) The file description clause associates the file name 1 with a file connector. (2) The BLOCKCONTAINS clause of the relative IO module is the same as the BIOCKCONTAINS clause of the sequential IO module. Therefore, see the sequential IO module for the BLOCKCONTAINS clause. (3) The DATARECORDS clause of the relative IO module is the same as the DATAREOCRTDS clause of the sequential IO module. Therefore, see the sequential IO module for the provisions of the DATARECORDS clause. The DATARECORDS clause is considered obsolete in this version of Standard COBOL because it will be deleted in future revisions of Standard COBOL. (4) The LABELRECORDS clause of the relative IO module is identical to the LABELRECORDS clause of the sequential IO module. Therefore, the provisions regarding the LABELRECORDS clause are given in the sequential IO module.The LABELRECORDS clause is considered obsolete in this version of the COBOL standard because it will be deleted in a later revision of the COBOL standard. GB/T 4092.5—92
(5) The RECORD clause for a relative IO module is identical to the RECORD clause for a sequential IO module. Therefore, the provisions regarding the RECORD clause refer to the sequential IO module. (6) The VALUEOF clause for a relative IO module is identical to the VALUEOF clause for a sequential IO module. Therefore, the provisions regarding the VALUEOF clause refer to the sequential IO module. The VALUEOF clause is considered obsolete in this version of the COBOL standard because it will be deleted in a later revision of the COBOL standard. 4 Procedure section for relative IO module
·General description
When a USE statement for a relative IO module appears in a COBOL source program, the procedure section contains the procedure described in the section. The following is the general format of the procedure section when the LSE statement appears. PROCEDURE DIVISION.
DECLARATIVES.
{section name SECTION.
LSE statement
[segment name[sentence
FNID DECLARATIVES.
1section name SECTION
[segment name.
[sentence
4. 2 CLOSE Statement
4.2.1 Function
CL()SE statement ends with the processing of files with optional locks. 4.2.2 General format
CLOSE file name 1
4.2.3 Syntax convention
[WITH LOCK] -
(I) The files referenced in a CLOSE statement need not all have the same organization or access mode. -General Rules
(1) A CLOSE statement can only be executed for files in open mode. (2) For files of the type non-sequential single or multiple volumes or units. The results of each CLOSE statement for such files are summarized in Table 1.
CIOSE Statement Format
CLOSE WITH I.OCK
File Type: Non-sequential Single or Multiple Volumes or Units A
The following table gives the definitions of the symbols in the table. This is based on whether the file is an input file, an output file, or an input-output file. Otherwise, one definition applies to input, output, and input-output files. A: Closing a File
Input File and Input-Output File (Sequential Access Mode): If the file locates its end and indicates that the file has a label record, the label is processed according to the implementer's standard label convention. When the specified label record H does not appear or when the unspecified label record appears, the behavior of the CLOSE statement is undefined. The system performs the close operation specified by the implementer of GB/T4092.5-92
. If the file is positioned at its end, : the file label record is specified, no label processing is performed, and other close operations specified by the implementer are performed. If the file is not positioned at its end, the close operation specified by the implementer is performed, but the end label processing is not performed.
Input file and input-output file (random load dynamic access mode): output file (random, dynamic or sequential access mode); if the specified file has a label record, the label is processed according to the implementer's standard label convention. When the specified label record does not appear or the unspecified label record appears, the behavior of the CLOSE statement is undefined. The system performs the close operation specified by the implementer. If the file label record is not specified, no label processing is performed, but other closing operations specified by the implementer are performed. B. Lock the file
to lock the file to ensure that the file cannot be opened again during the execution of the run unit. (3) Execution of the CI0SE statement causes the I-O status value associated with file name 1 to be updated (see 1.3.4 I-O status). (4) If the optional input file does not appear, no file end processing is performed and the file bit mask indicator is not changed. (5) After the successful execution of the CI0SE statement, the record area associated with file name 1 is no longer available. If the CLOSE statement is not executed successfully, the availability of the record area is undefined. (6) Following the successful execution of the CLOSE statement, the file leaves the open mode and the H file is no longer associated with the file connector. (7) If more than one file name 1 is specified in a CLOSE statement, the result of executing this CI.OSE statement is the same as if a series of CLOSE statements were written separately in the same order for each file name 1 in the CLOSE statement. 4.3 DEL.FTE Statement
4.3.1 Function
The DELETE statement logically erases a record from a mass storage file. 4.3.2 General format
DELETE file name IRECORD
[INVALIDKEY command statement]
[NOTINVALIDKEY command statement 2]
[END-DELETE]
4.3.3 Syntax rules
(1) For a DELETE statement that references a file in sequential access mode, the INVALIDKEY phrase and NOTIVVALID KEY phrase cannot be specified
(2) For a DELETE statement that references a file in non-sequential access mode and does not specify the available USEAFTERSTANDARDEXCEPTION procedure, the INVALIDKEY phrase must be specified. 4.3.4 General Rules
(1) When executing this statement, the file referenced by file name 1 must be a mass storage file opened in 1-0 mode (see 4.4 CIPEN statement.
(2) For files in sequential access mode, before the DELETE statement is executed, the last input and output statement executed for file name 1 must be a successfully executed READ statement. MSCS logically deletes the records accessed by the READ statement from the file.
(3) For relative files in random access mode or dynamic access mode, MSCS logically deletes the record identified by the content of the RELATIVEKHY data item associated with file name 1 from the file. The file does not contain the record specified by the key. An INVAI.IDKFY condition is generated (see 1.3.5 Invalid Key Condition). (4) After the successful execution of the DELETE statement, the specified record has been logically deleted from the file and can no longer be accessed. (5) The execution of the DELETE statement does not affect the contents of the record area associated with file name 1, nor does it affect the contents of the data items referenced by the data names specified in the DEPENDINGON phrase of the RECORD clause related to file name 1. GB/T 4092.5-92
(6) The current file position indicator is not affected by the execution of the DELETE statement. (7) The execution of the DELETE statement causes the value of the IO status data item (if any) associated with file name 1 to be updated (see 1.3.4I-0 status).
(8) After the successful or unsuccessful execution of the DELETE operation, the transfer of control depends on whether the optional INVALIDKEY and NOTINVAILIKEY phrases appear in the DELETE statement (see 1.3.5 invalid key conditions). (9) The FND-DELETE phrase limits the scope of the DELETE statement (see the preliminary knowledge 6.6.4.3 Scope of the statement). 4.4 OPEN statement
4.4.1 Function
OPEN statement initialization processing.
4.4.2 General format
INPUT(file name 1}
OUTPUT(file name 2}·*
OPENO(file name]
EXTEND file name 4
4.4.3 Syntax rules
[(1) The EXTENI) phrase can only be used for files in sequential access mode. (2) All files referenced in the OPEN statement do not have to have the same organization or access mode. 4.4.4 General Rules
(1) Successful execution of an OPEN statement determines the availability of a file and places the file in open mode. Successful execution of an OPEN statement associates a file with a document name through a file connector. A file is available if it physically exists and is recognized by the input and output control system. Table 2 shows the results of opening available and unavailable files.
Table 2 Availability of a file
File available
Input (optional file)||t t||I- (optional document)
FXTEND
EXTEND (optional document)
Opening
Normal open
Opening
Normal open
Opening:
Document does not contain records
Normal open
Opening
Document not available
Open failed
Opening; first read produces end condition or invalid key Conditions Open unsuccessful
Open causes file to be created
Open causes file to be created
Open unsuccessful
Open causes file to be created
(2) Successful execution of the OPEN statement makes the associated record area available to the program. If the file connector associated with the file name is an external file connector, there is only one record area associated with the file connector for the execution unit. (3) When a file is not in open mode, no statement that explicitly or implicitly references the file can be executed, except a MERGE comment with a USING or GIVING phrase, an OPEN statement, or a SORT statement with a USING or GIVING phrase. (4) The OPEN statement must be successfully executed before any allowed input-output statement can be executed. In Table 3, the "×" at the intersection indicates that the statement used in the access mode given in the row can be used in the file open mode given at the top of the column. File access mode
GB/T 4092.5-~92
Table 3 Permitted statements
REWRITE
DELETE
REWRITE
DELETE
REWRITE
DELETE
Open mode
Extract-output
5) A file can be opened in the same operation unit using the INPUT, OUTPUT, EXTEND, and IO phrases. After the initial execution of the OPEN statement for a file, each time the next OPEN statement is to be executed for the same file, a CLOSE statement without the LOCK phrase must be executed for the file.
(6) The execution of the OPEN statement does not acquire or release the first data record. (7) If a label record is specified for the file, the label at the beginning of the file is processed as follows: When the INPUT phrase is specified, the execution of the OPEN statement will cause the label to be checked according to the conventions for checking input labels specified by the implementer.
When the OUTPUT phrase is specified, the execution of the OPEN statement will cause the label to be written according to the conventions for writing input labels specified by the implementer.
When a label record is specified and it does not appear, or when a label record is not specified and a label appears, the behavior of OPEN is undefined. (8) If a file attribute conflict condition occurs during the execution of the OPEN statement, the OPEN statement is not executed successfully (see 1.3.7 File attribute conflict conditions).
(9) If the file opened with the INPUT phrase is an optional file that does not exist, the OPEN statement sets the file position indicator to indicate that the optional input file does not exist. (10) For files opened with the INPUT or IO phrases, the OPEN statement sets the file position indicator to 1. GB/T4092.5—92
(11) When the EXTEND phrase is specified, the OPEN statement positions the file immediately after the last logical record of that file. The last logical record of the relative file is the existing record with the largest relative record number. (12) When the EXTEVD phrase is specified and the IABELRCORDS clause indicates that label records exist, the execution of the OPEN statement includes the following steps:
Process the beginning file label only in the case of a single-volume or single-unit file. b.
Process the beginning volume or unit label on the last existing volume or unit as if the file had been opened with the INPIJT phrase.
Process the existing ending file labels as if the file had been opened with the INPUT phrase. These labels are then deleted. Processing is then performed as if the file had been opened with the OUTPUT phrase. d.
(13) An OPEN statement with the IO phrase must reference a file that supports input and output operations that are permitted for the relative file opened in 1-0 mode. After the execution of the OPE statement with the IO phrase, the referenced file is placed in an open mode that permits input and output operations.
(14) When the IO phrase is specified and the LABELRECORDS clause indicates that there is a label record, the execution of the OPFN statement includes the following steps:
a. Check the labels according to the implementer's conventions for checking input and output labels. b. Write the new labels according to the implementer's conventions for writing input and output labels. (15) For an optional file that is not available, the successful execution of an OPEN statement with the EXTEND or IO phrase creates the file. This creation occurs as if the following statements were executed in sequence: OPEN OUTPUT file name.
CLOSE file name.
Execution of the above statements is followed by execution of the OPEN statement specified in the source program. After the OPEN statement with the OUTPUT phrase is successfully executed, a file is created. However, the file does not contain any data records at this time.
(16) The execution of the OPEN statement causes the IO status value associated with the file name to be updated (see 1.3.4 I-O Status). (17) If more than one file name is specified in an OPEN statement, the result of executing this OPEN statement is the same as a series of OPEN statements written separately in the same order for each file name in the OPEN statement. (18) The maximum and minimum record lengths of a file are established when the file is created and cannot be changed later. 4.5READ Statement
4.5.1 Function
For sequential access mode, the READ statement makes the next logical record in the file available. For random access mode, the READ statement makes a specified record in the mass storage file available. 4.5.2 General format
Format 1:
READ file name 1[NEXT]RECORD[INT) identifier 1][ATEND command statement 1][NOTAT END command statement 2][END·READ]Format 2
READ file name 1RECORD[INTO identifier 1][INVALIDKEY command statement 3][NOTINVALIDKEY command statement 4]][END-READ]4.5.3 Syntax rules
(1) The storage area associated with identifier 1 and the record area associated with file name 1 cannot be the same storage area. (2) The EAD statement of format 1 must be used for all volumes in sequential access mode. (3) When retrieving records in sequential mode, the NEXT phrase must be specified for files in dynamic storage.3 Syntax Rules
(1) The storage area associated with identifier 1 and the record area associated with file name 1 cannot be the same storage area. (2) EAD statements of format 1 must be used for all volumes in sequential access mode. (3) When retrieving records in sequential mode, the NEXT phrase must be specified for files in dynamic storage.3 Syntax Rules
(1) The storage area associated with identifier 1 and the record area associated with file name 1 cannot be the same storage area. (2) EAD statements of format 1 must be used for all volumes in sequential access mode. (3) When retrieving records in sequential mode, the NEXT phrase must be specified for files in dynamic storage.Execution of an OPEN statement will cause labels to be checked according to the implementer-specified conventions for checking input labels.
When the OUTPUT phrase is specified, execution of an OPEN statement will cause labels to be written according to the implementer-specified conventions for writing input labels.
The behavior of OPEN is undefined when a label record is specified but not present, or when a label record is not specified but present. (8) If a file attribute conflict condition occurs during execution of an OPEN statement, the OPEN statement is unsuccessful (see 1.3.7 File attribute conflict conditions).
(9) If the file opened with the INPUT phrase is an optional file that does not exist, the OPEN statement sets the file position indicator to indicate that the optional input file does not exist. (10) For files opened with the INPUT or IO phrases, the OPEN statement sets the file position indicator to 1. GB/T4092.5—92
(11) When the EXTEND phrase is specified, the OPEN statement positions the file immediately after the last logical record of that file. The last logical record of the relative file is the existing record with the largest relative record number. (12) When the EXTEVD phrase is specified and the IABELRCORDS clause indicates that label records exist, the execution of the OPEN statement includes the following steps:
Process the beginning file label only in the case of a single-volume or single-unit file. b.
Process the beginning volume or unit label on the last existing volume or unit as if the file had been opened with the INPIJT phrase.
Process the existing ending file labels as if the file had been opened with the INPUT phrase. These labels are then deleted. Processing is then performed as if the file had been opened with the OUTPUT phrase. d.
(13) An OPEN statement with the IO phrase must reference a file that supports input and output operations that are permitted for the relative file opened in 1-0 mode. After the execution of the OPE statement with the IO phrase, the referenced file is placed in an open mode that permits input and output operations.
(14) When the IO phrase is specified and the LABELRECORDS clause indicates that there is a label record, the execution of the OPFN statement includes the following steps:
a. Check the labels according to the implementer's conventions for checking input and output labels. b. Write the new labels according to the implementer's conventions for writing input and output labels. (15) For an optional file that is not available, the successful execution of an OPEN statement with the EXTEND or IO phrase creates the file. This creation occurs as if the following statements were executed in sequence: OPEN OUTPUT file name.
CLOSE file name.
Execution of the above statements is followed by execution of the OPEN statement specified in the source program. After the OPEN statement with the OUTPUT phrase is successfully executed, a file is created. However, the file does not contain any data records at this time.
(16) The execution of the OPEN statement causes the IO status value associated with the file name to be updated (see 1.3.4 I-O Status). (17) If more than one file name is specified in an OPEN statement, the result of executing this OPEN statement is the same as a series of OPEN statements written separately in the same order for each file name in the OPEN statement. (18) The maximum and minimum record lengths of a file are established when the file is created and cannot be changed later. 4.5READ Statement
4.5.1 Function
For sequential access mode, the READ statement makes the next logical record in the file available. For random access mode, the READ statement makes a specified record in the mass storage file available. 4.5.2 General format
Format 1:
READ file name 1[NEXT]RECORD[INT) identifier 1][ATEND command statement 1][NOTAT END command statement 2][END·READ]Format 2
READ file name 1RECORD[INTO identifier 1][INVALIDKEY command statement 3][NOTINVALIDKEY command statement 4]][END-READ]4.5.3 Syntax rules
(1) The storage area associated with identifier 1 and the record area associated with file name 1 cannot be the same storage area. (2) The EAD statement of format 1 must be used for all volumes in sequential access mode. (3) When retrieving records in sequential mode, the NEXT phrase must be specified for files in dynamic storage.Execution of an OPEN statement will cause labels to be checked according to the implementer-specified conventions for checking input labels.
When the OUTPUT phrase is specified, execution of an OPEN statement will cause labels to be written according to the implementer-specified conventions for writing input labels.
The behavior of OPEN is undefined when a label record is specified but not present, or when a label record is not specified but present. (8) If a file attribute conflict condition occurs during execution of an OPEN statement, the OPEN statement is unsuccessful (see 1.3.7 File attribute conflict conditions).
(9) If the file opened with the INPUT phrase is an optional file that does not exist, the OPEN statement sets the file position indicator to indicate that the optional input file does not exist. (10) For files opened with the INPUT or IO phrases, the OPEN statement sets the file position indicator to 1. GB/T4092.5—92
(11) When the EXTEND phrase is specified, the OPEN statement positions the file immediately after the last logical record of that file. The last logical record of the relative file is the existing record with the largest relative record number. (12) When the EXTEVD phrase is specified and the IABELRCORDS clause indicates that label records exist, the execution of the OPEN statement includes the following steps:
Process the beginning file label only in the case of a single-volume or single-unit file. b.
Process the beginning volume or unit label on the last existing volume or unit as if the file had been opened with the INPIJT phrase.
Process the existing ending file labels as if the file had been opened with the INPUT phrase. These labels are then deleted. Processing is then performed as if the file had been opened with the OUTPUT phrase. d.
(13) An OPEN statement with the IO phrase must reference a file that supports input and output operations that are permitted for the relative file opened in 1-0 mode. After the execution of the OPE statement with the IO phrase, the referenced file is placed in an open mode that permits input and output operations.
(14) When the IO phrase is specified and the LABELRECORDS clause indicates that there is a label record, the execution of the OPFN statement includes the following steps:
a. Check the labels according to the implementer's conventions for checking input and output labels. b. Write the new labels according to the implementer's conventions for writing input and output labels. (15) For an optional file that is not available, the successful execution of an OPEN statement with the EXTEND or IO phrase creates the file. This creation occurs as if the following statements were executed in sequence: OPEN OUTPUT file name.
CLOSE file name.
Execution of the above statements is followed by execution of the OPEN statement specified in the source program. After the OPEN statement with the OUTPUT phrase is successfully executed, a file is created. However, the file does not contain any data records at this time.
(16) The execution of the OPEN statement causes the IO status value associated with the file name to be updated (see 1.3.4 I-O Status). (17) If more than one file name is specified in an OPEN statement, the result of executing this OPEN statement is the same as a series of OPEN statements written separately in the same order for each file name in the OPEN statement. (18) The maximum and minimum record lengths of a file are established when the file is created and cannot be changed later. 4.5READ Statement
4.5.1 Function
For sequential access mode, the READ statement makes the next logical record in the file available. For random access mode, the READ statement makes a specified record in the mass storage file available. 4.5.2 General format
Format 1:
READ file name 1[NEXT]RECORD[INT) identifier 1][ATEND command statement 1][NOTAT END command statement 2][END·READ]Format 2
READ file name 1RECORD[INTO identifier 1][INVALIDKEY command statement 3][NOTINVALIDKEY command statement 4]][END-READ]4.5.3 Syntax rules
(1) The storage area associated with identifier 1 and the record area associated with file name 1 cannot be the same storage area. (2) The EAD statement of format 1 must be used for all volumes in sequential access mode. (3) When retrieving records in sequential mode, the NEXT phrase must be specified for files in dynamic storage.
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.