FILEPI Examples


Example 1:

 

LOOP

KEYIN

(enter data for record lookup)

  

FILEPI

8;INFILE

  

READ

INFILE,KEY;VAR1,VAR2...

  

GOTO

NOSUCH IF OVER

  

MOVE

DATA,VAR1

  

MOVE

DATA,VAR2

  

...(additional processing)

  

UPDATE

INFILE;VAR1,VAR2...

  

GOTO

LOOP

.

 

 

NOSUCH

FILEPI

0

  

DISPLAY

(error message)

  

GOTO

LOOP

 

After the KEYIN routine, INFILE is locked from access by other PL/B programs for a maximum of 8 instructions (not including unconditional GOTO, CALL or RETURN instructions), unless previously terminated by a FILEPI 0, PI 0, DISPLAY, KEYIN or PRINT instruction.

 

Example 2:

 

MyList

FILELIST

 

Prime

IFILE

NAME="Prime.isi"

Second

IFILE

NAME="Second.isi"

  

FILELISTEND

 

  

...

 

  

OPEN

MyList

  

...

 

  

FILEPI

2;MyList

 

This example begins by creating a FILELIST containing two ISAM files. During program execution, both files are opened and subsequently both are locked by the single FILEPI statement.

 



PL/B Language Reference FILELIST Example FILL Examples