Products Downloads


French version


 

 

ADELIA

VADELIA

SADELIA

WADELIA

MADELIA

(I/B)

(I/B) (S)

(B) (S)

(I/B) (S)

(I) (S)

 

Section for use

All

 

Syntax

READ_P_EQUAL ViewName Option Parameter

 

Option

*UNLCK | None

 

 

 

Parameter

*NO_MR | *MR | None

 

Description

This instruction involves a sequential reading by key of the previous record of the file corresponding to the view ViewName, with test of equality on the key.

 

It is possible to test whether the reading was successful by an instruction of the type:

 

IF ViewName EXISTS

or

IF ViewName DOES_NOT_EXIST.

 

DOES_NOT_EXIST is TRUE if the beginning of the file is reached, or if the key is different from the one to process.

 

If the read operation is not completed successfully, the system will not read any records at all, and the values of the file fields will remain unchanged.

 

You can also check that the record is not locked, by testing it with the *LOCKED reserved word:

If *LOCKED = 1

The record is locked.

If *LOCKED = 0

The record is not locked.

 

By default, file records are locked after being read if the file's view ViewName is declared in update mode and the *UNLCK reserved word is not used.

See the UNLOCK instruction which enables a file record to be released.

 

If *UNLCK is mentioned, the reading does not lock the record. This parameter, used on a file opened in update mode, obtains the same effect as if it had been declared in read-only mode.

 

The *MR parameter allows you to generate read implicit management rules that are linked to the entity corresponding to the view, even if the program is generated without the option to generate implicit management rules.

 

The *NO_MR parameter allows you not to generate read implicit management rules that are linked to the entity corresponding to the view, even if the program is generated with the option to generate implicit management rules.

 

Example

Example for SALES file (file keys are customer code and line number);

SALES view is used only with W_CUST_CODE as access key.

 

SALES_CUST_CODE

SALES_LINE_NBR

0002

01

0002

02

0002

03

0002

04

0006

01

0006

02

0011

01

 

W_CUST_CODE = '0006'

READ_LAST SALES

*

* This will position the pointer on line 02 of customer 0006

*

DO_WHILE SALES EXISTS

PRINT_VIEWS DETAIL_LINE

READ_P_EQUAL SALES

* This reads all the records for customer 0006 up to line 01

REDO

 

↑ Top of page


  • Aucune étiquette