Clarification needed..

He All,

I need clarifications for below mentioned points please help me.

1. I have only one record in table and I'll write a two queries like "find first" and "find last". I know that the result will be the same for two queries, but I want to know is there any performance issues with that and what is the difference between two i.e how it selects the records during process.

2. I have one variable definition without NO-UNDO keyword and intial value "aa" . During transaction I ll change the value of variable to "cc". Now due to some error my transaction will get rollback and value of variable will be reseted to "aa". I want to know where exactly the previous value i.e "aa" will be stored when we changed into "cc".
 

TomBascom

Curmudgeon
1) If the WHERE clause results in a unique record then FIRST and LAST are misleading and have no benefit.

a) Misleading because they say to the programmer "there are multiple records being processed" when, in fact only one record is involved.

b) No benefit because the performance is exactly the same with or without them.

If the WHERE clause might return multiple records then FIRST and LAST might improve performance but at the cost of opening a door for bugs while masking the actual performance problem.

c) Bugs due to the FIRST (or LAST) record being elevated above others in a non-relational way. If the record is different that difference should be reflected in a specific key value. If there is just one such record then a unique FIND should find it. If there are multiple records then FIND is, at best, a questionable way to be processing them.

d) The performance problem would be inadequate indexing. Slapping a FIRST on the FIND might make that go away but it changes program behavior and hides the problem rather than fixing it.

2) The lbi file handles this (local before-image). This is a "behind the scenes" mechanism controlled by the 4GL runtime. You have no other control over it and no ability to affect it other than by declaring a variable NO-UNDO and controlling your program's transactions and retries.
 
Top