When you design a Dialogue Manager procedure with variables, you must decide how the variables in the procedure acquires values at run time. You can use and/or combine the following techniques.
You can supply variable values directly in procedures, without prompting users for input, using the following methods:
You can prompt users for variable values using the following methods:
-CRTFORM invokes FIDEL, the FOCUS Interactive Data Entry Language, and incorporates most of its functions. You can also use Screen Painter to design and paint -CRTFORM data entry screens directly on your terminal screen.
Note that the Dialogue Manager command -CRTFORM is used for entering Dialogue Manager amper variable values. The equivalent MODIFY command, CRTFORM (without a hyphen), is used in MODIFY requests to enter field values.
Verifying user input: For values supplied by users, you can also verify input by comparing it against:
The following rules apply to values for variables:
This example illustrates the use of the -DEFAULT and -SET commands to supply values for variables. The end user supplies the value B10 for &CODE1, B20 for &CODE2, and SMITH for ®IONMGR, as prompted by Dialogue Manager.
The numbers to the left of the example apply to the notes that follow:
1. -DEFAULT &VERB=SUM 2. -SET &CITY=IF &CODE1 GT 'B09' THEN 'STAMFORD' ELSE 'UNIONDALE'; 3. -TYPE REGIONAL MANAGER FOR &CITY SET PAGE=OFF 5. TABLE FILE SALES HEADING CENTER "MONTHLY REPORT FOR &CITY" "PRODUCT CODES FROM &CODE1 TO &CODE2" " " &VERB UNIT_SOLD AND RETURNS AND COMPUTE RATIO/D5.1 = 100 * (RETURNS/UNIT_SOLD); BY PROD_CODE IF PROD_CODE IS-FROM &CODE1 TO &CODE2 FOOTING CENTER 4. "REGION MANAGER: ®IONMGR" "CALCULATED AS OF &DATE" END 6. -RUN
The procedure executes as follows:
REGIONAL MANAGER FOR STAMFORD
TABLE FILE SALES HEADING CENTER "MONTHLY REPORT FOR STAMFORD" "PRODUCT CODES FROM B10 TO B20" " " SUM UNIT_SOLD AND RETURNS AND COMPUTE RATIO/D5.1 = 100 * (RETURNS/UNIT_SOLD); BY PROD_CODE IF PROD_CODE IS-FROM B10 TO B20 FOOTING CENTER "REGION MANAGER: SMITH" "CALCULATED AS OF 06/11/03" END
MONTHLY REPORT FOR STAMFORD PRODUCT CODES FROM B10 TO B20 PROD_CODE UNIT_SOLD RETURNS RATIO --------- --------- ------- ----- B10 103 13 12.6 B12 69 4 5.8 B17 49 4 8.2 B20 40 1 2.5 REGION MANAGER: SMITH CALCULATED AS OF 06/11/03
How to: |
-DEFAULT commands set default values for local or global variables. This technique ensures that a value is passed to a variable so that the user is not prompted for the value.
You can issue multiple -DEFAULT commands for a variable. If the variable is global, these -DEFAULT commands can be issued in separate FOCEXECs. At any point before another method is used to establish a value for the variable, the most recently issued ‑DEFAULT command will be in effect.
However, as soon as a value for the variable is established using any other method (for example, by issuing a ‑SET command, retrieving a value input by the user, or reading a value from a file), subsequent ‑DEFAULT commands issued for that variable are ignored.
Note that -DEFAULTS and -DEFAULTH are synonyms for -DEFAULT.
-DEFAULT[S|H] &[&]name=value [...] [;]
where:
Is the name of the variable.
Is the default value assigned to the variable.
Is an optional punctuation character.
Note: -DEFAULTS and -DEFAULTH are synonyms for -DEFAULT.
In the following example, -DEFAULT sets the default value for &PLANT to Boston (BOS):
-DEFAULT &PLANT=BOS TABLE FILE CENTHR . . .
How to: |
Reference: |
You can assign a variable's value by computing the value in an expression or assigning a literal value to a variable with the -SET command. You can also use the IN FILE phrase to test whether a character value exists in a file and populate a variable with the result. The value of the variable is set to 1 if the test value exists in the file and 0 (zero) if it does not.
You can use this technique to supply dates to Dialogue Manager as variable values. A date supplied to Dialogue Manager in a variable cannot be more than 20 characters long, including spaces. Dialogue Manager variables only accept full-format dates (that is, MDY or MDYY, in any order).
If you are working with cross-century dates that do not include a four-digit year, you can use the SET parameters DEFCENT and YRTHRESH variables to identify the century. For details, see Working With Cross-Century Dates.
If you want to set a variable value to a number, the only supported characters you can use are numeric digits, a leading minus sign, and a period to represent following decimal places. These are the only valid characters that Dialogue Manager supports in a number, regardless of EDIT options or the value of CDN.
-SET &[&]name= {expression|value};
-SET &[&]var3= &var1 IN FILE filename1 [OR &var2 IN FILE filename2 ...];
where:
Is the name of the variable.
Is a valid expression. Expressions can occupy several lines, so you must end the command with a semicolon.
Is a literal value, or arithmetic or logical expression assigned to the variable. If the literal value contains commas or embedded blanks, you must enclose the value in single quotation marks.
Is a variable that is populated with the value 1 if the result of the expression on the right side of the equal sign is true, or with the value 0 if the result is false.
Is the variable that contains the value to be searched for in filename1.
Is the variable that contains the value to be searched for in filename2.
-SET &VAR1 = 'ABC '; -SET &VAR2 = &VAR1 IN FILE FILE1;
The DMPRECISION setting enables Dialogue Manager -SET commands to calculate accurate numeric variable values without using the FTOA function.
Without this setting, results of numeric calculations are returned as integer numbers, although the calculations themselves employ double-precision arithmetic. To return a number with decimal precision without this setting, you have to enter the calculation as input into subroutine FTOA, where you can specify the number of decimal places returned.
The SET DMPRECISION command gives users the option of either accepting the default truncation of the decimal portion of output from arithmetic calculations, or specifying up to nine decimal places for rounding.
SET DMPRECISION = {OFF|n}
where:
Specifies truncation without rounding after the decimal point. OFF is the default value.
Is a positive number from 0-9, indicating the point of rounding. Note that n=0 results in a rounded integer value.
The following table below shows the result of dividing 20 by 3 with varying DMPRECISION (DMP) settings:
SET DMPRECISION = |
Result |
---|---|
OFF |
6 |
0 |
7 |
1 |
6.7 |
2 |
6.67 |
9 |
6.666666667 |
In the following example, -SET assigns the value 14Z or 14B to the variable &STORECODE, as determined by the logical IF expression. The value of &CODE is supplied by the user.
-SET &STORECODE = IF &CODE GT C2 THEN '14Z' ELSE '14B'; TABLE FILE SALES SUM UNIT_SOLD AND RETURNS BY PROD_CODE IF PROD_CODE GE &CODE BY STORE_CODE IF STORE_CODE IS &STORECODE END
The use of single quotation marks around a literal is optional unless the literal contains embedded blanks, commas, or equal signs. In these cases, you must include them as illustrated below:
-SET &NAME='JOHN DOE';
In prior releases, to assign a literal value that included a single quotation mark, you had to place two single quotation marks where you wanted one to appear:
-SET &NAME='JOHN O''HARA';
Although this technique still works, it is no longer required. However, to start or end a string with a single quotation mark, you must specify two single quotation marks.
This example supplies dates to Dialogue Manager as variables. The variable &DELAY is set to the difference in days between &LATER and &NOW and the result is returned to your terminal.
-SET &NOW = 'JUN 30 2002'; -SET &LATER = '2002 25 AUG'; -SET &DELAY = &LATER - &NOW; -TYPE &DELAY
The following FOCEXEC creates an alphanumeric HOLD file called COUNTRY1 with the names of countries from the CAR file. It then sets the variable &C equal to FRANCE. The IN FILE phrase returns the value 1 to &IN1 if FRANCE is in the HOLD file and 0 if it is not:
TABLE FILE CAR PRINT COUNTRY ON TABLE HOLD AS COUNTRY1 FORMAT ALPHA END -RUN -SET &C = 'FRANCE'; -SET &IN1 = &C IN FILE COUNTRY1; -TYPE THE VALUE IS &IN1
The output shows that FRANCE is in the file COUNTRY1:
THE VALUE IS 1
To set the value of a variable with -SET, you need to specify a character string on the right side of the SET command. Since the character string cannot span multiple lines, if necessary, you can concatenate shorter strings or variables to compose the long string.
The following procedure creates a variable named &LONG that contains a long string:
-SET &LONG = 'THIS IS A LONG AMPER VARIABLE. NOTE THAT IN ORDER ' - |'TO SET ITS VALUE USING -SET, YOU MUST CONCATENATE SHORTER STRINGS, ' - |'EACH OF WHICH MUST FIT ON ONE LINE.'; -TYPE &LONG END
The output is:
THIS IS A LONG AMPER VARIABLE.NOTE THAT IN ORDER TO SET ITS VALUE USING -SET, YOU MUST CONCATENATE SHORTER STRINGS, EACH OF WHICH MUST FIT ON ONE LINE.
How to: |
Reference: |
You can read variable values from an external file, or write variable values to an external file with the -READ and -WRITE commands.
The external file can be a fixed-format file (in which the data is in fixed columns) or a free-format file (in which the data is comma delimited).
You can also read a file using the -READFILE command. The -READFILE command reads a file by first reading its Master File and creating Dialogue Manager amper variables based on the ACTUAL formats for each field in the Master File. It then reads the file and, if necessary, converts the fields from numeric values to alphanumeric strings before returning them to the created variables. Display options in the USAGE formats are not propagated to the variables. The names of the amper variables are the field names prefixed with an ampersand (&).
-READ ddname[,] [NOCLOSE] &name[.format.][,] ...
where:
Is the logical name of the file as defined to FOCUS using ALLOCATE or DYNAM ALLOCATE.
A space after the ddname denotes a fixed format file while a comma denotes a comma-delimited file.
Indicates that the file should be kept open even if a -RUN is encountered. The file is closed upon completion of the procedure or when a -CLOSE or subsequent -WRITE command is encountered.
Is the variable name. You may specify more than one variable. Using commas to separate variables is optional.
If the list of variables is longer than one line, end the first line with a comma and begin the next line with a dash followed by a blank (-) for comma-delimited files or a dash followed by a comma followed by a blank (-,) for fixed format files. For example:
Comma-delimited files
-READ EXTFILE, &CITY,&CODE1, - &CODE2
Fixed format files
-READ EXTFILE &CITY.A8. &CODE1.A3., -, &CODE2.A3
Is the format of the variable. It may be Alphanumeric (A) or Numeric (I). Note that format must be delimited by periods. The format is ignored for comma-delimited files.
Note: -SET provides an alternate method for defining the length of a variable using the corresponding number of characters enclosed in single quotation marks ('). For example, the following command defines the length of &CITY as 8:
-SET &CITY=' ';
Assume that EXTFILE is a fixed-format file containing the following data:
STAMFORDB10B20
To detect the end of a file, the following code tests the system variable &IORETURN. When no records remain to be read, a value equal to zero is not found.
-READ EXTFILE &CITY.A8. &CODE1.A3. &CODE2.A3. -IF &IORETURN NE 0 GOTO RESUME; TABLE FILE SALES SUM UNIT_SOLD BY CITY IF CITY IS &CITY BY PROD_CODE IF PROD_CODE IS-FROM &CODE1 TO &CODE2 END -RESUME . . .
-WRITE ddname [NOCLOSE] text
where:
Is the logical name of the file as defined to FOCUS using ALLOCATE or DYNAM ALLOCATE. For information about file allocations, see the Overview and Operating Environments manual.
Indicates that the file should be kept open even if a -RUN is encountered. The file is closed upon completion of the procedure or when a -CLOSE or subsequent -READ command is encountered.
Is any combination of variables and text. To write more than one line, end the first line with a comma (,) and begin the next line with a hyphen followed by a space (-).
-WRITE opens the file to receiving the text and closes it upon exit from the procedure. When the file is reopened for writing, the new material overwrites the old. To reopen to add new records instead of overwriting existing ones, use the attribute DISP MOD when you define the file to the operating system.
The following example reopens the file PASS to add new text:
DYNAM ALLOC DD PASS DA USER1.PASS.DATA MOD -WRITE PASS &DIV &RED &TEST RESULT IS, - &RECORDS AT END OF RUN
The following example illustrates reading from and writing to sequential files. It also illustrates the use of operating system commands. The numbers in the margin refer to notes that follow the example.
SET HOLDLIST=PRINTONLY -RUN 1. -TOP 2. -PROMPT &CITY.ENTER NAME OF CITY -- TYPE QUIT WHEN DONE. 3. DYNAM ALLOC DD PASS DA USER1.PASS.DATA LRECL 80 RECFM FB -RUN 4. -WRITE PASS &CITY TABLE FILE SALES HEADING CENTER "LOWEST MONTHLY SALES FOR &CITY" " " PRINT DATE PROD_CODE BY LOWEST 1 UNIT_SOLD BY STORE_CODE BY CITY IF CITY EQ &CITY FOOTING CENTER "CALCULATED AS OF &DATE" ON TABLE SAVE AS INFO END
5. -RUN 6. DYNAM ALLOC DD LOG DA USER1.LOG.DATA LRECL 80 RECFM FB -RUN MODIFY FILE SALES COMPUTE TODAY/I6=&YMD; CITY='&CITY'; FIXFORM X5 STORE_CODE/A3 X15 DATE/A4 PROD_CODE/A3 MATCH STORE_CODE DATE PROD_CODE ON MATCH TYPE ON LOG "<STORE_CODE><DATE><PROD_CODE><TODAY>" ON MATCH DELETE ON NOMATCH REJECT DATA ON INFO END 7. -RUN EX SLRPT3 8. -RUN 11. -GOTO TOP 12. -QUIT
The procedure SLRPT3, which is invoked from the calling procedure, contains the following lines:
9. -READ PASS &CITY.A8. TABLE FILE SALES HEADING CENTER "MONTHLY REPORT FOR &CITY" "LOWEST SALES DELETED" " " PRINT PROD_CODE UNIT_SOLD RETURNS DAMAGED BY STORE_CODE BY CITY IF CITY EQ &CITY FOOTING CENTER "CALCULATED AS OF &DATE" END 10. -RUN
The following annotations explain the logic and show the dialogue between the user and the screen. User entries are in lowercase:
ENTER NAME OF CITY -- TYPE QUIT WHEN DONE<STAMFORD
NUMBER OF RECORDS IN TABLE= 8 LINES= 8
ALPHANUMERIC RECORD NAMED INFO FIELDNAME ALIAS FORMAT LENGTH UNIT_SOLD SOLD I5 5 STORE_CODE SNO A3 3 CITY CTY A15 15 DATE DTE A4MD 4 PROD_CODE PCODE A3 3 TOTAL 30 SAVED...
SALES FOCUS A1 ON 09/04/2003 AT 10.04.35
TRANSACTIONS: TOTAL = 1 ACCEPTED= 1 REJECTED= 0 SEGMENTS: INPUT = 0 UPDATED = 0 DELETED = 1
MONTHLY REPORT FOR STAMFORD LOWEST SALES DELETED STORE_CODE CITY PROD_CODE UNIT_SOLD RETURNS DAMAGED ---------- ---- --------- --------- ------- ------- 14B STAMFORD B10 60 10 6 B12 40 3 3 B17 29 2 1 C7 45 5 4 D12 27 0 0 E2 80 9 4 E3 70 8 9 CALCULATED AS OF 09/04/03
-READFILE mastername
where:
Is the name of the Master File to be read.
(FOC339) DIALOGUE MANAGER -READ FAILED: CHECK FILEDEF OR ALLOCATION FOR: -READFILE filename
(FOC702) THE OPTION SPECIFIED IS NOT AVAILABLE WITH TEXT FIELDS: fieldname
The following request creates a binary HOLD file, then uses -READFILE to read the first record from the HOLD file and type the values that were retrieved into Dialogue Manager variables. Note that the names of the variables are the field names prefixed with an ampersand:
TABLE FILE EMPLOYEE PRINT LAST_NAME FIRST_NAME DEPARTMENT CURR_SAL BY EMP_ID ON TABLE HOLD AS READF1 FORMAT BINARY END -RUN -READFILE READF1 -TYPE LAST_NAME IS &LAST_NAME -TYPE FIRST_NAME IS &FIRST_NAME -TYPE DEPARTMENT IS &DEPARTMENT -TYPE CURR_SAL IS &CURR_SAL -TYPE EMP_ID IS &EMP_ID
The output is:
> NUMBER OF RECORDS IN TABLE= 12 LINES= 12 HOLDING BINARY FILE... LAST_NAME IS STEVENS FIRST_NAME IS ALFRED DEPARTMENT IS PRODUCTION CURR_SAL IS 11000.00 EMP_ID IS 071382660
The -CLOSE command closes an external file opened with the -READ or -WRITE command. The NOCLOSE option keeps a file open even when -RUN is encountered.
-CLOSE {ddname|*}
where:
Is the ddname of the open file described to FOCUS via an allocation.
Closes all -READ and -WRITE files that are currently open.
In this section: |
Using the EDAGET and EDAPUT commands, you can read or write an entire file of a specified type.
How to: |
Using the EDAGET command, you can retrieve and display an entire file.
The -READ command only reads one line at a time, so this is a way to avoid issuing repeated commands for reading a single file.
EX EDAGET filetype,[app/]filename,content-type
where:
Is the type of file. On z/OS, this is a DDNAME. The following table lists some of the most common FOCUS file types. Other FOCUS-readable files use the standard extensions, and the file types match the extensions:
File Type |
Extension |
---|---|
MASTER |
.mas |
ACCESS |
.acx |
FOCEXEC |
.fex |
FOCSQL |
.acx |
FOCSTYLE |
.sty |
DATA |
.dat |
FOCCOMP |
.fcm |
FOCTEMP |
.ftm |
FOCUS |
.foc |
HOLDMAST |
.mas |
HOLDACC |
.acx |
HTML |
.htm |
EXCEL |
.xls |
MAINTAIN |
.mnt |
FOCPSB |
.psb |
WINFORMS |
.wfm |
TTEDIT |
.tte |
Is an optional application name where the file resides. On z/OS, you can specify an app if you have enabled application logic in the EDASERVE configuration file and created the data sets associated with the application.
Is the file name.
Is the type of data in the file. Valid values are:
Note: EDAGET cannot retrieve a file that was written to memory by EDAPUT.
The following EDAGET command reads a Master File named tempmas.mas in the app1 application. The content type is text:
EX EDAget MASTER,app1/tempmast,T
Using the tempmas.mas file created in BAD XREF HERE "EDAPUT: Writing a Sequential File of a Specified Type, the output is:
FILENAME=TEMPMAST, SUFFIX=FIX,$ SEGNAME=ONE, SEGTYPE=S1 ,$ FIELD=FIELD1 ,ALIAS= ,A10 ,A10 ,$ FIELD=FIELD2 ,ALIAS= ,P18 ,A18 ,$
How to: |
Using the EDAPUT command, you can write any number of lines and save them as common FOCUS file types, either in memory or on disk.
The -WRITE command only writes one line at a time, so this is a way to avoid issuing repeated commands for writing a single file.
EX -LINES n EDAPUT filetype,[app/]filename,type,location
where:
Is the number of lines that will be written, including the EDAPUT line.
Is the type of file. You specify the file type and, on Windows and UNIX, the file is saved with the associated extension. On z/OS, this is a DDNAME and the file is stored in the PDS associated with the DDNAME. The following table lists some of the most common FOCUS file types. Other FOCUS-readable files use the standard extensions, and the file types match the extensions:
File Type |
Extension |
---|---|
MASTER |
.mas |
ACCESS |
.acx |
FOCEXEC |
.fex |
FOCSQL |
.acx |
FOCSTYLE |
.sty |
DATA |
.dat |
FOCCOMP |
.fcm |
FOCTEMP |
.ftm |
FOCUS |
.foc |
HOLDMAST |
.mas |
HOLDACC |
.acx |
HTML |
.htm |
EXCEL |
.xls |
MAINTAIN |
.mnt |
FOCPSB |
.psb |
WINFORMS |
.wfm |
TTEDIT |
.tte |
Is an optional application name under which to store the file. On z/OS, you can specify an app if you have enabled application logic in the EDASERVE configuration file and created the data sets associated with the application.
Is the file name.
Is the creation type. Valid values are:
Is the location for the created file. Valid values are:
The following EDAPUT command writes a Master File named tempmast.mas to the app1 application directory in variable format. On z/OS, it writes member TEMPMAST to the APP1.MASTER.DATA data set under the high-level qualifier assigned as approot in the EDASERVE configuration file:
EX -LINES 5 EDAPUT MASTER,app1/tempmast,CV,FILE, FILENAME=TEMPMAST, SUFFIX=FIX,$ SEGNAME=ONE, SEGTYPE=S1 ,$ FIELD=FIELD1 ,ALIAS= ,A10 ,A10 ,$ FIELD=FIELD2 ,ALIAS= ,P18 ,A18 ,$
How to: |
Reference: |
When a user knows the values required by a procedure, some or all of the values can be typed on the command line using the EXEC command following the name of the procedure. This saves time since FOCUS now has values to pass to each local or global variable so the user is not prompted to supply them.
EX[EC] procedure [[&&][variable=]value, ...]
where:
Is the name of the procedure that contains the name/value values.
Is the name of the variable for which you are supplying a value. Omit for a positional variable.
For a local variable, do not include the ampersand in the variable name.
For a global amper variable, you must supply the double ampersand in the variable name:
EX SLRPT &&GLOBAL=value, CITY = STAMFORD, CODE1=B10, CODE2=B20
Is the value you are giving to the variable.
Name/value pairs must be separated by commas.
When the list of values to be supplied exceeds the width of the terminal, insert a comma as the last character on the line and enter the balance of the list on the following line(s), as shown:
EX SLRPT AREA=S, CITY = STAMFORD, VERB=COUNT, FIELDS = UNIT_SOLD, CODE1=B10, CODE2=B20
You can mix named and positional variables freely in the EXEC command. Positional variables are unnamed values passed to a procedure when it is invoked.
Follow these rules:
It is not necessary to enter the name=value pairs in the order encountered in the procedure.
If the variable is positional (it is a numbered variable), you do not need to specify the variable name in the EXEC command. FOCUS matches the EXEC values to the positional variables as they are encountered in the procedure. For an example, see Using Positional Variables.
Consider the following procedure named SLRPT:
TABLE FILE SALES HEADING CENTER "MONTHLY REPORT FOR &CITY" SUM UNIT_SOLD AND RETURNS AND COMPUTE RATIO/D5.2 = 100 * (RETURNS/UNIT_SOLD); BY PROD_CODE IF PROD_CODE IS-FROM &CODE1 TO &CODE2 BY CITY IF CITY EQ &CITY END
You can supply values for the variables as parameters using the EX command as follows:
EX SLRPT CITY=STAMFORD, CODE1=B10, CODE2=B20
Consider the following example:
TABLE FILE SALES HEADING CENTER "MONTHLY REPORT FOR &1" SUM UNIT_SOLD AND RETURNS AND COMPUTE RATIO/D5.2 = 100 * (RETURNS/UNIT_SOLD); BY PROD_CODE IF PROD_CODE IS-FROM &2 TO &3 BY CITY IF CITY EQ &1 END
The EX command that calls the procedure is as follows:
EX SLRPT STAMFORD, B10, B20
This command substitutes STAMFORD for the first positional variable, B10 for the second, and B20 for the third.
The report request SLRPT includes named and positional variables:
TABLE FILE SALES HEADING CENTER "MONTHLY REPORT FOR &CITY" &VERB UNIT_SOLD AND RETURNS AND COMPUTE RATIO/D5.2 = 100 * (RETURNS/UNIT_SOLD); BY PROD_CODE IF PROD_CODE IS-FROM &1 TO &2 BY CITY IF CITY EQ &CITY END
The following EX command executes SLRPT and populates the named and positional variables:
EX SLRPT CITY=STAMFORD, B10, B20, VERB=COUNT
&CITY is a named variable whose value is STAMFORD.
&1 is a positional variable whose value is B10.
&2 is a positional variable whose value is B20.
&VERB is a named variable whose value is COUNT.
The Dialogue Manager command -PROMPT solicits values before the variables to which they refer are used in the procedure. The user is prompted for a value as soon as -PROMPT is encountered. If a looping condition is present, -PROMPT requests a new value for the variable, even if a value exists already. Thus, each time through the loop, the user is prompted for a new value.
With -PROMPT you can specify format, text, and lists in the same way as all other variables.
The following is an example of the use of -PROMPT:
-PROMPT &CODE1 -PROMPT &CODE2 -SET &CITY = IF &CODE1 GT B09 THEN STAMFORD ELSE UNION; -TYPE REGIONAL MANAGER FOR &CITY -PROMPT ®IONMGR TABLE FILE SALES HEADING CENTER "MONTHLY REPORT FOR &CITY" "PRODUCT CODES FROM &CODE1 TO &CODE2" SUM UNIT_SOLD AND RETURNS AND COMPUTE RATIO/D5.2 = 100 * (RETURNS/UNIT_SOLD); BY CITY IF CITY EQ &CITY BY PROD_CODE IF PROD_CODE IS-FROM &CODE1 TO &CODE2 FOOTING CENTER "REGION MANAGER: ®IONMGR" "CALCULATED AS OF &DATE" END
-PROMPT sends the following prompts to the screen. User input is shown in lowercase:
PLEASE SUPPLY VALUES REQUESTED CODE1= > b10 CODE2= > b20 REGIONAL MANAGER FOR STAMFORD REGIONMGR= > smith
Note how the sequence of supplied values determines the overall flow of the procedure. The value of &CODE1 determines the value of &CITY that gives meaning to the -TYPE command. -TYPE gives the user the necessary information to make the correct choice when supplying the value for ®IONMGR.
By default, all user input is automatically converted to uppercase.
-CRTFORM sets up full-screen menus for entering values. The -CRTFORM command in Dialogue Manager and the CRTFORM command in MODIFY are two versions of FIDEL for use in different contexts. The syntax, functions and features are fully outlined in the Maintaining Databases manual.
You can create a series of menus and windows using Window Painter, and then display those menus and windows on the screen using the -WINDOW command. When displayed, the menus and windows collect data by prompting a user to select a value, to enter a value, or to press a program function (PF) key For details, see Designing Windows With Window Painter.
If a value for a variable is not supplied by any other means, FOCUS automatically prompts the user for the value. This is known as an implicit prompt. These prompts occur sequentially as each variable is encountered in the procedure.
Consider the following example:
TABLE FILE SALES HEADING CENTER "MONTHLY REPORT FOR &CITY" . . . BY PROD_CODE IF PROD_CODE IS-FROM &CODE1 TO &CODE2 . . . FOOTING CENTER "REGION MANAGER: ®IONMGR" "CALCULATED AS OF &DATE" END
When you execute the procedure, FOCUS prompts for the values for the variables one at a time. The terminal dialogue is as follows. User input is in lowercase:
PLEASE SUPPLY VALUES REQUESTED CODE1= > b10 CODE2= > b20 REGIONAL MANAGER FOR STAMFORD REGIONMGR= > smith
At the point when all variables have values, FOCUS processed the report request.
Reference: |
You can specify variables with format conditions against which entered values can be compared. If the entered values do not have the specified format, FOCUS prints error messages and prompts the user again for the value(s).
Alphanumeric formats are described by the letter A followed by the number of characters. The number of characters can be from 1 to 3968.
Numeric formats are described by the letter I, followed by the number of digits to be entered. The number of digits can be from 1 to 10 (value must be less than 231-1), and the value supplied for the number can contain a decimal point.
The description of the format must be enclosed by periods.
If you test field names against input variable values, specify formats of the input variables. If you do not, and the supplied value exceeds the format specification from the Master File, the procedure is ended and error messages are displayed. To continue, the procedure must be executed again. However, if you do include the format, and the supplied value exceeds the format, Dialogue Manager rejects the value and the user is prompted again.
Note: FOCUS internally stores all Dialogue Manager variables as alphanumeric codes. To perform arithmetic operations, Dialogue Manager converts the variable value to double-precision floating point decimal and then converts the result back to alphanumeric codes, dropping the decimal places. For this reason, do not perform tests that look for the decimal places in the numeric codes.
Consider the following format specification:
&STORECODE.A3.
No special message is sent to the screen detailing the specified format. However, if in the above example the user enters more than three alphanumeric characters, the value is rejected, the error message FOC291 is displayed and the user is prompted again.
Note the following example detailing the dialogue between FOCUS and the user:
PLEASE SUPPLY VALUES REQUESTED STORECODE= > cc14 (FOC291) THE VALUE IN THE PROMPT REPLY EXCEEDS THE MAXIMUM LENGTH: 03 CHARS:CC14 STORECODE=
How to: |
You can define values that constitute acceptable responses to prompts. If the user does not enter one of the available options, the terminal displays the list and re-prompts the user. This is an excellent way to limit the values supplied and to provide help information to the screen while prompting.
In addition, you can supply text that either explains what type of value is needed or lists choices of acceptable values on the screen.
The following lists acceptable responses for &CITY:
-PROMPT &CITY.(STAMFORD,UNIONDALE,NEWARK).
A message is printed if the user does not respond with one of the values on the list. This is followed by a display of the values list. Then, another prompt is issued for the needed value. For example:
PLEASE SUPPLY VALUES REQUESTED CITY= > union PLEASE CHOOSE ONE OF THE FOLLOWING: STAMFORD,UNIONDALE,NEWARK CITY= >
You can provide a reply list as a variable, then prompt for the values you have defined for that variable. The syntax is
-SET &list='value,...'; -PROMPT &variable.(&list)[.text.]
where:
Is the name of the reply list variable. Note that in the -PROMPT command, the value is substituted between the parentheses and delimited by periods. If the prompt text has parentheses, enclose that text in single quotation marks (').
Is the desired value. You may list more than one value, separated by commas. Enclose the value(s) in single quotation marks ('). A semicolon is required when using -SET.
Is the name of the variable for which you are prompting the user for values.
Optionally provides prompting text.
In this example, three acceptable values are defined for &CITY:
-SET &CITIES='STAMFORD,UNIONDALE,NEWARK'; -PROMPT &CITY.(&CITIES).'(ENTER CITY)'.
The resulting screen is exactly the same as when the list itself is provided in the parentheses. See Providing a List of Valid Values With -PROMPT.
You can also create more complex combinations. For example:
-SET &CITIES=IF &CODE1 IS B10 THEN 'STAMFORD, NEWARK' - ELSE 'STAMFORD, UNIONDALE, NEWARK';
This example uses customized text to prompt for a values for &CITY, &CODE1, &CODE2, and ®IONMGR:
TABLE FILE SALES HEADING CENTER "MONTHLY REPORT FOR &CITY.ENTER CITY. " . . . BY PROD_CODE IF PROD_CODE IS-FROM &CODE1.A3.BEGINNING CODE. TO &CODE2.A3.ENDING CODE. . . . "REGION MANAGER: ®IONMGR.REGIONAL SUPERVISOR." "CALCULATED AS OF &DATEMDYY" END
Notice that text has been specified for &CITY and ®IONMGR without specification of a format.
Based on the example, the terminal displays the following prompts one by one:
ENTER CITY stamford BEGINNING CODE b10 ENDING CODE b20 REGIONAL SUPERVISOR smith
|
Information Builders |