Edit Types

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:

  • Alpha-Numeric
  • Numeric
  • Dates
  • 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:





    $1234.5 etc.

    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.

    Where You Specify Edit Type

    There are three places where you might specify an Edit Type for a field:

  • on the DIT definition          via DITxxx Function
  • on a Screen Field definition      via MSKDEF Function
  • on a Report Field definition      via RPTDEF Function
  • 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.

    Other Related Specifications

    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:

  • Significant Digits           digits left of decimal point
  • Decimal Places          digits right of decimal point
  • Table Number          lookup-table number for validation
  • Required/Optional code           whether field is required entry
  • Pattern          special display patterns
  • 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).

    Automatic Screen/Report Painting

    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
    -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".

    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:

    X to allow any character in this position

    A to allow alphabetic characters only in this position

    9 to allow numeric characters only in this position

    - insertion character     

    ( insertion character

    ) insertion character

    / insertion character

    . insertion character

    : insertion character

    blank insertion character

    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.

    Field Length

    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.

    Mask Copybook

    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:

    Sfield The field itself. It would have a PIC X(..).

    SfieldE A one-byte error flag, a value of "E" indicates that the data in Sfield is invalid.

    SfieldA The one-byte 3270 Attribute code.

    Sfield-POSN The 2-byte binary (halfword) screen field position (relative to 0).

    If Sfield has a Numeric Edit Type, you would find all of the above plus:

    Sfield-N A packed numeric field containing the numeric value of the data in Sfield, with the proper number of decimal places.

    Sfield-ED A redefinition of Sfield having an appropriate Cobol "edit" picture (i.e. PIC $$,$$$.99).

    If Sfield has a Date Edit Type, you would find all of the same definitions as for an Alpha-Numeric Edit Type plus:

    Sfield-JULIAN-DATE A packed field with the Julian equivalent (YYDDD or CCYYDDD) of the date in Sfield.

    Sfield-DAY-OF-WEEK A packed one-digit field with the day-of-week code (1 = Sunday, etc.) for the date in Sfield.

    If Sfield is specified for extended color support you would find all of the above, as appropriate, plus:

    Sfield-COLOR A one-byte field containing the standard 3270 color code for extended color.

    SfieldH A one-byte field containing the standard 3270 extended highlighting code.

    For more detailed information regarding extended color, please refer to the "COLOR 3270" chapter of this manual.

    Table of Edit Types


    X Miscellaneous data. Any data will be considered valid. Example: description fields.

    blank Same as "X".

    A Alphabetic data only. Uppercase A thru Z and space. Example: person's name.

    U Uppercase. Any characters will be accepted, MAGEC will convert any lower-case alphabetic characters to upper-case automatically. Example: codes or any other data where lower-case alphabetic's are illegal.

    T Table lookup. Same as "U", plus MAGEC will validate operator's entry by looking it up in a table. Example: state abbreviation.

    W A field whose only purpose is to display the description from a MAGEC lookup table. Example: state name.

    P Alpha-numeric pattern-edited field. Example: product code.


    N Numeric with leading zeros, MAGEC will pad leading zeros if not entered by operator. Example: employee number.

    S Numeric without leading zeros, MAGEC will suppress them if entered by operator. Example: Page number.

    = Same as "S", but with a trailing minus sign (if negative). Example: remaining vacation days.

    Z Same as "S", with commas inserted every third digit.

    - Same as "S", with commas inserted plus trailing minus sign.

    $ Numeric with floating dollar sign, leading zero suppression, comma insertion. Example: salary amount.

    # Numeric pattern edited field. Example: social security number, phone number.



    M Date to be displayed as MM/DD/YY (2-digit year) or MM/DD/CCYY (4-digit year).

    D Date to be displayed as DD/MM/YY (2-digit year) or DD/MM/CCYY (4-digit year).

    Y Date to be displayed as YY/MM/DD (2-digit year) or CCYY/MM/DD (4-digit year).



    In the following examples we have abbreviated certain terms as follows:

                                   Edit Type     TYP:

    Significant digits left of decimal point     SIG:

               Digits right of decimal point     DEC:

                                     Pattern     PAT:

                                Table Number     TBL:


    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.


    Example 1

    TYP:     T




    TBL:     003

    Operator Entry     Sfield     SfieldE     SWFLD

             TX        TX           b         TEXAS

             TZ        TZ           E         b

    This example assumes that Table 003 is a State Abbreviation Table, defined to MAGEC, and that the 2-character post office state abbreviations are being used. It also assumes that SWFLD is the name of a screen field which is specified as an Edit Type "W" field and that Sfield's specifications point to SWFLD as its "W" field.

    Example 2

    TYP:     X (or b )





    Operator Entry     Sfield     SfieldE

             ABC#3     ABC#3         b

             abc&5     abc&5         b

    Example 3

    TYP:     U





    Operator Entry     Sfield     SfieldE

            ABC#3      ABC#3       b

            abc&5      ABC&5       b

    Example 4

    TYP:     A





    Operator Entry     Sfield     SfieldE

             ABC D     ABC D       b

             ABC#3     ABC#3       E

             ABC 5     ABC 5       E

             abc       abc         E

    Example 5

    TYP:     P



    PAT:     XX9-99A


    Operator Entry     Sfield     SfieldE     Moved to Database

           AB2-12B     AB2-12B     b           AB212B

           A32-12B     A32-12B     b           A3212B

           A3A-12B     A3A-12B     E

           AB3 12B     AB3-12B     b           AB312B

    The Pattern insertion character ( ) is stripped from the data when moved to the database and it is inserted into the data when it is displayed on a screen or report.

    The operator may enter a space in lieu of the insertion character when keying into the screen. MAGEC will accept the space and replace it with the proper character.

    The Edit mask characters "X", "A", and "9" indicate what type of character may be entered into each position, as follows:

         X     any character

         A     alphabetic characters only

         9     numeric characters only.

    Example 6

    TYP:     N

    SIG:     03

    DEC:     02



    Operator Entry     Sfield     SfieldE    Sfield-N*

             2         002.00        b       +2.00

             2.7       002.70        b       +2.70

             27        027.00        b       +27.00

            -27        -27.00        E       +0

            2.777      2.777         E       +0

            2.770      002.77        b       +2.77

            00027      027.00        b       +27.00

    * Moved to database.

    Example 7

    TYP:     #

    SIG:     09

    DEC:     00

    PAT:     999-99-9999


    Operator Entry     Sfield      SfieldE      Sfield-N*

       123-45-6789     123-45-6789     b       +123456789

       123 45 6789     123-45-6789     b       +123456789

       123-W5-6789     123-W5-6789     E       +0

    Also, see comments for Example 5, Edit Type "P".

    * Moved to database.

    Example 8

    TYP:     $

    SIG:     05

    DEC:     02



    Operator Entry   Sfield     SfieldE       Sfield-N*

    2                $2.00        b           +2.00

    2.7              $2.70        b           +2.70

    1234.55          $1,234.55    b           +1234.55

    1234.555         1234.555     E           +0

    1234.550         $1,234.55    b           +1234.55

    1,234            $1,234.00    b           +1234.00

    1234             $1,234.00    b           +1234.00

    -23              -23          E           +0

    123456           123456       E           +0

    * Moved to database.

    Example 9


    SIG:     05

    DEC:     02



    Operator Entry     Sfield     SfieldE     Sfield-N*

              2        2.00       b      +2.00

              -2       2.00-      b      -2.00

              2-       2.00-      b      -2.00

              -2-      -2-        E      +0

              20.5-    20.50-     b      -20.50

              - 20     - 20       E       +0

    * Moved to database.

    Example 10

    TYP:     M

    SIG:     02

    DEC:     00



    Oper Entry     Sfield      SfieldE    -JULIAN-DATE   -DAY-OF-WEEK

    020387         02/03/87     b          0087034        3

    2/3/87         02/03/87     b          0087034        3

    2387           00000000000  E          0     0

    2/29/87        2/29/87      E          0     0

    2/29/88        2/29/88      b          0088060        2

    29/2/88        29/2/88      E          0     0

    02 03 87       02/03/87     b          0087034        3

    The value of "02" in SIG: indicates a 2-digit year, such as "87". A value of "04" would mean a 4-digit year, such as "1987". Similar edits are provided for EDIT TYPE "D" and "Y".

    The value of "00" in DEC: indicates that any valid year will be accepted.

    As a default, MAGEC will automatically reformat dates into YYMMDD (or CCYYMMDD) as they are moved to the database.

    MAGEC also handles leap-year and centesimal editing.