INTOUCH®
Guided Query Language


Previous Contents Index

6.16 NEW

FORMAT:


        NEW 

EXAMPLE:


        NEW 

PURPOSE:

Use NEW to instruct GQL to start a new report from scratch.

ADDITIONAL:

NEW clears memory of previous report commands and prepares for the new report.

Note

SAVE your file before using the NEW command if the file is one you wish to keep. (See SAVE.)

6.17 OLD

FORMAT:


        OLD filename 

EXAMPLE:


        OLD client_list 

PURPOSE:

The OLD command gets a previously SAVE'd GQL program and executes the commands as if they were being entered by the user.

To delete previous commands, enter the NEW command before entering the OLD command. If you want to save the previous commands, use the SAVE command before using the NEW command.

ADDITIONAL:

GQL searches for the file specified and loads it into current memory. Filename is the specification for the file you are loading.

6.18 OPEN

FORMAT:


        OPEN [str-syn NAME] filespec [DATAFILE data_file_spec] [SYSTEMSET 'set-name'] 
        OPEN structure-synonym-in-GUIDE_NAMES 

EXAMPLE:


        OPEN product 
 
        OPEN tti_run:vendor 
 
        OPEN cust NAME tti_run:customer 

PURPOSE:

OPEN accesses a structure that you will use in the report. The structure is opened immediately so the field names and attributes are available for reference and error checking.

ADDITIONAL:

str-syn Synonym or nickname to use when referring to the structure within GQL (e.g., CUST for CUSTOMER). If you do not indicate a synonym, you will use the structure's filename to refer to the structure.
filespec Structure to open. The structure name can be any VMS file specification.
datafile The name of an alternate datafile to be used when opening the structure.
systemset For DBMS structures only. This is the name of a system owned set to be used when accessing the records of the primary (first) structure.

On receiving the OPEN command, GQL first checks for a specific structure file name based on the NAME keyword. If NAME is not found, the GUIDE_NAMES database is checked for the structure name. If found, the structure specified in GUIDE_NAMES is opened. If not found, GQL looks for a structure filename.

The first structure opened is considered the primary structure. Other opened structures can only be used as a cross-reference lookup. Currently you can have up to nine structures open.

In other commands, when you refer to fields, you can specify a field name without using the structure name, unless the name is ambiguous. The first structure that has a field with that name will be used.

When GQL executes the OPEN command, GQL searches for the file specified. If the file is not found, GQL will display an appropriate warning message. If the file is found, GQL opens the structure and reports on the number of fields in the record. GQL now has all pertinent information related to the file such as:

6.18.1 OPEN ... ROUTINE

FORMAT:


        OPEN [str-syn NAME] filespec ROUTINE rtn_name 

EXAMPLE:


        OPEN product ROUTINE check_product 
 
        OPEN tti_run:vendor ROUTINE check_vendor 
 
        OPEN cust NAME tti_run:customer ROUTINE check_status 

PURPOSE:

The OPEN ... ROUTINE command allows you to designate a user-written routine that will be run every time a record is read from the structure that is being opened.

ADDITIONAL:

The user-written routine will be run after any EXTRACT, SET or FOR EACH command used with the structure.

Note

The named routine will need to check for a current record because GQL will run the routine regardless of whether records were extracted or not.

The routine must exist in an %INCLUDE'd file. When GQL processes the %INCLUDE command, it checks to see that the file exists, but it does not check to see that the routine itself exists in the file.

If this statement were to be used:


        OPEN CUST NAME CUSTOMER ROUTINE CUST_TRANSLATE_FLAGS 
every time a customer record was retrieved in some way, the CUST_TRANSLATE_FLAGS routine would be run.

6.19 OUTPUT

FORMAT:


        OUTPUT report_filename [UNIQUE] 

EXAMPLE:


        OUTPUT invoice_report 

PURPOSE:

GQL normally creates a temporary program which in turn creates a temporary report file with the name "GUIDE_LIST_xxxxxx.TMP". If the report is to be saved for later printing, it can be useful to give it a more appropriate name. The default output file extension is ".LIS".

