skip to main content

Procedure Division Statements : OPEN

OPEN
General Format
OPEN [ EXCLUSIVE ] 
  { {INPUT } { [Sharing-Phrase] { File-name-1 [ WITH NO REWIND ] } ... } ... 
    {OUTPUT} { File-name-1 [Lock-Option] (only with -CA option)  }
    {I-O   } 
    {EXTEND}
Where Sharing-Phrase is:
  SHARING WITH { ALL OTHER }
Where Lock-Option is:
  { ALLOWING { NO OTHERS } } 
             { ALL       } 
  { {WITH} {LOCK       }    } 
    {FOR } {MASS-UPDATE}
Syntax rules
1.
2.
3.
4.
5.
6.
7.
General rules
1.
2.
A physical file is available if it is physically present and is recognized by the operating environment. The table above shows the results of opening available and unavailable physical files that are not currently open by another file connector. The table below shows the results of opening available physical files that are currently open by another file connector, including those implicitly opened by the SORT and MERGE statements.
 
3.
4.
5.
6.
 
7.
8.
9.
10.
11.
12.
If the I-O phrase is specified, the physical file shall support the input and output statements that are permitted for the organization of that file when opened in the I-O mode. If the physical file does not support those statements, the I-O status value for file-name-1 is set based on your iscobol.file.status * setting and the execution of the OPEN statement is unsuccessful. The successful execution of an OPEN statement with the I-O phrase sets the open mode of file connector referenced by file-name-1 to open in the I-O mode.
13.
 
OPEN OUTPUT file-name.
CLOSE file-name.
 
These statements are followed by execution of the OPEN statement specified in the source element.
14.
15.
A.
B.
C.
16.
17.
18.
19.
20.
A.
B.
i.
ii.
iii.
iv.
 
This file locking mode indicates that other programs can access the file without restriction except that another program may not execute an OPEN OUTPUT while this program keeps the file open
C.
i.
ii.
 
A file open in this mode does not allow any other program to open this file other than with the INPUT phrase. Also, this OPEN will fail if any other programs currently have the file open unless the INPUT phrase was used by all of these other programs
D.
i.
ii.
iii.
iv.
 
This form of file locking does not allow any other programs to open the file, and this OPEN will fail if any other programs currently have the file open.
21.
22.
23.
24.
A.
B.
Examples
Open several files for input, output and i-o
open input  customers invoices purchase-orders
open output rep-customers rep-invoices
open i-o    invoice-detail
Open files and lock them until they get closed
open i-o customers with lock
open input invoices with lock
Open files locking them for massive update or addition
open i-o pay-receipts for mass-update
open i-o pending-invoices for bulk-addition

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