7 50 2 GET_ENTRY Examples

LANSA Technical

7.50.2 GET_ENTRY Examples

Example 1: Retrieve entry number 5 from a list named #ORDERLINE:

GET_ENTRY   NUMBER(5) FROM_LIST(#ORDERLINE)
 

Example 2: Retrieve entries 7 through 42 from an existing list named #ORDERLINE and increase the value of field #QUANTITY by 10 percent.

DEF_LIST   NAME(#ORDERLINE) FIELDS(#ORDLIN #PRODUCT #QUANTITY #PRICE)
DEFINE     FIELD(#ENTRY) TYPE(*DEC) LENGTH(7) DECIMALS(0)
 
CHANGE     FIELD(#ENTRY) TO(7)
DOWHILE    COND('#ENTRY *LE 42')
GET_ENTRY  NUMBER(#ENTRY) FROM_LIST(#ORDERLINE)
CHANGE     FIELD(#QUANTITY) TO('#QUANTITY * 1.1')
UPD_ENTRY  IN_LIST(#ORDERLINE)
CHANGE     FIELD(#ENTRY) TO('#ENTRY + 1')
ENDWHILE