The UNIQUE qualifier adds a unique alpha-numeric string to the filename extension to guarantee that the filename will be unique. For example, the command OUTPUT INVOICE UNIQUE causes GQL to save the report in a filename similar to:



INVOICE.LIS_850001

6.20 PRINT

FORMAT:


        PRINT [print_keyword] item1 [options] [, item2 [options . . .] 

EXAMPLE:


        PRINT name 
 
        PRINT prodnbr, desc, price 
 
        PRINT CUME price 
 
        PRINT addr HEADING 'Address' 

PURPOSE:

The PRINT command tells GQL which field(s) or item(s) to print on the report and establishes a new column to print. You can specify more than one column by separating field names or items with commas.

print_keyword Optional word CUME or PERCENT. See below.

ITEM is the item to print. Each item can be:
  A field PRINT price
    PRINT customer(name)
  A user variable PRINT custname$
  An expression PRINT price * quantity

ADDITIONAL:

The PRINT command causes GQL to paste a mock-up of the field or item on the screen. If more than 80 columns are required to display all the requested fields, GQL will automatically switch to the 132-column mode. Use PRINT to access and display any item or field you want to use in your report.

Printing Elements of Arrays

To print an element of an array, specify the element number using a # character. For example:


        PRINT customer(address#1) 
        PRINT customer (address#index%) 

PRINT Keywords

After the word PRINT, you can use one of the following optional keywords: CUME or PERCENT



PRINT CUME - Print a Cumulative Running Total.

PRINT PERCENT - Print a percentage of an amount.

PRINT PERCENT expression OF [TOTAL] expression - Print percentage of total amount.

Example 6-20 Example of PRINT Command and Mock Report


DD-MON-YYYY                    Report on DETAIL                        Page: NNN 
                                                                        Pos:  44 
     Line 
     Item  Prod  Order    Selling   Extended 
      ID#   Nbr    Qty      Price      Price 
--------- ----- ------ ---------- ---------- 
XXXXX-XXX XXXXX XX,XXX XXX,XXX.XX XXX,XXX.XX 
 
 
 
 
 
+--------------------------------- Commands -----------------------------------+ 
|OPEN DETAIL                                                                   | 
|SORT BY LINEID                                                                | 
|PRINT LINEID, PRODNBR, QTY, PRICE, EXTPRICE                                   | 
|                                                                              | 
|                                                                              | 
|                                                                              | 
+------------------------------------------------------------------------------+ 
Guide> 
 
 
EXIT = Exit             INTOUCH Guided Query Language                HELP = Help

Example 6-21 Example of PRINT Command - Commands


OPEN DETAIL 
SORT BY LINEID 
PRINT LINEID, PRODNBR, QTY, PRICE, EXTPRICE 
GO 

Example 6-22 Example of PRINT Command - Output


22-Jan-1999   Report on DETAIL        Page 1 
 
     Line 
     Item  Prod  Order    Selling   Extended 
      ID#   Nbr    Qty      Price      Price 
--------- ----- ------ ---------- ---------- 
10301-001 31150      1   2,495.00   2,495.00 
10301-002 22800      2     375.00     750.00 
10301-003 24200      1     299.00     299.00 
10301-004 22800      1     375.00     375.00 
10301-005 31020      1     595.00     595.00 
10301-006 22800      2     375.00     750.00 
10301-007 33090      2   1,495.00   2,990.00 
10301-008 31150      8   2,495.00  19,960.00 
10301-009 28800      2     249.00     498.00 
10302-001 28400      3     149.00     447.00 
10303-001 33090      1   1,495.00   1,495.00 
10303-002 24200      3     299.00     897.00 
10303-003 31030      2     795.00   1,590.00 
10304-001 33180      1   2,095.00   2,095.00 
10304-002 20120      2   1,495.00   2,990.00 
 
                        Press the RETURN key to continue 


Previous Next Contents Index