label :REPEATFOR record , recordpreselect-phrasequery-tuning-phrasevariable = expression1 TO expression2 BY kWHILE expressionTRANSACTIONSTOP-AFTER expressionon-endkey-phraseon-error-phraseon-quit-phraseon-stop-phraseframe-phrasecatch-block catch-blockfinally-block :repeat-bodyNames a record buffer and scopes the buffer to the block. The scope of a record determines when the buffer is cleared and the record is written back to the database. See OpenEdge Getting Started: ABL Essentials for more information on record scoping and blocks.To access a record in a table defined for multiple databases, you must qualify the record’s table name with the database name. See the Record phrase reference entry for more information.Goes through a table to select the records that meet the criteria you specify in a record-phrase. PRESELECT creates a temporary index that contains pointers to each of the preselected records in the database table. You can then use other statements, such as FIND NEXT, to process those records. Following is the syntax for preselect-phrase:
PRESELECTEACH FIRST LAST record-phrase, EACH FIRST LAST record-phraseBREAK BY expression DESCENDINGFor more information, see the PRESELECT phrase reference entry.Allows programmatic control over the execution of a DataServer query. Following is the syntax for the query-tuning-phrase:
QUERY-TUNING(BIND-WHERE NO-BIND-WHERECACHE-SIZE integerDEBUG SQL EXTENDED NO-DEBUGINDEX-HINT NO-INDEX-HINTJOIN-BY-SQLDB NO-JOIN-BY-SQLDBLOOKAHEAD NO-LOOKAHEADSEPARATE-CONNECTION NO-SEPARATE-CONNECTION)For more information, see the OpenEdge DataServer Guides (OpenEdge Data Management: DataServer for Microsoft SQL Server, OpenEdge Data Management: DataServer for ODBC, and OpenEdge Data Management: DataServer for Oracle).Indicates the name of a field or variable whose value you are incrementing in a loop. The expression1 is the starting value for variable on the first iteration of the loop. The k is the amount to add to variable after each iteration and must be a constant. When variable exceeds expression2 (or is less than expression2 if k is negative), the loop ends. Because expression1 is compared to expression2 at the start of the first iteration of the block, the block can be executed zero times. The expression2 is reevaluated with each iteration of the block.WHILE expressionIdentifies the REPEAT block as a system transaction block. The AVM starts a system transaction for each iteration of a transaction block if there is no active system transaction. See OpenEdge Getting Started: ABL Essentials for more information on transactions.STOP-AFTER expressionIf the block iteration completes before the specified time expires, the timer resets to expression for the next iteration. In other words, the timer is limited to the scope of a single block iteration. If a block with a STOP-AFTER phrase encloses another block or calls another block, the timer continues while the inner blocks execute.
DEFINE VARIABLE cnt as INTEGER INITIAL 0.PROCEDURE bumpCnt:cnt = cnt + 1.END.DO STOP-AFTER 5:RUN bumpCnt.END.Because the STOP-AFTER expression is re-evaluated for each iteration of a looping block, any changes made to the expression during the iteration effect the timer for the block. In the example, the STOP-AFTER time limit is specified by the variable stopTime, which is initially set to 30 seconds. The procedure contains an iterating block which runs a procedure that executes for 10 seconds.On the first iteration of the DO WHILE TRUE loop, stopTime is 30 seconds. The loop executes for 10 seconds, and then divides stopTime by 2. On the second iteration, the stopTime is 15 seconds; again the loop executes for 10 seconds, and then divides stopTime by 2. On the third iteration, the stopTime is 8 seconds. This time, the procedure spinHere runs for 8 seconds and then raises STOP. The STOP condition is handled by the DO block, and then the program displays the message program finished.If a code block is called with a time limit of zero, the block is executed as if the STOP-AFTER phrase was omitted from the block declaration.In this example, procedure foo is run from within a timed block with a 10 second time limit; procedure bar is called from within the timed block, and contains an iterating block that specifies the STOP-AFTER phrase. Because the value of the STOP-AFTER expression evaluates to zero (that is, the current value of the barLimit variable), the block within bar is executed as an untimed block. However, the rules for execution of an untimed block within a timed block apply, so the untimed block in bar is executed with an implicit iteration time limit of 10 seconds.
ON ENDKEY UNDOlabel1, LEAVE label2, NEXT label2, RETRY label1, RETURN return-valueERROR return-value error-object-expressionNO-APPLYFor more information, see the ON ENDKEY phrase reference entry.
ON ERROR UNDOlabel1, LEAVE label2, NEXT label2, RETRY label1, RETURN return-valueERROR return-value error-object-expressionNO-APPLY, THROWFor more information, see the ON ERROR phrase reference entry.
ON QUITUNDO label1, LEAVE label2, NEXT label2, RETRY label1, RETURN return-valueERROR return-value error-object-expressionNO-APPLYFor more information, see the ON QUIT phrase reference entry.
ON STOP UNDOlabel1, LEAVE label2, NEXT label2, RETRY label1, RETURN return-valueERROR return-value error-object-expressionNO-APPLYFor more information, see the ON STOP phrase reference entry.Specifies the overall layout and processing properties of a frame. For more information, see the Frame phrase reference entry.The body of the REPEAT block. Define repeat-body using the following syntax:
repeat-logic
.
.
.
catch-block catch-blockfinally-blockEND .Specifies a CATCH statement that defines error handling code for one or more error types. For more information on catch-block, see the CATCH statement reference entry.Specifies a FINALLY statement that defines the processing that must occur after all other processing in the block occurs. For more information on finally-block, see the FINALLY statement reference entry.Specifies the end of the REPEAT block definition. You must end the REPEAT block definition with the END statement.In this menu procedure, if you press END-ERROR or ENDKEY when the procedure prompts you for your menu selection, any data you have entered as a selection is undone and the procedure continues to prompt you for a menu selection:
REPEAT:FIND NEXT Customer.UPDATE Customer.CustNum.END.
REPEAT PRESELECT EACH Customer:FIND NEXT Customer.UPDATE Customer.CustNum.END.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |