Default Error Message
Error handling provides a default error message for any field. The message has the following format:
ERROR AT row, column
How to Override the Default Message
The developer can override the default error message for a field by specifying an error message for use by error-handling. The online or batch compiler can be used to define an error message:
Additional Edit Criteria Page 3 of 7 Map name: EYHTST1 Version: 1 Element name EMP-STATE-0415 Subscript In record EMPLOYEE Version 100 Edit table name . . . ________ Version ____ Link with map (/) _ Edit type . . . . . _ 1.Valid values 2.Invalid values Code table name . . . ________ Version ____ Link with map (/) _ Error message (specify ID or text) ID. . . . . . . . . Prefix __ Number ______ Text. . . . . . . . NOT A VALID STATE CODE ________________________________________ DC365801 Map options processed successfully F1=Help F3=Exit F4=Prev F5=Next F6=Preview F7=Bkwd F8=Fwd
In the previous screen, the developer specifies a message on the line after the Text prompt. The message, NOT A VALID STATE CODE, is specified for the data field that follows STATE in this example.
For example, an error message is defined for the EMP-STATE map field in the following sample MFLD statement:
ADD MFLD EMP-STATE REQUIRED EXTERNAL PICTURE IS 'XX' ERROR MESSAGE IS 'NOT A VALID STATE'.
Defining a Message Field for a Map
An error message displays an input error only if a message field is defined for the map. The developer defines a message field for a map by using the online or batch compiler:
Note: When the developer enters either $MESSAGE or $M in the ELEMENT NAME field and presses <Enter>, the literal, SUBSCRIPT, changes to LENGTH and irrelevant fields are darkened, as illustrated in the following sample screen.
Field Definition Page 1 of 7 Map name: EYHTST1 Version: 1 ...5...10...15...20...25...30...35...40...45...50...55...60...65...70...75...80 _ ...5...10...15...20...25...30...35...40...45...50...55...60...65...70...75...80 Field at row 21 column 80 Drop field (/) _ Element name: $message Subscript 80 In record Version Edit Picture Display intensity 1 1. Normal 2. Bright 3. Hidden At end of field 3 1. Auto-tab 2. Lock keyboard 3. Take no action Unprotected (/) . . . . . / Required (/). . . . . . _ Automatically edited (/) _ Skipped by tab key (/) _ DC366004 Specify the variable field and any attributes F1=Help F3=Exit F4=Prev F5=Next F6=Preview F8=Fwd
Field Definition Page 1 of 7 Map name: EYHTST1 Version: 1 ...5...10...15...20...25...30...35...40...45...50...55...60...65...70...75...80 _ _______________________________________________________________________________ ...5...10...15...20...25...30...35...40...45...50...55...60...65...70...75...80 Field at row 21 column 80 Drop field (/) _ Element name: $MESSAGE Subscript 80 Display intensity 2 1. Normal 2. Bright 3. Hidden At end of field 3 1. Auto-tab 2. Lock keyboard 3. Take no action Unprotected (/) . . . . . Required (/). . . . . . _ Automatically edited (/) _ Skipped by tab key (/) _ DC366004 Specify the variable field and any attributes F1=Help F3=Exit F4=Prev F5=Next F6=Preview F8=Fwd
For example, a message field (MESS1) is defined for a map in the following sample MFLD statement:
ADD MFLD MESS1 MESSAGE LENGTH 80.
How are Messages Displayed?
The message field for a map displays the error message for a field in error if the dialog or program that uses the map redisplays the map with error-handling attributes. When several data fields contain incorrect input, the message field displays as many error messages as possible, in order of occurrence from top to bottom, right to left, of the incorrect data fields. A blank is displayed between each error message.
Copyright © 2013 CA.
All rights reserved.
|
|