PreviousNextIndex

{ } Include file reference

Causes ABL to retrieve the statements in a file and compile them as part of the main procedure if it encounters the file’s name inside braces ({}) when compiling the procedure. You can name arguments you want substituted in the file before compilation.

Syntax

{ include-file  
  [ argument ... | { &argument-name = "argument-value" } ... ] } 

Enter the braces ({}) as shown; they do not represent syntax notation in this description.

include-file
argument
&argument-name = "argument-value"
Examples

The r-inc1.p procedure uses externally defined and maintained files (r-fcust.i and r-dcust.i) for the layout and display of a customer report. You can use these same include files in many procedures.

r-inc1.p
FOR EACH Customer NO-LOCK: 
  {r-fcust.i} 
  {r-dcust.i} 
END. 

r-fcust.i
FORM Customer.CustNum Customer.Name LABEL "Customer Name" 
  Customer.Phone FORMAT "999-999-9999". 

r-dcust.i
DISPLAY Customer.CustNum Customer.Name Customer.Phone. 

The r-incl2.p example references an include file (r-show.i) that can take up to five arguments, and the main routine passes four arguments.

r-incl2.p
DEFINE VARIABLE var1 AS INTEGER NO-UNDO INITIAL 9. 
DEFINE VARIABLE var2 AS DECIMAL NO-UNDO INITIAL 6.43. 
DEFINE VARIABLE var3 AS LOGICAL NO-UNDO INITIAL TRUE. 
/* any statements */ 
{r-show.i point-A var1 var2 var3} 
/* any statements */ 

r-show.i
MESSAGE "At" "{1}" "{2}" {2} "{3}" {3} "{4}" {4} "{5}" {5}. 

When the main procedure is compiled, the line referencing the r-show.i include file is replaced by the following line:

MESSAGE At point-A var1 9 var2 6.43 var3 yes 

This example shows how you can use include files to extend ABL. The main procedure uses a new statement, r-show.i, to display the values of fields or variables at various points in a procedure. The include file in this example can handle up to five passed arguments. The main procedure only passes four (point-A, var1, var2, and var3).

The r-custin.p procedure displays a frame for each customer that you can update with customer information. The procedure includes r-cstord.i and passes the named argument &frame-options, and the value of the argument (CENTERED ROW 3 NO-LABEL) to the include file. When the include file references the &frame-options argument, it uses the value of the argument, and therefore displays the OVERLAY frame cust-ord as a centered frame at row 3 without a label.

r-custin.p
FOR EACH Customer: 
  {r-cstord.i &frame-options = "CENTERED ROW 3 NO-LABEL"}. 
  UPDATE Customer.CustNum Customer.Name Customer.Address Customer.Address2 
    Customer.City Customer.State Customer.PostalCode Customer.Phone 
    Customer.CreditLimit WITH FRAME cust-ord. 
END. 

r-cstord.i
FORM "Cust #" AT 1 Customer.CustNum AT 10 SKIP(1) 
  Customer.Name AT 10 
  customer.Address AT 10 
  customer.Address2 AT 10 
  customer.City AT 10 Customer.State Customer.PostalCode SKIP(1) 
  "Phone " AT 1 Customer.Phone FORMAT "999/999-9999" AT 10 
  "Max Crd" AT 1 Customer.CreditLimit AT 10 
  WITH FRAME cust-ord OVERLAY {&frame-options}. 

Include files are particularly useful for using form layouts in multiple procedures, especially if you do not include the keyword FORM or the closing period (.) of the FORM statement. Thus, the following r-incl3.p procedure includes the r-cust.f file as the definition of a FORM statement.

r-incl3.p
FORM {r-cust.f}. 

r-cust.f
Customer.CustNum 
Customer.Name SKIP(2) 
Customer.State 

The r-incl4.p procedure uses the same include file as a layout for a DISPLAY statement:

r-incl4.p
FOR EACH Customer NO-LOCK: 
  DISPLAY {r-cust.f} WITH 3 DOWN. 
END. 

Notes
See also

{ } Argument reference, { } Preprocessor name reference, COMPILE statement, DEFINE PARAMETER statement, RUN statement


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex