Groups statements into a single block, optionally specifying processing services or block properties. Use an END statement to end a DO block.
This is the syntax for a DO block:
[ label : ] DO { [ FOR record [ , record ] ... ] } [ preselect-phrase ] [ query-tuning-phrase ] [ variable = expression1 TO expression2 [ BY k ] ] [ WHILE expression ] [ TRANSACTION ] [ stop-after-phrase ] [ on-endkey-phrase ] [ on-error-phrase ] [ on-quit-phrase ] [ on-stop-phrase ] { [ frame-phrase ] } : <block of statements> END. |
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 Record phrase for more information.
PRESELECT [ EACH | FIRST | LAST ]record-phrase [ , [ EACH | FIRST | LAST ] record-phrase ]... [ [ BREAK ] { BY expression[ DESCENDING ]}... ] |
For more information, see the PRESELECT phrase.
QUERY-TUNING ( { [ BIND-WHERE | NO-BIND-WHERE ] [ CACHE-SIZE integer ] [ DEBUG { SQL | EXTENDED } | NO-DEBUG ] [ INDEX-HINT | NO-INDEX-HINT ] [ JOIN-BY-SQLDB | NO-JOIN-BY-SQLDB ] [ LOOKAHEAD | NO-LOOKAHEAD ] [ SEPARATE-CONNECTION | NO-SEPARATE-CONNECTION ] } ) |
For more information, see the OpenEdge DataServer Guides (OpenEdge Data Management: DataServer for Microsoft SQL Server and OpenEdge Data Management: DataServer for Oracle).
When variable exceeds expression2 (or is less than expression2 if kis 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. expression2 is re-evaluated on each iteration of the block.
Specifies a time-out value (in seconds) for the block. This is the syntax for the STOP-AFTER phrase:
For more information see STOP-AFTER phrase.
ON ENDKEY UNDO [ label1 ] [ , LEAVE [ label2 ] | , NEXT [ label2 ] | , RETRY [ label1 ] | , RETURN [ return-value | ERROR [ return-value | error-object-expression ] | NO-APPLY ] |
For more information, see the ON ENDKEY phrase.
ON ERROR UNDO [ label1 ] [ , LEAVE [ label2 ] | , NEXT [ label2 ] | , RETRY [ label1 ] | , RETURN [ return-value | ERROR [return-value |error-object-expression]| NO-APPLY ] | , THROW ] |
For more information, see the ON ERROR phrase.
ON QUIT [ UNDO [ label1 ]] [ , LEAVE [ label2 ] | , NEXT [ label2 ] | , RETRY [ label1 ] | , RETURN [ return-value | ERROR [return-value |error-object-expression]| NO-APPLY ] ] |
For more information, see the ON QUIT phrase.
ON STOP UNDO [ label1 ] [ , LEAVE [ label2 ] | , NEXT [ label2 ] | , RETRY [ label1 ] | , RETURN [ return-value | ERROR [return-value |error-object-expression]| NO-APPLY ] ] |
For more information, see the ON STOP phrase.
WITH [ ACCUM [ max-length ]] [ at-phrase ][ ATTR-SPACE | NO-ATTR-SPACE ] [ CANCEL-BUTTON button-name][ CENTERED ] [ color-specification] [ COLUMN expression][n COLUMNS ] [ CONTEXT-HELP ][ CONTEXT-HELP-FILE help-file-name] [ DEFAULT-BUTTON button-name] [ DROP-TARGET ] [[expression] DOWN ][ EXPORT ] [ WIDGET-ID id-number][ FONT expression] [ FRAME frame] [ INHERIT-BGCOLOR | NO-INHERIT-BGCOLOR ] [ INHERIT-FGCOLOR | NO-INHERIT-FGCOLOR ] [ KEEP-TAB-ORDER ][ NO-BOX ] [ NO-HIDE ][ NO-LABELS ][ USE-DICT-EXPS ] [ NO-VALIDATE ][ NO-AUTO-VALIDATE ] [ NO-HELP ][ NO-UNDERLINE ] [ OVERLAY ][ PAGE-BOTTOM | PAGE-TOP ][ RETAIN n] [ ROW expression][ SCREEN-IO | STREAM-IO ] [ SCROLL n][ SCROLLABLE ][ SIDE-LABELS ] [ size-phrase][ STREAM stream| STREAM-HANDLE handle][ THREE-D ] [ title-phrase][ TOP-ONLY ][ USE-TEXT ] [ V6FRAME [ USE-REVVIDEO | USE-UNDERLINE ]] [ VIEW-AS DIALOG-BOX ][ WIDTH n][ IN WINDOW window] |
For more information, see the Frame phrase.
This procedure goes through the Customer table and reduces the CreditLimit to 80000 for those Customers that exceed this amount. The procedure uses a simple DO block to process two statements if the CreditLimit is over 80000. Simple DO blocks are most useful for grouping statements together for conditional situations, such as IF...THEN...ELSE.
r-do.p
The first example, which uses DO, is more efficient than the second: