#dli directive

Use the #dli directive to modify the default DL/I calls that EGL generates from I/O keywords.

Place the directive in the same line as the EGL code it modifies, as in the following example, and continue onto extra lines as necessary:
get myLocation with #dli{
	GU STSCCST (STQCCNO = :myCustomer.customerNo) 
	   STSCLOC (STQCLNO = :myLocation.locationNo) };

The syntax in the above example is not exactly the same as in DL/I. EGL supports a powerful pseudo-DL/I syntax that performs some DL/I formatting for you. For example, EGL converts all names to upper case, adds spaces to names to bring them to eight characters where necessary, and converts EGL relational operators such as "!=" to DL/I equivalents. In addition, EGL accepts host variables (variables defined in the host EGL program and not in the DL/I database) in your pseudo-DL/I calls. In the sample code above, the host variables begin with a colon (:). At generation time, EGL turns these raw materials into properly formatted DL/I calls.

You can use the #dli directive in any of the following circumstances:
  • To add a DL/I command code to extend the function of the call. Examples include using a concatenated key (*C), or excluding a segment in a path call from replacement (*N).
  • To make a get or get next call using a dynamic array as your operand. Filling a dynamic array with a get requires you to make an initial GU call followed by a loop of GN calls until the array is full or DL/I runs out of segment occurrences. Because there is no key field for the array itself (only for members of the array), the default DL/I code that EGL generates does not work. You must create code similar to the following example:
    myOrderArray OrderRecordPart[] {maxsize = 20}; //array of orders
    
    get myOrderArray with #dli{
    	GU STSCCST STSCLOC STPCORD
    	GN STPCORD };
    
    //get the next 20 orders
    get next myOrderArray;
  • To retrieve a segment that is based on a field other than the key, or on a value not in the segment itself.
  • To read all segments in the database, regardless of segment type. This requires a GN with no SSA.
For specific instructions for a number of these tasks, see DL/I examples.