The FILE-CONTROL paragraph allows specification of file-related information.
[ FILE-CONTROL. ][ { Indexed File } ] ...Each indexed file has a primary index which represents the prime record key of each record in the file. Each record is inserted in the file, changed, or deleted from the file based solely upon the value of its prime record key. The prime record key of each record in the file must be unique, and it must not be changed when updating a record. The prime record key is declared in the RECORD KEY clause of the file control entry for the file.Alternate record keys provide alternate means of retrieval for the records of a file. Such keys are named in the ALTERNATE RECORD KEY clause of the FILE-CONTROL Paragraph. The value of a particular alternate record key in each record need not be unique. When these values may not be unique, the DUPLICATES phrase is specified in the ALTERNATE RECORD KEY clause.
SELECT [ {OPTIONAL } ] File-Name{ENCRYPTION }[ COMPRESSION CONTROL VALUE IS Compression-Factor ]{RANDOM }{DYNAMIC }[ COLLATING SEQUENCE IS Alphabet-Name ][ FILE STATUS IS File-Status ][ RESERVE {Integer} [{AREA }] ][ CLASS IS Class-Name ] .
SELECT [ {OPTIONAL } ] File-Name [ FILE STATUS IS File-Status ][ RESERVE {Integer} [AREA ] ][ WITH { COMPRESSION } ... ]{ ENCRYPTION }[ COMPRESSION CONTROL VALUE IS Compression-Factor ][ CLASS IS Class-Name ] .Sequential files are organized so that each record, except the last, has a unique successor record; each record, except the first, has a unique predecessor record. The successor relationships are established by the order of execution of WRITE Statements when the file is created. Once established, successor relationships do not change except in the case where records are added to the end of a file.In sequential files whose organization is LINE SEQUENTIAL, each record is terminated by one or more characters. They are not part of the data record, they are automatically appended to the record after writing and removed after reading.
SELECT [ {OPTIONAL } ] File-Name{LINE }{RECORD}[ FILE STATUS IS File-Status ]{RECORDS} ]{AUTOMATIC}{MANUAL }[ PADDING CHARACTER IS Padding-Character ][ WITH { COMPRESSION } ... ]{ ENCRYPTION }[ COMPRESSION CONTROL VALUE IS Compression-Factor ][ CLASS IS Class-Name ].A sort file is a collection of records to be sorted by a SORT Statement. The sort file has no label procedures which the programmer can control and the rules for blocking and for allocation of internal storage are peculiar to the SORT Statement. The RELEASE and RETURN Statements imply nothing with respect to buffer areas, blocks, or reels. A sort file, then, may be considered as an internal file which is created (RELEASE Statement) from the input file or procedure, processed (SORT Statement), and then made available (RETURN Statement) to the output file or procedure.
SELECT [ {OPTIONAL } ] File-Name[ FILE STATUS IS File-Status ]{RECORDS} ]{AUTOMATIC}{MANUAL }[ PADDING CHARACTER IS Padding-Character ][ CLASS IS Class-Name ]
1. Alphabet-Name, Device-1, Device-2, Device-3, File-Name, Key-Name-1 and Key-Name-2 are User-defined words, as defined in the Definitions section in the Preface of this document.
2. File and Class-Name can be either Data Items or Nonnumeric Literals, as defined in the Definitions section in the Preface of this document.
3. File may contain quotes.
4. Compression-Factor and Integer are Integers, as defined in the Definitions section in the Preface of this document. The value must range from 1 and 100.
5. Data-Item-1, Data-Item-2, Data-Item-3 and Data-Item-4 are Data Items that must appear in the file description entry of the file that they belong to.
6. Data-Item-5, File-Status and Relative-Key are Data Items, as defined in the Definitions section in the Preface of this document.
7. Padding-Character is a one-character Nonnumeric Literal.
1. When the OPTIONAL Phrase is specified, the file can be accessed even if it has not been created before. File operations (OPEN, DELETE, READ, REWRITE, START, WRITE) will be successful and the File-Status will be properly set to allow the program to notice that the file does not exist. If an OPTIONAL file is opened in I-O or in EXTEND mode, it is created.
2. Device-1 can be one of the following reserved words: INPUT, OUTPUT, INPUT-OUTPUT, RANDOM, DISC, DISK, DYNAMIC, EXTERNAL.
3. Device-2 can be one of the following reserved words: INPUT, OUTPUT, INPUT-OUTPUT, RANDOM, DISC, DISK, DYNAMIC, EXTERNAL, LINE ADVANCING, PRINT, PRINTER, PRINTER-1, ADDRESS.
4.
5. INPUT, OUTPUT, INPUT-OUTPUT, RANDOM, DISC, DISK, SORT, MERGE, SORT-MERGE, SORT-WORK are treated as commentaries.
7. File is the name of the file to be opened, changing its value when the file has already been opened has no effect. The runtime Framework follows the rules described in Conceptual Characteristics of a File to resolve the name of the file.
8. When DYNAMIC is specified, if File refers to a variable that is not otherwise defined, the Compiler creates a Working-Storage variable by that name that is PIC X(256). It is the program's responsibility to move a valid file name to this data item prior to opening the file.
9. When EXTERNAL is specified, File is searched between environment variables and configuration properties. If a variable whose name is File is found, then its value is used for the physical file name otherwise File is used as is. There is a small difference between the EXTERNAL clause and the iscobol.file.env_naming (boolean) configuration property. When using EXTERNAL, the search of File in the configuration is performed by the file handler, while when using iscobol.file.env_naming (boolean), the search of File in the configuration is performed by the Framework before passing the file name to the file handler.
10. When ADDRESS is specified, File is searched between Data Division items. The content of the sequential file is sotored in the data item and resides in memory. The data item pointed by File should be alphanumeric. If you wish to share the memory file between two programs in the same run unit, then File should be defined as EXTERNAL or passed as parameter through the Linkage Section.
11. Each File-Name in the Data Division must be specified only once in the FILE-CONTROL paragraph. Each File-Name specified in the SELECT clause must have a file description or a sort description entry in the Data Division of the same program.
12. When the ORGANIZATION Phrase is not specified, the compiler assumes that the file is sequential.
13. COMPRESSION is treated as commentary. Refer to your file system documentation to see if this feature is supported and how to activate it.
14. ENCRYPTION activates file encryption. Refer to your file system documentation to see if this feature requires additional configuration.
15. When the ACCESS Phrase is not specified, the compiler assumes that access mode is sequential.
16.
17. When the RANDOM Phrase is specified, the file is accessed in a programmer-specified order. The I-O Statements may be used to retrieve or store a specific record in the file. Sequential access is not permitted.
18. When the DYNAMIC Phrase is specified, the file is accessed either in a sequential or in a programmer-specified order, depending on the I-O statement being executed.
19. When the COLLATING Phrase is specified, the file will use the collating sequence specified by Alphabet-Name. The behavior depends on the file system being used.
20. File-Status is a two-character conceptual entity whose value is set to indicate the status of an input-output operation during the execution of an I-O statement and prior to the execution of any imperative statement associated with that I-O statement or prior to the execution of any applicable USE AFTER STANDARD EXCEPTION procedure.
21. When the LOCK Phrase is not specified, the lock mode is automatic.
22. When the EXCLUSIVE Phrase is specified, the lock mode is exclusive. The entire file is locked and no other processes can have access to it
23. When the MASS-UPDATE Phrase is specified, the file access is optimized for heavy updates. The actual behavior depends on the file system being used.
24.
25. When the MANUAL Phrase is specified, the lock mode is manual. Records locks are obtained only when the LOCK phrase is explicitly specified on an I-O statement.
26. When the MULTIPLE Phrase is specified in the LOCK ON Phrase, simultaneous locks on multiple records of the same logical file are allowed.
27.
28.
29. Data-Item-1 and Key-Name-1 identify the prime record key of the file.
30. Data-Item-3 and Key-Name-2 identify one of the alternate keys of the file.
31. When the WITH DUPLICATES Phrase is specified, duplicate values are allowed for the key.
32. When the WITH NO DUPLICATES Phrase is specified, only unique values are allowed for the key.
33. When the WITH DUPLICATES Phrase is specified in the RECORD KEY Phrase, the actual behavior depends on the file system being used.
34. The RESERVE clause is treated as a commentary.
35. Class-Name identifies the class that handles the files. It is the file system handler.
36. The PADDING clause is treated as a commentary.
If the CLASS clause is omitted, indexed files are handled based on the iscobol.file.index configuration property.
If the CLASS clause is omitted, binary and relative files are handled based on the iscobol.file.relative and iscobol.file.sequential configuration properties.
If the CLASS clause is omitted, line sequential files are handled based on the iscobol.file.linesequential configuration property.If the size of the memory block is not enough, the block is saved on disk in a temporary directory (the system temporary directory by default, but it can be configured by setting the iscobol.sort.dir configuration property), then the memory block is cleared and used for remaining data.There is a maximum number of temporary files (16 by default, but it can be configured by setting the iscobol.sort.maxfiles configuration property). If this number is not enough, then all the sorted files are merged into a single sorted temporary so the Framework can create more temporary files.
| Copyright (c) 2017 Veryant |
| Contact us |
|
Please share your comments on this manual or on any Veryant product documentation with the email button at the top left |