DO Statement [ SPL to HP C/XL Migration Guide ] MPE/iX 5.0 Documentation
SPL to HP C/XL Migration Guide
DO Statement
Table 6-3. DO Statement
-----------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
-----------------------------------------------------------------------------------------------
| | |
| do-statement: | Similar to SPL: |
| | |
| DO loop-statement UNTIL condition-clause | do loop-statement |
| | |
| | while ( ! (condition-clause) ) ; |
| | |
-----------------------------------------------------------------------------------------------
| | |
| The loop-statement (which may be compound) | The loop-statement (which may be compound) |
| is executed until the condition-clause | is executed until the expression after |
| becomes true. It is always executed at | while becomes false. It is always executed |
| least once. | at least once. |
| | |
| | Note that this test is the reverse of the |
| | SPL version. As shown in the syntax above, |
| | the easiest conversion is to enclose the |
| | SPL condition-clause in parentheses, |
| | precede it with the logical NOT operator |
| | "!", and then add the outer parentheses |
| | required by HP C/XL. |
| | |
| | You could also just invert the condition, |
| | if it's a simple one. For example, "==" |
| | would become "!=" and ">=" would become |
| | "<". |
| | |
-----------------------------------------------------------------------------------------------
Table 6-4. DO Statement Examples
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
| | |
| DO BEGIN | do { |
| X := X + 1; | X = X + 1; |
| A(X) := B(X); | /*could also be: X++; */ |
| END | A[X] = B[X]; |
| UNTIL X=100; | } |
| | while (!(X==100)); |
| | /*test could be: (X!=100)*/ |
| | |
---------------------------------------------------------------------------------------------
MPE/iX 5.0 Documentation