READ AFILE Examples


Example 1:

 

  

READ

DATAFILE,SEQ;VAR1,VAR2,*UC,NAME,*LC

 

Logical file:

DATAFILE

Method:

Sequential (SEQ is a previously defined -1 or -2 numeric variable)

Variables:

VAR1, VAR2 and NAME

List controls:

*UC enabled for NAME only (*LC disables it after NAME)

Partial read:

No semi-colon was specified (full record READ)

 

Example 2:

 

  

READ

MYFILE,RECORD;FIELD1,FIELD2;

 

Logical file:

MYFILE

Method:

Random (RECORD is previously defined 0 or greater numeric variable)

Variables:

FIELD1 and FIELD2

List controls:

None

Partial read:

Semi-colon specified for partial READ

 

Example 3:

 

  

READ

YOURFILE,KEY1,KEY2,KEY3;ACCOUNT,NAME,ADDRESS

 

Logical file:

YOURFILE

Method:

Associative Access Method (AAM) by key(s)

Variables:

ACCOUNT, NAME and ADDRESS

List controls:

None

Partial read:

No semi-colon specified (full record READ)

 

 



PL/B Language Reference PRTPAGE Example READ FILE Examples