7. Embedded QUEL for Pascal : Precompiling, Compiling, and Linking an EQUEL Program : Coding Requirements for Writing EQUEL Programs : Pascal Blocks Generated by EQUEL
 
Share this page                  
Pascal Blocks Generated by EQUEL
As mentioned above, the preprocessor may produce several Pascal statements for a single EQUEL statement. However, all the Pascal statements that the preprocessor generates for an EQUEL statement are surrounded by a begin-end block. Thus, the statement:
    if error then
##  deleterow form table 1
will produce legal Pascal code, even though the deleterow statement generates more than one Pascal statement.
Note that multiple EQUEL statements will cause the preprocessor to generate multiple begin-end blocks. Therefore, when placing multiple EQUEL statements in a Pascal if statement, you must surround the whole group of statements with a begin-end block, just as you would for multiple Pascal statements in an if statement. For example:
    if error then 
    begin
##      message 'Deleting because of error'
##      sleep 2
##      deleterow form table 1
    end;
A semicolon always terminates the begin-end block that the preprocessor generates for an EQUEL statement. Therefore, because Pascal does not permit semicolons before the else clause of an if statement, you must surround any single EQUEL statement that precedes an else clause with a begin-end block. For example, the following if statement will cause a Pascal error:
    if error then
##      message 'Error occurred'
        {Preprocessor adds a semicolon here}
    else
##      message 'No error occurred'
By delimiting the then clause with begin-end, you eliminate the error:
    if error then 
    begin
##      message 'Error occurred'
        {Preprocessor still adds semicolon here...}
        end 
        {...but that's okay because there's no semicolon here}
    else
##      message 'No error occurred'