OPEN AFILE Examples


Example 1:

 

  

OPEN

EMPLMSTR,"EMPDATA"

 

Logical file:

EMPLMSTR

Text file:

Retrieved from AAM key file

AAM file:

EMPDATA.??? (.AAM under SUNDB86x or as defined in screen definition file under PLBCMP)

Key(s):

Retrieved from AAM key file

Record length:

Retrieved from AAM key file

Mode:

SHARE (by default)

Wildcard:

Retrieved from AAM key file

 

Example 2:

 

  

OPEN

EMPLMSTR,"EMMSTR1":

  

  

"^",EXCLUSIVE

 

Logical file:

EMPLMSTR

Text file:

Retrieved from AAM key file

AAM file:

EMMSTR1.??? (.AAM under SUNDB86x or as defined in screen definition file under PLBCMP)

Key(s):

Retrieved from AAM key file

Record length:

Retrieved from AAM key file

Mode:

EXCLUSIVE

Wildcard:

Changed to `^' by the OPEN instruction

 

Example 3:

 

CMP_EXCLUSIVE

INTEGER

4,"0x10"

  

OPEN

EMPLMSTR:

  

  

"EMMSTR1",,MODE=CMP_EXCLUSIVE

 

Logical file:

EMPLMSTR

Text file:

Retrieved from AAM key file

AAM file:

EMMSTR1.??? (.AAM under SUNDB86x or as defined in screen definition file under PLBCMP)

Key(s):

Retrieved from AAM key file

Record length:

Retrieved from AAM key file

Mode:

EXCLUSIVE

Wildcard:

Retrieved from AAM key file

 

Example 4:

 

AFILE

AFILE

 

RANDOM

INIT

"c:\data\myfile|www.server.net"

.

 

 

 

OPEN

AFILE,RANDOM

 

Logical file:

AFILE

Text file:

c:\data\myfile.??? (as defined in screen definition file) at the server

Mode:

SHARE

Server address:

www.server.net

Server port:

3934

 

Example 5:

 

AFILE

AFILE

 

.

 

 

 

OPEN

AFILE,"d:\payroll\myfile|209.20.30.5:503"

 

Logical file:

AFILE

Text file:

d:\payroll\myfile.??? (as defined in screen definition file) at the server

Mode:

SHARE

Server address:

209.20.30.5

Server port:

503

Example 6:

 

AFILE

AFILE

 

.

 

 

 

OPEN

AFILE,"aamfile",CANCELCHAR=F1:

 

 

CHECKTIME=3

 

Logical file:

AFILE

Text file:

myfile.??? (as defined in screen definition file)

Mode:

SHARE

Cancel key:

F1

Check interval:

3 seconds

 

View Examples

Example 1:

 

AFILE

AFILE

 

.

 

 

  

OPEN

AFILE,"myfile.aam",VIEW="customer"

 

In this case, the data file 'myfile.aam' 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:

 

AFILE

AFILE

 

.

 

 

  

OPEN

AFILE,"myfile.aam",VIEW="xyzcompany.customer"

 

In this case, the data file 'myfile.aam' 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:

 

AFILE

AFILE

 

.

 

 

  

OPEN

FILE,"myfile.aam|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:

 

AFILE

AFILE

 

.

 

 

  

OPEN

AFILE,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:

 

AFILE

AFILE

 

.

 

 

 

OPEN

AFILE,"myfile.aam|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.

Example 6:

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.

 

AFILE

AFILE

 

.

 

 

  

OPEN

AFILE,"c:\temp\myfile.aam|www.mysundm.net"

 

Logical file:

AFILE

Text file:

c:\temp\myfile.aam

Server address:

www.mysundm.net

Server port:

3934

Mode:

SHARE

 

 



PL/B Language Reference OCCURS Example OPEN (FILE) Examples