AFILE Examples


Example 1:

 

CUSTFILE

AFILE

BUFFER=345,SEARCHCNT=50,WEOF

 

CUSTFILE is an Aamdex file with the maximum record size of 345 bytes. A maximum of 50 AAM keys is allowed in a READ instruction and all new records are written at the End of File. Deleted record space is not reused.

 

Example 2:

 

PTRFILE

AFILE

^

AFILE1

AFILE

FIXED=332

AFILE2

AFILE

VARIABLE=332

  

...

 

  

CALL

SUB USING AFILE1

  

CALL

SUB USING AFILE2

  

...

 

SUB

LROUTINE

PTRFILE

  

...

 

  

READ

PTRFILE,...

  

...

 

  

RETURN

 

 

PTRFILE is a Pointer Variable that contains the address of another AFILE variable at execution time. This assignment is usually accomplished via the parameterized CALL instruction. Once initialized, PTRFILE may be used as any other AFILE variable. It takes on all the attributes of the pointed to AFILE variable.

 

Example 3:

 

CUSTMAST

AFILE

%

 

This instruction defines a global AAMDEX file. It is kept open during the CHAIN instruction.

 

Example 7:

 

MasterView

INIT

"mydatabase.master"

.

 

 

AFile1

AFILE

VIEW="somedatabase.userview"

or

 

 

AFile1

AFILE

VIEW=MasterView

 

This instruction defines a global AAM file that is associated with a database and a view.

 



PL/B Language Reference ADD Examples ALERT Examples