|
|
| Author |
Message |
atulrukmangad
New User
Joined: 10 Apr 2006 Posts: 13
|
|
|
|
Hi,
1) I am reading a table using say READ loop. Now based on some condition, I want to read again from the starting value. Is there any Natural Command for this functionality ?
2) In what scenarios can GET SAME be used ?
Atul |
|
| Back to top |
|
 |
References
|
Posted: Mon Jun 26, 2006 1:01 pm Post subject: Re: In what scenarios can GET SAME be used |
 |
|
|
 |
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 1867 Location: Israel
|
|
|
|
From the manual:
| Quote: |
| The GET SAME statement is used to re-read the record currently being processed. It is most frequently used to obtain database array values (periodic groups or multiple-value fields) if the number and range of existing or desired occurrences was not known when the record was initially read. |
O. |
|
| Back to top |
|
 |
vasanthanc
Active User
Joined: 01 Apr 2005 Posts: 59
|
|
|
|
For 1)
You will need to use a repeat loop as below
| Code: |
FLAG := 0
REPEAT
READ STARTING FROM XYZ
stmts
IF condition1
ESCAPE BOTOM
END-IF
stmts
if condition2
FLAG := 1
ESCAPE BOTTOM
END-IF
END-READ
UNTIL FLAG NE 0
End-REPEAT
|
In the above code, when ever condition1 satisifes, it will restart the read loop and when condition2 satisfies, it will come out of read loop. Hope this is what you needed. |
|
| Back to top |
|
 |
|
|