Special Responses

In this section:

This section discusses special responses to prompts. It covers:

Canceling a Transaction

To cancel a transaction, enter a dollar sign ($) after any prompt. The request displays the following message

(FOC309) TRANSACTION INCOMPLETE:

and will prompt you for the next transaction. Canceling a transaction clears the buffer of data and causes the PROMPT statement to re-prompt you for the fields, allowing you to clear a bad transaction and start over.

Ending Execution

To end execution of the request, enter either Quit or End after any prompt. The request displays the execution statistics and returns you to the FOCUS command level. The data source will be updated to the last completed transaction.

Correcting Field Values

If you entered an incorrect field value, you can correct it at the next prompt. Type the value for the next prompt, but do not press Enter. Instead, type a comma and then type

fieldname = corrected-value

where:

fieldname

Is the field name of the corrected value. Then press Enter. Note that fieldname must be separated from the previous value by a comma.

The example below shows a user correcting a DEPARTMENT value after the CURR_JOBCODE prompt.

> DATA FOR TRANSACTION  1
 
    EMP_ID        = > 071382660
    DEPARTMENT    = > production
    CURR_SAL      = > 19350.67
    CURR_JOBCODE  = > a03, department=sales
    DATA FOR TRANSACTION  2
 
    EMP_ID        = >

Note: If you enter an incorrect field value at the last prompt of a transaction, you cannot correct the value in that transaction.

Typing Ahead

You can enter several values at one prompt by typing ahead. Enter

value-1, value-2, ... value-n

where:

value-1

Is the value of the field for which you are being prompted.

value-2 ...

Are the values of fields you have not yet been prompted for by the PROMPT statement. The values must be in the order of fields specified by the PROMPT statement, from the field being prompted for onwards. Separate the values with commas.

For example, a MODIFY request has this PROMPT statement:

PROMPT EMP_ID DEPARTMENT CURR_SAL CURR_JOBCODE

When you run the request, you enter an employee ID, a department, salary, and job code at the EMP_ID prompt, as shown below.

> DATA FOR TRANSACTION 1
 
    EMP_ID      = > 071382660, sales, 23800, b04
    DATA FOR TRANSACTION 2
 
    EMP_ID      = >

Repeating a Previous Response

