Using FIDEL in Dialogue Manager

In this section:

FIDEL works with all the standard Dialogue Manager facilities. However, the following differences apply when you use FIDEL with Dialogue Manager:

Allocating Space on the Screen for Variable Fields

You must define the length of variable fields in -CRTFORMs. The length of Dialogue Manager variables can be defined in one of two ways:

Starting and Ending CRTFORMS: BEGIN/END

-CRTFORM BEGIN indicates that the form is being built. This Dialogue Manager control statement enables you to use other Dialogue Manager control statements between the screen lines without causing the CRTFORM to end. This is necessary when you are using indexed variables in a looping procedure.

-CRTFORM END terminates the form and causes the display of the assembled form.

Example: Using Indexed Variables With -CRTFORM BEGIN and -CRTFORM END

The following is an example of the use of indexed variables in -CRTFORM. The variable &LINENUM is the indexed variable in the -CRTFORM. The index, &I, is set to increment by 1 each time a line is written. After the 10th line, the -CRTFORM ends. Note the use of the Dialogue Manager label, -BUILD and the -SET statement to control the loop within the form:

 
1.  -SET &I = 0; 
2.  -CRTFORM BEGIN
    -"THE FOLLOWING FORM STORES 10 LINES OF TEXT"
    -" " 
3.  -BUILD 
4.  -SET &I = &I + 1; 
5.  -SET &LINENUM.&I = 'LINE ' | &I; 
6.  -"<D.&LINENUM.&I <&LINE.&I/60" 
7.  -IF &I LT 10 GOTO BUILD; 
8.  -CRTFORM END
    -*
    -TYPE LINE #2 CONTAINS THE FOLLOWING TEXT:
    -TYPE 
9.  -TYPE &LINE2

This example processes as follows:

  1. This -SET statement declares a counter, &I, and sets the counter to 0.
  2. The -CRTFORM BEGIN statement begins the form.
  3. This statement is a Dialogue Manager label, -BUILD. Because we are using the -CRTFORM BEGIN statement, this label does not end the CRTFORM.
  4. This -SET statement sets the counter &I to increment by 1 each time a line is written. This controls the loop within the form.
  5. This -SET statement indexes the variable &LINENUM with the counter &I. Thus, each time it is encountered in the -CRTFORM it will increment +1.
  6. The -CRTFORM will appear as follows:
    THE FOLLOWING FORM STORES 10 LINES OF TEXT
     
    LINE 1
    LINE 2
    LINE 3
    LINE 4
    LINE 5
    LINE 6
    LINE 7
    LINE 8
    LINE 9
    LINE 10

    Type any text you wish onto the lines.

  7. The -IF test allows the loop to process until there are 10 lines in the -CRTFORM. At that point control transfers to the -CRTFORM END statement.
  8. -CRTFORM END ends the -CRTFORM and causes it to be displayed.
  9. The last TYPE statement shows the contents of line 2.

Clearing the Screen in Dialogue Manager

The statement -CRTFORM both initiates the screen form and automatically clears the screen. The screen form begins at the top of the screen.

After the operator enters values for the variables and presses Enter, the variables are supplied with the values and the screen is cleared.

Changing the Size of the Message Area: -CRTFORM TYPE

By default, FOCUS reserves the last four lines of the Dialogue Manager terminal screen for TYPE messages. You can change this by using the keyword TYPE to determine the number of lines each CRTFORM reserves for messages. This feature allows you to increase the number of lines on the screen for CRTFORM display and reduce the number of lines reserved for messages at the bottom of the screen. The syntax is

-CRTFORM TYPE {n|4}

where:

n

Is a number from 1 to 4 indicating the number of message lines desired. The TYPE value setting remains in effect for all subsequent CRTFORMs in the same procedure until overridden by a new value. The default is 4.

You can expand the CRTFORM screen size by specifying a number less than 4. For example, a terminal with a height of 24 lines reserves 20 lines for the CRTFORM and four lines for the TYPE area. If you specify a TYPE area of 2, the CRTFORM area increases to 22 lines.

Annotated Example: -CRTFORM

The following FOCEXEC is an example of a TABLE request incorporating the use of -CRTFORM.

    -* Component Of Retail Sales Reporting Module 
1.  SET &LIST = 'STAMFORD,UNIONDALE,NEWARK'; 
2.  PROMPT &CITY.(&LIST).ENTER CITY.:
    -* 
3.  -CRTFORM
    -"Monthly Sales Report For <D.&CITY"
    -"Date: <D.&DATE     Time: <D.&TOD"
    -" "
    -"Beginning Product Code is:  <&BEGCODE/3"
    -"Ending Product Code is:     <&ENDCODE/3"
    -"Regional Supervisor is:     <&REGIONMGR/15"
    -"Title For UNIT_SOLD is:     <&UNIT_HEAD/10"
  
4.  TABLE FILE SALES
    HEADING CENTER
    MONTHLY REPORT FOR &CITY"
    "PRODUCT CODES FROM &BEGCODE TO &ENDCODE"
    SUM UNIT_SOLD AS &UNIT_HEAD
    AND RETURNS AND COMPUTE
    RATIO/D5.2 = 100 * RETURNS/UNIT_SOLD;
    BY PROD_CODE
    IF PROD_CODE IS-FROM &BEGCODE TO &ENDCODE
    IF CITY EQ &CITY
    FOOTING CENTER
    "REGION MANAGER: &REGIONMGR"
    "CALCULATED AS OF &DATE" 
5.  END

The following is a sample of the dialogue between the screen and the operator. Operator entries are in lowercase.

  1. The -SET statement sets a value for the variable &LIST. The value is actually a list of the names of three cities. They are enclosed in single quotation marks because of the embedded commas.
  2. The -PROMPT statement prompts the operator at the terminal for a value for &CITY. Assume the operator types a city that is not on the list:
    ENTER CITY:
    boston
    PLEASE CHOOSE ONE OF THE FOLLOWING:
    STAMFORD,UNIONDALE,NEWARK
    ENTER CITY:
    stamford
  3. The statement -CRTFORM initiates a screen form on which you type data:
    Monthly Sales Report for STAMFORD
    Date: 01/08/2003               Time: 13.12.41
     
    Beginning Product Code is:     b10
    Ending Product Code is:        b20
    Regional Supervisor is:        smith
    Title For UNIT_SOLD is:        sales
  4. The following are the stacked FOCUS commands as they appear on the FOCSTACK after the values have been entered from the -CRTFORM:
    TABLE FILE SALES
    HEADING CENTER
    "MONTHLY REPORT FOR STAMFORD"
    "PRODUCT CODES FROM B10 TO B20"
    " "
    SUM UNIT_SOLD AS SALES AND RETURNS AND COMPUTE
    RATIO/D5.2 = 100 * RETURNS/UNIT_SOLD;
    BY PROD_CODE
    IF PROD_CODE IS-FROM B10 TO B20
    IF CITY EQ STAMFORD
    FOOTING CENTER
    "REGION MANAGER: SMITH"
    "CALCULATED AS OF 01/08/2003"
    END
  5. The report is as follows:
    PAGE     1
     
      MONTHLY REPORT FOR STAMFORD
     PRODUCT CODES FROM B10 TO B20
     
    PROD_CODE  SALES   RETURNS  RATIO
    ---------  ------  -------  -----
    B10            60       10  16.67
    B12            40        3   7.50
    B17            29        2   6.90
     
                 REGION MANAGER: SMITH
                  CALCULATED AS OF 11/04/03

Information Builders