DFHMDF Macro


The DFHMDF (Define Field Macro) is a Basic Mapping Support (BMS) macro used to define individual fields (data entry or display fields) within a map in a CICS application. It works inside a DFHMDI (Map Definition) and defines the position, length, attributes, and default values of a field on a 3270 terminal screen.

Purpose -

  • Defines input and output fields for user interaction on a CICS terminal.
  • Controls field behavior such as protected (read-only) or unprotected (editable).
  • Specifies cursor position, colors, highlighting, and other display attributes.
  • Works with DFHMSD (Mapset Definition) and DFHMDI (Map Definition) macros to design structured user interfaces.

Syntax -

field-name DFHMDF    POS=(row,column),
					 LENGTH=field-length,
					 ATTRB=(attribute-list),
					 INITIAL='default-text',
					 HILIGHT=OFF|BLANK|REVERSE|UNDERLINE,
					 COLOR=color-option,
					 PICIN=input-picture-value,
					 PICOUT=picture-clause,
					 JUSTIFY=LEFT|RIGHT|BLANK|ZERO
  • POS=(row, column) - Specifies the position of the field on the screen. Example: POS=(5,10) places the field at row 5, column 10.
    • row: Row number where the field starts.
    • column: Column number where the field starts.
  • LENGTH=field-length - Defines the maximum number of characters in the field. Example: LENGTH=10 allows 10 characters of input/output.
  • ATTRB=(attribute-list) - Controls the field behavior and specifies the attributes of the field. Example: ATTRB=(UNPROT,NUM,IC)
    • ASKIP: specifies that user can’t able to enter the data into the field. When user enters tab from previous field, control will skip the field because of ASKIP attribute and places control to next field.
    • PROT: Protected (read-only). Specifies that user can’t able to enter the data into the field. But cursor can be placed on the same field. PROT is coded for output and stopper fields.
    • UNPROT: Unprotected (user can type). specifies the data can be entered into the field and used as input or output fields.
    • BRT: specifies the field should be highlighted with high intensity.
    • NORM: specifies the field should be highlighted with normal intensity.
    • DRK: specifies the field should not be highlighted or not printed or not displayed.
    • NUM: specifies user can enter numeric input only.
    • IC: Sets cursor at this field when the screen loads.
    • FSET: specifies the MDT (Modified Data Tag) and used to check whether the specific field is modified or not while receiving the MAP. MDT returns the modification status of the field to the application program and uses for the field data validation.
  • INITIAL='default-text' - Provides default text to be displayed in the field. Example: INITIAL='Enter Customer ID:'
  • HILIGHT=OFF|BLINK|REVERSE|UNDERLINE
    • OFF: is default and indicates no highlighting is used.
    • BLINK: used to specify to field must blink.
    • REVERSE: used to specify character or field displayed in reverse.
    • UNDERLINE: used to underline the field. If the terminal doesn't support highlighting, these parameters is ignored.
  • COLOR=color-name - Specifies the color used for the field. Valid colors are blue, green, neutral, pink, red, turquoise, and yellow. If the default value of the output device is ignored, it is to be used as the basic color for this field.
  • PICIN=in-picture-clause - Specifies the input field picture clause of the particular field for the symbolic map.
  • PICOUT=out-picture-clause - Specifies the output field picture clause of the particular field for the symbolic map.
  • JUSTIFY=LEFT|RIGHT|BLANK|ZERO - Specifies the data justification of the field in the map.
    • LEFT: specifies that the data is left justified.
    • RIGHT: specifies that the data is right justified.
    • BLANK: specifies that blanks are to be inserted in the unfilled positions of the field.
    • ZERO: specifies that zeroes are to be inserted in the unfilled positions of the field.

Examples -


Scenario - Customer Inquiry Mapset

  • Mapset name - CUSTINQ
  • Map name - CUSMAP
CUSTINQ DFHMSD TYPE=MAP,
		   MODE=INOUT,
		   LANG=COBOL,
		   CTRL=FREEKB,
		   STORAGE=AUTO,
		   TIOAPFX=YES,
		   TERM=3270

CUSMAP   DFHMDI SIZE=(24,80),
		   LINE=1,
		   COLUMN=1,
		   CTRL=(FREEKB,FRSET)

         DFHMDF POS=(5,10),
               LENGTH=10,
               ATTRB=(PROT,IC),
               INITIAL='Enter ID: '

CUSID    DFHMDF POS=(5,25),
               LENGTH=10,
               ATTRB=(UNPROT,IC),
               COLOR=GREEN

         DFHMSD TYPE=FINAL
		 END

Explanation - DFHMDF (Field Definitions)

  • CUSID: Defines an input field for entering a Customer ID.
  • POS=(5,25): Positioned at row 5, column 25.
  • LENGTH=10: Accepts 10 characters.
  • ATTRB=(UNPROT,IC): Field is unprotected (editable) and inserts the cursor at the field.
  • INITIAL='Enter Customer ID': provides prompt text.

Usage in CICS Program -


The DFHMSF macro defines the fields in the map. The application program uses the field name to send the data from program to map and receive the data from the map to program.

  • Map name - CUSMAP
  • Mapset name - CUSTINQ
IDENTIFICATION DIVISION.
PROGRAM-ID. CUSTINQR.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-VAR.
...
LINKAGE SECTION.
01 DFHCOMMAREA     PIC X(10).

PROCEDURE DIVISION.

    EXEC CICS SEND
         MAP('CUSMAP')
         MAPSET('CUSTINQ')
         ERASE
         END-EXEC.

    IF EIBAID = 'ENTER' THEN
		 EXEC CICS RECEIVE
			MAP('CUSMAP')
			MAPSET('CUSTINQ')
			INTO (CUSMAPO)
         END-EXEC.
		 ...
		 ...
    END-IF.

    EXEC CICS 
		RETURN
    END-EXEC.
    GOBACK