label :DOFOR record , recordpreselect-phrasequery-tuning-phrasevariable = expression1 TO expression2 BY kWHILE expressionTRANSACTIONSTOP-AFTER expressionon-endkey-phraseon-error-phraseon-quit-phraseon-stop-phraseframe-phrase :do-bodyNames the buffer you want to work with in the block and scopes the buffer to the block. The scope of a record determines when the buffer for that record is cleared and written back to the database. See OpenEdge Getting Started: ABL Essentials for more information on record scoping.To work with 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.
PRESELECTEACH FIRST LAST record-phrase, EACH FIRST LAST record-phraseBREAKBY expression DESCENDINGFor more information, see the PRESELECT phrase reference entry.
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).The name of a field or variable whose value is incremented 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 it must be a constant. The k defaults to 1. The variable, expression1 and expression2 must be integers.When variable exceeds expression2 (or is less than expression2 if k is negative) the loop ends. Since 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 re-evaluated on each iteration of the block.WHILE expressionIdentifies the DO block as a system transaction block. The AVM starts a system transaction for each iteration of a transaction block if there is not already an 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-APPLY
For 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 on frame-phrase, see the Frame phrase reference entry.The body of the DO block. Define do-body using the following syntax:
do-logic
...
catch-block catch-blockfinally-blockEND .Specifies a CATCH statement that defines error handling code for one or more error types. Since a DO block does not have any default error handling, a CATCH block is only valid within it if the block specifies error handling options. At this point, the block can raise ERROR and a CATCH block is valid to handle errors. If a DO block does not have error handling options and specifies a CATCH block, ABL generates a compiler warning. 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 DO block definition. You must end the DO block definition with the END statement.
DO ix = 1 TO 12:SalesRep.MonthQuota[ix] = 0.END.
REPEAT ix = 1 TO 12:SalesRep.MonthQuota[ix] = 0.END.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |