qp.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
WITH Statement
  Keywords Contents Index                                   Back
 
  WITH <record list> DO
       <statement-block>
 
  Description
 
    A WITH statement allows shorthand reference to one or more
    records. Once a record is listed, it is open. The record's fields
    become directly accessible in the statement block. Multiple
    records are separated by commas. It is unnecessary to precede
    fields with a record name and a period. For example, the following
    two program fragments are equivalent:
 
       VAR
           customer         : person_rec;
           customer_account : account_rec;
       .
       .
       WITH customer, customer_account DO
           BEGIN
           name   := name_input;
           phone  := number_input;
           debit  := money_owed;
           credit := money_payed
           END
 
    and
 
       VAR  customer         : person_rec;
            customer_account : account_rec;
       .
       .
       customer.name           := name_input;
       customer.phone          := number_input;
       customer_account.debit  := money_owed;
       customer_account.credit := money_payed;
 
    If the record list contains multiple records with the same field
    name, only the rightmost record with that field name is accessible
    through the shorthand notation. All other records with the same
    field name require long-hand notation. For example:
 
       VAR
           customer, employee : person_rec;
       .
       .
       WITH customer, employee DO
           BEGIN
           name  := employee_name_input;
           phone := employee_number_input;
           customer.name  := customer_name_input;
           customer.phone := customer_number_input
           END
 
  See also:  Pascal Statement Hierarchy, Structured statement