In this section: |
This section describes how MODIFY requests handle messages. There are four types:
These messages are helpful in debugging MODIFY requests, locating rejected transactions, and instructing the operator. There are two statements and one attribute that control the display of messages:
How to: Reference: |
The TYPE statement either appears on the terminal or stores in a sequential file messages that you prepare. This section describes:
Note: Text fields cannot be used with the TYPE statement.
The syntax of the TYPE statement is
TYPE [AT START|AT END] [ON ddname] "message" ["message"]
where:
Displays a message at the beginning of execution only.
Displays a message at the end of execution only. If you are using Case Logic, the TYPE AT END statement must be in the case that generates the end-of-file condition. Either the case must include a FIXFORM or FREEFORM statement that will reach the end of the transaction data source; or a PROMPT statement, at which the user will type END or QUIT; or a CRTFORM statement, at which the user will type END or press the PF3 key.
Writes the message to a sequential file allocated to ddname. The TYPE statement can write lines of up to 256 characters each, including blanks and embedded field values. If you omit this phrase, the request displays the message on the terminal.
Is any message. Enclose each line in double quotation marks (except when you want to display two lines as one line, as described later in this section in Embedding Spot Markers.) If you are displaying messages at the terminal, the lines begin in column 2 on the screen. If you are writing the message to a file, the lines begin in column 3 in the file. You may embed spot markers and data fields in the message.
Note that you can type the TYPE statement on one line. For example:
TYPE "THIS IS A ONE LINE MESSAGE"
TYPE statements can stand by themselves, they can be part of MATCH and NEXT statements, and they can follow VALIDATE statements. For example:
MODIFY FILE EMPLOYEE TYPE " " "PLEASE ENTER THE FOLLOWING DATA" " " PROMPT EMP_ID CURR_SAL MATCH EMP_ID ON NOMATCH REJECT ON MATCH UPDATE CURR_SAL DATA
This request asks the user to enter data at the beginning of every transaction. Note that there is a blank message line both before and after the message "PLEASE ENTER THE FOLLOWING DATA:" This enhances readability and appearance.
TYPE statements may be part of MATCH and NEXT statements. For example, this request warns the user when an employee ID that the user has entered is not in the data source:
MODIFY FILE EMPLOYEE PROMPT EMP_ID CURR_SAL MATCH EMP_ID ON MATCH UPDATE CURR_SAL ON NOMATCH TYPE " " "NO SUCH EMPLOYEE IN THE DATABASE" "PLEASE RETYPE THE EMPLOYEE ID" ON NOMATCH REJECT DATA
TYPE statements can display messages when incoming data values fail validation tests, as discussed in Validating Transaction Values: The VALIDATE Statement. For example, this request warns the user when a salary higher than $50,000 is entered:
MODIFY FILE EMPLOYEE PROMPT EMP_ID CURR_SAL VALIDATE SALTEST = IF CURR_SAL LE 50000 THEN 1 ELSE 0; ON INVALID TYPE " " "THE CURR_SAL VALUE IS OVER 50000" "AND THEREFORE CANNOT BE ENTERED INTO THE" "DATABASE. PLEASE NOTIFY YOUR SUPERVISOR." MATCH EMP_ID ON MATCH UPDATE CURR_SAL ON NOMATCH REJECT DATA
Note that ON INVALID TYPE phrases can occur after VALIDATE statements that stand by themselves or are part of MATCH statements. For example:
MATCH PAY_DATE ON NOMATCH REJECT ON MATCH VALIDATE GROSS_TEST = IF GROSS LT 1500 THEN 1 ELSE 0; ON INVALID TYPE "GROSS OVER $1500. PLEASE REENTER"
You can embed data fields in the middle of messages. Embedded data fields are described in the Creating Reports manual. The kind of field you may embed depends on the position of the TYPE statement:
MODIFY FILE EMPLOYEE FIXFORM EMP_ID/9 X1 CURR_SAL/8 TYPE "EMPLOYEE ID: <EMP_ID SALARY: <CURR_SAL" MATCH EMP_ID ON MATCH UPDATE CURR_SAL ON NOMATCH REJECT DATA ON EMPSAL END
This TYPE phrase displays both the incoming value of CURR_SAL and the data source value:
ON MATCH TYPE "SALARY ENTERED IS: <CURR_SAL" "OLD SALARY WAS: <D.CURR_SAL"
You can use embedded fields together in a statement to display a total. This request totals all salaries updated:
MODIFY FILE EMPLOYEE PROMPT EMP_ID CURR_SAL MATCH EMP_ID ON NOMATCH REJECT ON MATCH COMPUTE TOTAL_SAL/D10.2 = TOTAL_SAL + CURR_SAL; ON MATCH UPDATE CURR_SAL TYPE AT END "TOTAL OF ALL NEW SALARIES IS <TOTAL_SAL" DATA
Every time the user enters a salary, the request adds it to the running total TOTAL_SAL. After the user enters the last salary, the request displays the TOTAL_SAL value embedded in the message.
Note: Each line of text can contain up to 256 characters. This includes the lengths of the embedded fields as defined by the display field formats (for example, the CURR_SAL field, having the format D12.2M, takes up 15 characters, including decimal point, commas, and dollar sign).
Embedded fields enable you to design your own log files to record transactions, replacing the automatic log file facility activated by the LOG statement. This request logs accepted transactions into the file ACCFILE and logs rejected transactions into the file REJFILE:
MODIFY FILE EMPLOYEE PROMPT EMP_ID CURR_SAL MATCH EMP_ID ON MATCH TYPE ON ACCFILE "<EMP_ID <12 <CURR_SAL" ON MATCH UPDATE CURR_SAL ON NOMATCH TYPE ON REJFILE "<EMP_ID <12 <CURR_SAL" ON NOMATCH REJECT DATA
This request records in the ACCFILE file the employee ID and new salary entered by the user if the ID is in the data source and records the ID and salary in the REJFILE file if the ID is not in the data source. Note that the spot markers in both TYPE messages ensure that the fields will be aligned in the files, making the files fixed sequential files. If the request logged the transactions using the MODIFY LOG facility, the files would have been comma-delimited because the request uses PROMPT to input data. Note that you must issue an allocation for each log file prior to using it in the MODIFY request.
You can embed spot markers in TYPE statement messages. Spot markers are devices that place message text at different places on the screen. Spot markers are described in Tutorial: Painting a Procedure. Some common spot markers are shown below (where n is an integer):
Places text starting at the nth column.
Places text n columns to the right.
Places text n lines down.
Positions the next character immediately to the right of the last character (skip zero columns). This is used when you have two or more lines between the double quotation marks in a procedure that make up a single line of information on a FIDEL screen. No spaces are inserted between the spot marker and the start of a continuation line.
For example, the statement
TYPE "THE DOLLAR SIGN IS IN COLUMN 40: <40 $" "TEN SPACES ARE EMBEDDED <+10 IN THIS LINE" "</1 THIS LINE SKIPS A LINE <0X AND PROVIDES AN EXAMPLE OF THE USE <0X OF A COLUMN MARKER"
produces the following output:
Note: The spot marker to skip a line, </n, can appear on the same line with other text in a TYPE statement. However, in a CRTFORM, this spot marker must appear on a line by itself (see Designing Screens With FIDEL).
Sometimes, a line of text you want displayed cannot fit on one line within the TYPE command. This can occur because you are indenting lines or because there are non-printable characters in the message, such as spot markers and field prefixes. To have two lines in the TYPE statement displayed as one line, do the following:
This TYPE statement demonstrates how this feature can be used:
TYPE "<D.FIRST_NAME <D.LAST_NAME EMP. #<EMP_ID <+1 SALARY: <CURR_SAL"
If you enter in the employee ID 123764317 and a salary of $27,000, the request displays this message:
JOAN IRVING EMP. #123764317 SALARY: $27,000.00
You may write a message of several lines this way. Begin the first line of the message with a quotation mark and end the last line with a quotation mark. Begin alternating lines with the <+1 spot marker. This causes the request to display every two lines of text as one line.
For example, if you type this statement in the request:
TYPE "SALARY UPDATE PROCEDURE <+1 WRITTEN JUNE 26, 1985" "ENTER EACH EMPLOYEE ID AND SALARY <+1 AFTER THE PROMPTS"
The request displays the message as:
SALARY UPDATE PROCEDURE WRITTEN JUNE 26, 1985 ENTER EACH EMPLOYEE ID AND SALARY AFTER THE PROMPTS
The following request employs both spot markers and embedded fields in messages:
MODIFY FILE EMPLOYEE PROMPT EMP_ID MATCH EMP_ID ON NOMATCH TYPE "</1 EMPLOYEE <EMP_ID NOT IN THE DATABASE" "PLEASE RETYPE NUMBER OR NOTIFY SUPERVISOR" ON NOMATCH REJECT ON MATCH TYPE "</1 EMPLOYEE <15 LAST_NAME <30 FIRST_NAME <45 SALARY" "</1 <EMP_ID <15 <D.LAST_NAME "<+1 <30 <D.FIRST_NAME <40 <D.CURR_SAL" "</1 ENTER SALARY FOR EMPLOYEE <EMP_ID" " " ON MATCH PROMPT CURR_SAL ON MATCH UPDATE CURR_SAL DATA
When you run this request, the session looks like this:
> EMPLOYEE ON 10/10/98 AT 19.44.47 DATA FOR TRANSACTION 1 EMP_ID = > 451123478 EMPLOYEE LAST_NAME FIRST_NAME SALARY 451123478 MCKNIGHT ROGER $16,100.00 ENTER SALARY FOR EMPLOYEE 451123478 CURR_SAL = > 18500 DATA FOR TRANSACTION 2 EMP_ID = >
If your request includes CRTFORMs, you can enhance TYPE statements with screen attributes, devices that display a line, part of a line, or an embedded field in color, in reverse video, flashing, or underlined. Screen attributes are discussed in Designing Screens With FIDEL, in connection with the FIDEL facility.
Note the following when using screen attributes in TYPE statements:
SET EXTTERM = ON
This request uses attributes in TYPE statements:
MODIFY FILE EMPLOYEE CRTFORM "ENTER EMPLOYEE ID: <EMP_ID" "ENTER SALARY: <CURR_SAL" MATCH EMP_ID ON MATCH UPDATE CURR_SAL ON NOMATCH TYPE "<.WHITE. EMPLOYEE #<.AQUA.EMP_ID" "<.WHITE. IS <.RED. NOT <.WHITE. IN THE DATABASE" "<.WHITE. PLEASE NOTIFY SUPERVISOR" ON NOMATCH REJECT DATA END
The request displays the employee ID in aquamarine and the EMPLOYEE IS NOT IN THE DATABASE message in white, except for the word NOT, which is in red.
How to: |
The LOG statement enables you to record transactions in sequential files automatically and to control the display of rejection messages at the terminal. You may use the LOG statement to record transactions in files, one file for each type of transaction: all transactions, accepted transactions, and different types of rejected transactions. The statement can also shut off MODIFY command rejection messages, enabling you to substitute your own.
The LOG statement enables you to record transactions processed by a MODIFY request in sequential files. You can record all transactions or only transactions accepted into the data source. You can record in separate files transactions rejected because of an ON MATCH REJECT or ON NOMATCH REJECT phrase, transactions rejected because of validation tests, and transactions rejected because of format errors.
Note that you can design your own log files by using the TYPE ON ddname statement described in Displaying Specific Messages: The TYPE Statement instead of the LOG facility.
You add a LOG statement for each file in which you are storing transactions. The syntax for the LOG statement is
LOG category [ON ddname] [MSG {ON|OFF}]
where:
Is the type of transaction to be logged. The types are:
TRANS are all transactions processed by the request.
ACCEPT are transactions accepted into the data source.
DUPL are transactions rejected because of an ON MATCH REJECT phrase (the transactions have field values that match those in the data source).
NOMATCH are transactions rejected because of an ON NOMATCH REJECT phrase (the transactions have field values that do not match values in the data source).
INVALID are transactions rejected because of data values that failed validation tests.
FORMAT are transactions rejected because of data values that have invalid formats (for example: a numeric field containing letters; an alphanumeric field with more characters than allowed by the format). Any non-CRTFORM transaction that fails an ACCEPT test can also be logged to this file.
The ddname of the file to which you are writing.
Controls the display of rejection messages (messages displayed on the terminal when a transaction is rejected). The default setting is ON, except for ACCEPT where the default is OFF. The ON setting enables the display of rejection messages.
You can log messages on six files in one request. If the files existed before the user executed the request, the logged transactions replace the file contents.
How the request stores transactions depends on the statement used to read them in.
FIXFORM |
The request stores the transactions in fixed format. Each FIXFORM statement retrieving data from the data source logs one transaction. Each transaction consists of the fields defined by the FIXFORM statement plus the fields to the end of the physical record. |
FREEFORM |
The request stores the transactions in comma-delimited format. Each FREEFORM statement logs one transaction. Each transaction consists of one physical record delimited by a comma-dollar sign (,$). Note: Unless FREEFORM is explicitly included in the syntax, only the last line entered will be logged. |
PROMPT |
The request stores the transactions in comma-delimited format. Each PROMPT statement logs one transaction. Each transaction consists of data collected from the first PROMPT statement in the request to the PROMPT statement logging the transaction. |
CRTFORM |
The request stores the transactions in fixed format. Each CRTFORM logs one transaction. Each transaction consists of data collected from the first CRTFORM in the request to the CRTFORM logging the transaction. |
When you allocate the files, you must assign each file a record length just large enough to hold the transaction. How you determine the length depends on how the request reads transactions:
FIXFORM and FREEFORM |
Define the record length as the length of the longest logical transaction record, including blanks and commas between the fields. Remember that a logical transaction record can extend over more than one line in the transaction data source (but is recorded as one line in the log file). |
PROMPT |
Define the record length as the sum of the lengths of the fields as defined by the FORMAT attribute (for example, a field having a format of D12.2 has a length of 12), plus one byte for each field, plus one more byte. |
CRTFORM |
Define the record length as the sum of the lengths of the fields as defined by the FORMAT attribute (for example, a field having a format of D12.2 has a length of 12), plus one byte for each CRTFORM, plus one more byte. |
The sample request below updates employee salaries and logs the transactions on five separate files. The original transaction data source was stored in file ddname SALFILE. Note the VALIDATE statement that determines whether the salary in each transaction exceeds $50,000.
MODIFY FILE EMPLOYEE
LOG TRANS ON ALLTRANS LOG ACCEPT ON GOODTRAN LOG NOMATCH ON NOEMPL LOG INVALID ON BIGSAL LOG FORMAT ON BADFORM PROMPT EMP_ID CURR_SAL VALIDATE SAL_TEST = IF CURR_SAL GT 50000 THEN 0 ELSE 1; MATCH EMP_ID ON MATCH UPDATE CURR_SAL ON NOMATCH REJECT DATA
Note the five files specified in the LOG statements:
The MSG option on a LOG statement allows you to control the display of FOCUS automatic rejection messages. You can replace these messages by shutting them off and displaying your own messages using the TYPE command. The FOCUS messages are the following:
(FOC405 )TRANS n REJECTED DUPL: segment
where n is the transaction number and segment is the data source segment containing the data value that matched the transaction value.
(FOC415) TRANS n REJECTED NOMATCH segment
where n is the transaction number and segment is the data source segment containing the data field that failed to match the transaction value.
(FOC421)TRANS n REJECTED INVALID field
where n is the transaction number and field is the return code field.
(FOC428)TRANS n REJECTED FORMAT COL m FLD field
where n is the transaction number, m is the first column of the field having the error, and field is the data field containing the error.
(FOC210) THE DATA VALUE HAS A FORMAT ERROR: v
where v is the data value.
SCREEN REJECTED.. FORMAT ERROR IN FIELD field
where field is the data field with the format error.
(FOC534) Data Value is not among the acceptable values for: field
where field is the data field containing the error.
In addition, FOCUS displays the rejected transaction after each rejection message (except for format error transactions read in using PROMPT and CRTFORM).
You may want to replace these messages with your own. To do so, use the TYPE statement described in Displaying Specific Messages: The TYPE Statement. To turn off the FOCUS messages, use the LOG statement with this syntax
LOG category [ON ddname] MSG {ON|OFF}
where:
Is the type of transaction that triggers the rejection message: DUPL, NOMATCH, INVALID, and FORMAT. These types are described previously in How to Log Transactions in Sequential Files.
Logs the transaction in a file defined by ddname. This option is described previously in How to Log Transactions in Sequential Files.
Is the parameter that turns FOCUS rejection messages ON (the default) or OFF.
For example, this request shuts off the automatic NOMATCH message and replaces it with another message:
MODIFY FILE EMPLOYEE LOG NOMATCH MSG OFF PROMPT EMP_ID CURR_SAL MATCH EMP_ID ON MATCH UPDATE CURR_SAL ON NOMATCH TYPE "THIS EMPLOYEE IS NOT RECORDED IN THE DATABASE" "DID YOU ENTER THE ID NUMBER CORRECTLY?" "THE NUMBER YOU ENTERED WAS: <EMP_ID" ON NOMATCH REJECT DATA
Note that you may combine logging and the display of rejection messages in one LOG statement. For example, to both log transactions rejected because of the ON NOMATCH REJECT phrase and shut off the FOCUS message that results from those transactions, you can use this LOG statement:
LOG NOMATCH ON NOEMPL MSG OFF
Adding the logging facility enables the end user to deal with problem transactions after entering all the data.
How to: |
The HELPMESSAGE attribute enables you to specify a text message in the Master File of FOCUS data sources. The message is displayed in the TYPE area of MODIFY CRTFORMs.
The syntax for specifying the HELPMESSAGE attribute in the Master File is
FIELDNAME=name, ALIAS=alias, FORMAT=format, HELPMESSAGE= text...,$
where:
Is a one-line text message up to 78 characters, which may include all characters and digits. Text containing a comma must be enclosed in single quotation marks; leading blanks are ignored.
For example:
FIELDNAME=LAST_NAME, ALIAS=LN, FORMAT=A10, ACCEPT = SMITH JONES, HELPMESSAGE = 'LAST_NAME MUST BE SMITH, OR JONES',$
The field for LAST_NAME has an ACCEPT attribute that tests values entered for that field. If a value other than Smith or Jones is entered, the following messages will be displayed:
(FOC534) DATA VALUE IS NOT AMONG ACCEPTABLE VALUES FOR LAST_NAME LAST_NAME MUST BE SMITH, OR JONES
The HELPMESSAGE attribute can be used with a field that has an ACCEPT test (see the Describing Data manual), or any other field in the Master File.
Messages specified with the HELPMESSAGE attribute are displayed when:
Regardless of the condition that triggers display of the message specified with the HELPMESSAGE attribute, the same message will appear.
In order to see the HELPMESSAGE text for a field on the CRTFORM, set a PF key to HELP before executing the MODIFY procedure. To set a PF key, enter
SET PFnn = HELP
where:
Is the number of the PF key you want to define as your HELP key.
To display a message for a particular field, position the cursor on the data entry area for that field on the CRTFORM and press the defined PF Key. If no message has been specified for the field, the following message will be displayed:
NO HELP AVAILABLE FOR THIS FIELD.
Information Builders |