OPEN FILE Examples


Example 1:

 

  

OPEN

TIMECARD,"PAYDATA"

 

Logical file:

TIMECARD

Text file:

PAYDATA.??? (.TXT under SUNDB86x or as defined in screen definition file under PLBCMP)

Mode:

SHARE (by default)

 

Example 2:

 

CMP_SHARENF

INTEGER

4,"0x20"

  

OPEN

TRANSFLE,"GLTRANS.JAN"

 

Logical file:

TRANSFLE

Text file:

GLTRANS.JAN

Mode:

SHARE No Flush

 

Example 3:

 

FILE

FILE

 

RANDOM

INIT

"control.data|www.server.net"

.

 

 

  

OPEN

FILE,RANDOM

 

Logical file:

FILE

Text file:

control.data

Mode:

SHARE

 

Example 4:

 

FILE

FILE

 

.

 

 

  

OPEN

FILE,"control.data|209.20.30.5:502"

 

Logical file:

FILE

Text file:

control.data

Server address:

209.20.30.5

Server port:

502

Mode:

SHARE

Example 5:

This example uses a DNS hostname 'www.mysundm.net' to logon to a Data Manager using the default 3934 port number. Also, the file name is being opened in a directory that exists on the Data Manager system.

 

FILE

FILE

 

.

 

 

  

OPEN

FILE,"c:\temp\myfile.txt|www.mysundm.net"

 

Logical file:

FILE

Text file:

c:\temp\myfile.txt

Server address:

www.mysundm.net

Server port:

3934

Mode:

SHARE

 

View Examples

Example 1:

 

FILE

FILE

 

.

 

 

  

OPEN

FILE,"myfile.txt",VIEW="customer"

 

In this case, the data file 'myfile.txt' is being opened and a view named 'customer' is to be used. The 'customer' view name must exist in the 'sun_views' table found in the default schema used by the runtime.

Example 2:

 

FILE

FILE

 

.

 

 

  

OPEN

FILE,"myfile.txt",VIEW="xyzcompany.customer"

 

In this case, the data file 'myfile.txt' is being opened and a view named 'customer' is to be used from the schema database referenced by the name 'xyzcompany'. The 'xyzcompany' name must exist in the default schema database being used by the runtime. The 'xyzcompany' reference identIFies a specIFic schema database that contains the 'customer' view to be used.

Example 3:

 

FILE

FILE

 

.

 

 

  

OPEN

FILE,"myfile.txt|192.168.0.101",VIEW="customer"

 

In this case, the behavior is the same as 'Case1' except the data file is located at a Data Manager. The schema database information is local to the client workstation.

Example 4:

 

FILE

FILE

 

.

 

 

  

OPEN

FILE,VIEW="customer|192.168.0.101"

 

In this case, the schema database information is retrieved from a Data Manager and used to access a data file opened local to a client workstation where the runtime is executing.

Example 5:

 

FILE

FILE

 

.

 

 

 

OPEN

FILE,"myfile.txt|192.168.0.1":

 

 

VIEW="customer|192.168.0.101"

 

In this case, both the schema database information and the data file is accessed at the Data Manager.

 

 



PL/B Language Reference OPEN (AFILE) Examples OPEN (FILELIST) Example