If you are going to respond to a prompt with the same value as the previous prompt, you may enter a double quotation mark (") instead to save typing.

Entering No Data

If you run a request that prompts you for a field that should not contain data, enter a period (.) after the prompt. The field becomes inactive and does not change any values in the data source.

If you are adding segments to the data source, the field in the new instance becomes:

Breaking Out of Repeating Groups

Reference:

To break out of a repeating group, enter an exclamation point (!) after any prompt. The request will immediately prompt you for the first field outside the repeating group.

For example, you run this request:

MODIFY FILE EMPLOYEE
PROMPT EMP_ID 3 (PAY_DATE GROSS)
MATCH EMP_ID
  ON NOMATCH REJECT
  ON MATCH CONTINUE
MATCH PAY_DATE
  ON MATCH REJECT
  ON NOMATCH INCLUDE
DATA

Every time you enter an employee ID, the request prompts you for a pay date and a monthly pay (GROSS) three times. If you enter an exclamation point at one of these prompts, the request prompts you for the next employee ID.

Each cycle of prompts within a repeating group counts as one transaction. The repeating group data you entered before the transaction where you broke out remains active and modifies the data source.

If you break out of one repeating group nested in another repeating group, the request next prompts you for the fields of the outer group. For example, a request contains this PROMPT statement:

PROMPT EMP_ID 6 (PAY_DATE 7 (DED_CODE DED_AMT))

You run the request. If you enter an exclamation point at a DED_CODE or DED_AMT prompt, the request next prompts you for the next PAY_DATE value.

Reference: PROMPT Phrases in MATCH and NEXT Statements

You can use PROMPT statements as phrases in MATCH or NEXT statements. By doing so, you avoid prompting the user for data that will be rejected anyway. The following examples illustrate the differences.

Consider the following request:

MODIFY FILE EMPLOYEE
PROMPT EMP_ID CURR_SAL
 
MATCH EMP_ID
  ON MATCH UPDATE CURR_SAL
  ON NOMATCH REJECT
DATA

This request prompts the user for the EMP_ID and CURR_SAL fields. The MATCH statement searches the data source for the EMP_ID value the user enters (MATCH EMP_ID). If it finds the value, it updates the CURR_SAL value; otherwise it rejects the transaction. The user must enter both an EMP_ID and a CURR_SAL value every transaction, whether the transaction is accepted or not.

However, when the request prompts for the CURR_SAL value in the MATCH statement, the user enters a CURR_SAL value only if the corresponding EMP_ID value is in the data source. This request shows how this is done:

MODIFY FILE EMPLOYEE
PROMPT EMP_ID
MATCH EMP_ID
  ON MATCH PROMPT CURR_SAL
  ON MATCH UPDATE CURR_SAL
  ON NOMATCH REJECT
DATA

The request prompts you for an EMP_ID value. It then searches the data source for the ID you entered. If it does not find the value, it rejects the ID and prompts you for another ID. Only if it finds the ID in the data source does it prompt you for a CURR_SAL value.

Reference: Using PROMPT and FREEFORM Statements in One Request

You may use PROMPT and FREEFORM statements together in one request. This feature is useful when key field values are difficult to read and type, such as large numbers or complex codes. For example, a request might read employee ID numbers from a comma-delimited data source, use those IDs to locate segment instances, and then prompt the user for the data to update the employee information.

To use FREEFORM and PROMPT together, follow these rules:

  • Place all FREEFORM statements before the PROMPT statements.
  • Place the data in a separate data source. Specify the data source with the ON ddname option.
  • Do not end the comma-delimited records with dollar signs ($).

Note that when you use FREEFORM together with PROMPT, the transaction counter does not appear before the prompts.

This request updates employee salaries:

MODIFY FILE EMPLOYEE
FREEFORM ON EMPNO EMP_ID
 
MATCH EMP_ID
  ON NOMATCH REJECT
  ON MATCH TYPE "ENTER SALARY FOR EMPLOYEE #<EMP_ID"
  ON MATCH PROMPT CURR_SAL
  ON MATCH UPDATE CURR_SAL
DATA

Note the TYPE phrase in the MATCH statement that informs the user what employee ID the request is processing. The TYPE statement is described in Displaying Specific Messages: The TYPE Statement.

Invoking the FIDEL Facility: The CRTFORM Statement

This section is a brief description of the CRTFORM statement, which is discussed fully in Designing Screens With FIDEL.

The CRTFORM statement invokes the FIDEL facility, which generates a formatted screen. You type the transaction values in the designated areas of the screen and press Enter.

To use the FIDEL facility, you must be on a full-screen terminal running FOCUS in interactive mode, not batch. Note that FIDEL is separate from the MODIFY facility, so your installation may have MODIFY but not FIDEL. Consult your systems manager or database administrator.

Beneath the CRTFORM statement, you specify the layout of the screen. Enclose each line of the screen in double quotation marks. On each line, you can type free text instructing the user and designate data entry areas where the user enters data for specific fields.

You may also display messages to the user in the TYPE area of the CRTFORM using the HELPMESSAGE attribute (see Displaying Messages: Setting PF Keys to HELP and in the Describing Data manual).

The following request updates employees' department assignments, salaries, job codes, and classroom hours:

MODIFY FILE EMPLOYEE
CRTFORM
" ***** EMPLOYEE INFORMATION UPDATE *****"
" "
"ENTER EMPLOYEE'S ID: <EMP_ID"
"ENTER EMPLOYEE'S DEPARTMENT: <DEPARTMENT"
"ENTER CURRENT SALARY: <CURR_SAL"
"ENTER JOB CODE: <CURR_JOBCODE"
"ENTER CLASS HOURS: <ED_HRS"
MATCH EMP_ID
  ON NOMATCH REJECT
  ON MATCH UPDATE DEPARTMENT CURR_SAL
  ON MATCH UPDATE CURR_JOBCODE ED_HRS
DATA VIA FI3270
END

A request may have up to 255 CRTFORM statements, and may also have one FIXFORM statement preceding the CRTFORM statements. You may place CRTFORM phrases in MATCH and NEXT statements.

The FIDEL facility has several features that enhance its usability:

Please refer to Designing Screens With FIDEL, to learn how to use FIDEL.


Information Builders