IMS MFS: Message Format Service Complete Guide
IMS MFS (Message Format Service) is the IMS equivalent of CICS BMS — it defines the layout of 3270 terminal screens and controls the formatting of messages between the terminal and the IMS program. MFS separates the screen layout from the program logic, allowing screen changes without recompiling programs.
What MFS Does
When a 3270 terminal user interacts with an IMS application, MFS:
- Formats the output screen — places data from the program's output message into the correct screen fields
- Deformats the input — extracts field values from the terminal input and builds the program's input message
Without MFS, the program would receive raw 3270 data streams and would need to parse field positions itself. MFS handles all the 3270 protocol complexity.
MFS vs CICS BMS
| Aspect | IMS MFS | CICS BMS |
|---|---|---|
| Screen definition | FMT/DEV macros | DFHMSD/DFHMDI/DFHMDF macros |
| Assembly | MFSGEN utility | BMS compile + assembly |
| Runtime module | MFS library (MFSLIB) | CICS CSD |
| Program interface | Message I/O area | SEND MAP / RECEIVE MAP |
Both serve the same purpose — BMS developers will find MFS conceptually familiar.
MFS Building Blocks
MFS uses three main object types:
MID (Message Input Descriptor): Defines the format of a message coming from the terminal into the program. Maps 3270 field data to program message fields.
MOD (Message Output Descriptor): Defines the format of a message going from the program to the terminal. Maps program message fields to 3270 screen positions.
DIF (Device Input Format): Describes the physical 3270 input format — field positions on the screen for input.
DOF (Device Output Format): Describes the physical 3270 output format — where fields appear on the screen.
In practice, MID and DIF are combined in one source member, and MOD and DOF are combined in another.
Basic MFS Source Example
A simple inquiry screen for customer display:
* ============================================
* CUSTFMT — Customer Inquiry Screen Definition
* ============================================
*
* Device Format — Output (DOF)
CUSTDO FMT
DEV TYPE=(3270,2),FEAT=IGNORE,
DSCA=X'00A0', *> display attributes
MODE=OUT
DIV TYPE=INOUT
DPAGE CURSOR=((1,1))
*
* Row 1: Title
DFLD 'CUSTOMER INQUIRY',POS=(1,30),ATTR=(PROT,HI)
*
* Row 3: Customer key input
DFLD 'CUSTOMER ID:',POS=(3,2),ATTR=(PROT,NORM)
CUSTITAG DFLD POS=(3,15),LTH=10,ATTR=(UNPROT,NORM,IC)
*
* Row 5: Customer name output
DFLD 'NAME:',POS=(5,2),ATTR=(PROT,NORM)
CUSTNOUT DFLD POS=(5,15),LTH=40,ATTR=(PROT,NORM)
*
* Row 6: Status message
CUSTMSG DFLD POS=(24,1),LTH=79,ATTR=(PROT,NORM)
*
FMTEND
*
* Message Output Descriptor (MOD)
CUSTMO MSG TYPE=OUTPUT,SOR=(CUSTDO,IGNORE)
MFLD CUSTNOUT,LTH=40 *> program field maps to CUSTNOUT
MFLD CUSTMSG,LTH=79 *> message field maps to CUSTMSG
MSGEND
*
* Message Input Descriptor (MID) + Device Input Format (DIF)
CUSTDI FMT
DEV TYPE=(3270,2),FEAT=IGNORE,MODE=IN
DIV TYPE=INPUT
DPAGE
CUSTIKFD DFLD POS=(3,15),LTH=10,ATTR=((UNPROT,NORM))
FMTEND
*
CUSTMI MSG TYPE=INPUT,SOR=(CUSTDI,IGNORE)
MFLD CUSTIKFD,LTH=10 *> map input key field
MSGENDGenerating MFS Blocks
MFS source is assembled using the MFSGEN utility:
//MFSGEN EXEC MFSGEN
//SYSIN DD DSN=YOUR.MFS.SOURCE(CUSTFMT),DISP=SHR
//MFSLIB DD DSN=IMS.MFSLIB,DISP=SHR
//SYSOUT DD SYSOUT=*The generated MID and MOD blocks are stored in MFSLIB.
Using MFS in the IMS Program
The program specifies which MOD to use when writing output by placing the MOD name in the IOPCB:
* Build output message
MOVE 'JOHN SMITH ' TO OUT-CUST-NAME.
MOVE ' ' TO OUT-MSG-LINE.
* Write output using named MOD
MOVE 'CUSTMO ' TO IOPCB-MOD-NAME.
CALL 'CBLTDLI' USING ISRT-FUNC
IOPCB
OUTPUT-MSG-AREA.The IOPCB-MOD-NAME field specifies which MOD formats the output. This allows one program to use different screen formats for different situations (normal display, error display, different device types).
Frequently Asked Questions
Q: Is MFS still used in new IMS development in 2026? MFS is used for maintaining existing 3270 terminal applications, which remain in production at many mainframe sites. New development typically uses OTMA-based access (REST APIs, Java) that bypasses MFS entirely. However, understanding MFS is essential for any developer maintaining legacy IMS TM applications.
Q: Can an IMS TM program work without MFS? Yes. For OTMA-connected programs (e.g., called via REST API or MQ), MFS is not used — the input and output are plain message buffers. For 3270 terminal programs that do not need screen formatting, programs can send and receive raw character strings. MFS is required only when you need formatted 3270 screen layouts with field attributes and cursor positioning.
Q: What is MFSUTL and when is it used? MFSUTL is the MFS utility program used for MFS library maintenance — listing, copying, and deleting MFS blocks. It is also used to format and list existing MID/MOD blocks for analysis. The IMS Explorer tool provides a graphical interface for MFS work in modern environments.
Part of the IMS Mastery Course — Module 17 of 22.
