MAGEC's Edit Types are one-character codes which you can specify to control the editing (validation and formatting) for individual fields (Data Items). The Edit Type determines the appearance on a screen or report which a given Data Item will have -- it determines the Cobol PICTURE.
There are three major categories of Edit Types:
As a general rule, MAGEC validates the data which is entered by a terminal operator into each screen field according to the Edit Type for each field. MAGEC accepts any valid entry and reformats it into a standard format for that field. For example: in a "money" field (Edit Type "$"), the operator could enter any of the following:
All of the above will be parsed correctly and accepted. The data need not be left justified or right justified in the screen field, MAGEC will find the significant characters and handle them correctly. Regardless which format the operator has entered, however, MAGEC will reformat the data as:
which will be right justified (so that decimal points will align if you are displaying a column of fields).
Similar rules apply to all other Edit Types, as appropriate.
There are three places where you might specify an Edit Type for a field:
If you specify an Edit Type for a screen field (using MSKDEF), then that definition applies only to that field on that one Mask. Similarly, if you specify an Edit Type for a report field (using RPTDEF) the definition applies only for that one report. If you specify the Edit Type on the Data Item definition (using the DITxxx Function) then it applies to all Masks and all reports unless overridden for an individual Mask or report as described above. The definition on the DIT file is considered to be the default Edit Type for the field.
There are several other specifications which work in conjunction with the Edit Type. They might be considered to be "modifiers" for the Edit Type. They are:
Obviously some of these specifications apply only to certain Edit Types. Significant Digits and Decimal Places apply only to Numeric Edit Types (and they have a special meaning for Dates). Table number applies only to Edit Type "T" (Table Lookup). Pattern applies only to Edit Types "P" and "#" (Pattern Edits).
When you use the Automatic Screen Painter or the Automatic Report Painter, the Edit Types (and other specifications) for each field are taken from the DIT (Data Item) definition and placed into the generated Mask or report field definition. You can view and, with limitations, modify these specifications online via the MSKDEF or RPTDEF Functions. In either case you simply select the field you wish to see/modify by pointing to it with the cursor and pressing PF18 (Shift-F8 on a PC). A "window" pops up on the bottom lines of the screen display, showing all the specs.
In the case of MSKDEF, you can modify any of the specs shown by simply overkeying them. MAGEC will validate your altered specs to be sure they agree with one another and are all valid. This enables you to control the "Automatic Editing" which will be generated for each screen field. You should be careful not to specify a non-Numeric Edit Type for a field whose Source/Target field is numeric since the Edit Type determines both validation and the Cobol PICTURE generated in the Mask.
In the case of RPTDEF the specifications are "protected" to prevent your modifying them. If you wish to alter the appearance of that field on the report, you can do so by altering the actual Cobol PICTURE which is displayed along with the other specifications. The Edit Type and related specs will be used to generate a Cobol PICTURE for the sort-work file in the generated batch program and therefore must not be altered from the settings generated by the Automatic Report Painter. For fields which you "manually" add to a report (using PF20 in RPTDEF), all of the specs are available for you to modify.
There are two Edit Types for "pattern editing". "P" is for Alpha-Numeric pattern-edited fields, and "#" is for Numeric pattern-edited fields. Pattern editing allows you to compose your own formats, character-by-character. For example, a numeric Social Security number, "PIC 9(9)", with a value of "123456789" from the file or database could be displayed on the screen with hyphens inserted, as "123-45-6789", using a pattern of "999
On the DIT definition the pattern is coded in the specification called "Pattern".
In MSKDEF the pattern is keyed right into the image of the screen field itself. If the Edit Type is "P" or "#" then MAGEC will validate that you have specified a legal pattern. If the Edit Type is not "P" or "#" the pattern will be accepted as just another literal value and will not be validated. That is, of course, how you specify the initial values for all your screen constants (headings and prompts) in MSKDEF.
In RPTDEF you code the pattern into the "Pattern" specification.
Valid Pattern Edit characters are:
A detailed illustration of a pattern edit may be found in Example 5, in the Examples section later in this chapter.
For Date Edit Type fields MAGEC generates full editing and validation to ensure that the operator's entry is a valid date. The validation includes leap year and centesimal recognition. MAGEC assumes that all dates are stored on the files as YYMMDD or CCYYMMDD (4-digit year) and automatically reformats them for whichever screen/report display format is desired. MAGEC's Automatic Editing will always pass to your program not only the Gregorian date entered by the operator, but also the Julian equivalent and a day-of-week code (1 = Sunday, 2 = Monday, 7 = Saturday, etc.).
MAGEC does not consider Gregorian dates to be numeric, therefore, it generates PIC XX fields to define the components of a date (YY, MM, DD, and optionally CC). If a date field is optional (the Required/Optional specification is not "R") and the operator leaves it blank on the screen then the default value for the field will be SPACES, not ZEROS.
For Date fields, the Significant Digits and Decimal Places specifications have a special meaning, different from their usual meanings for Numeric fields. Significant Digits is used to indicate whether the date is a 2-digit year or a 4-digit year. A value of 04 indicates 4-digit year, a value of 02 or 00 indicates a 2-digit year. Decimal Places indicates how old a date can be, which is entered into this field. For example, a value of 03 will cause MAGEC to reject any date having a year (YY) lower than the current year minus 3. This helps stop accidentally accepting a date of 1967 when 1987 was intended.
If a date is specified with a 4-digit year and the operator keys only 2 digits in the year position, MAGEC will default to the current century and fill-in the missing digits.
Any screen field can be specified as being either required ("R") or optional ("O" or blank) in the Required/Optional specification. If the Edit Type is one of the Numeric types, then MAGEC will use a default value of ZERO if the operator leaves it blank. Otherwise the default will be SPACES.
MAGEC uses the underscore character ( _ ) to fill enterable fields on the screen in certain circumstances in order to show the operator the location and size of data he/she is to enter. In order to eliminate the need for the operator to delete the underscores MAGEC automatically converts them to spaces for all incoming screen data. Leading, trailing, or embedded underscores in any screen field are equivalent to leading, trailing, or embedded spaces.
MAGEC allows you to use the full range of 3270 attributes, including extended color and extended highlighting, if your CRT hardware supports them. Attribute settings and controls are totally independent of Edit Types and Automatic Editing. It is permissible for you to set a numeric-shift attribute for a screen field which is not specified with a Numeric Edit Type. It is also permissible for you to specify field protection or skip protection for a screen field which is specified as being required according to the Required/Optional code. Though all of these combinations are useful at some time or another, you should take care not to create confusing or conflicting combinations which make life difficult for your users. When MAGEC applies the default Attributes in the Automatic Screen Painting process, it generates properly matched Edit Types and Attributes.
When dealing with numeric data on screens and reports, you should remember that the Edit Type can affect the field length. Also, changing the Edit Type for a field might also require altering the field length. The field length must obviously be long enough to contain all the digits plus any decimal point, commas, minus sign, or dollar sign. In some cases (very crowded screens) this could become significant.
When you generate a Mask (using the MSKCREAT job stream or the online MSKCRE function) one of the outputs is a Cobol "copybook" definition of that Mask. The copybook will be named MSKxxx-C, where "xxx" is the Mask number. For example, the copybook for Mask 600 would be named MSK600-C.
The definitions for screen fields vary, based upon the Edit Types and other specifications. Let us assume that you have a screen field named "Sfield". We will discuss the various definitions for it based upon its possible Edit Types.
If Sfield has an Alpha-Numeric Edit Type, you would find in the Mask copybook:
If Sfield has a Numeric Edit Type, you would find all of the above plus:
If Sfield has a Date Edit Type, you would find all of the same definitions as for an Alpha-Numeric Edit Type plus:
If Sfield is specified for extended color support you would find all of the above, as appropriate, plus:
For more detailed information regarding extended color, please refer to the "COLOR 3270" chapter of this manual.
NOTE:
NOTE:
In the following examples we have abbreviated certain terms as follows:
These examples depict the data your program (online MMP) will receive for the various Edit Type fields, based upon what the operator has entered. They assume a screen field name of "Sfield".
These examples do not show every possible Edit Type, or every possible combination of specifications. They are intended to convey the philosophy of editing and validating data using MAGEC's Automatic Editing feature. You can do unlimited additional editing via Cobol customization coding, if necessary.
Specific information on each edit type and options is covered in the preceding sections of this chapter.
Note:
Other Related Specifications
Automatic Screen/Report Painting
Patterns
-99-9999". Or, an alpha-numeric Canadian Postal Code, "PIC X(6)", with a value of "M5W2AB" on the file could be displayed as "M5W 2AB" using a pattern of "A9A 9A9".
Dates
Required/Optional
Underscores
Attributes
Field Length
Mask Copybook
Table of Edit Types
Alpha-Numeric
Numeric
Date
Examples
b ) is used to represent a blank character.