The sample files are located in %PUBLIC%\Documents\Micro Focus\Enterprise Developer\samples\Mainframe\CICS\DotNet\MFAIEXIT
The TN3270 listener and the DFHZAI terminal auto-install program have basic support for assigning a unique terminal netname and terminal ID, and for handling the basic IBM 3270 models — model 2, 3, 4, or 5, which have different screen sizes.
Normally, the client will send a terminal type name, which will be recorded in the TCTTE and used to assign the terminal model. (The resulting screen size can be seen in the output of the CINQ transaction.) DFHZAI will assign a terminal netname of the form NETaxxx, where a is a capital letter and xxx are three digits or capital letters. The terminal ID is taken from the last four characters of the netname.
Clients can also request a netname. DFHZAI will honor this request if the name, and the corresponding terminal ID, are not in use; otherwise, the request will be rejected and the conversation terminated.
Customers can override the normal handling of terminal types, netnames, and IDs in auto-install using the auto-install exit. Before finishing the terminal installation process, DFHZAI will try to link to a program named MFAIEXIT. If this program exists, it receives a commarea with the netname, ID, and device type currently assigned to the terminal. It can change any of those fields and set flags telling DFHZAI to set the changes in the TCTTE.
This facility provides a simple way to override the terminal model based on the netname requested by the client, for example.
The sample program recognizes the netname NEWNAME and changes it to FROMEXIT. It also recognizes the netnames MODELx, where x is 2-4, and sets the appropriate device type. You can modify this example program to suit your requirements.
To run this demonstration in Visual Studio :
The project contains:
The exit program receives the ai-exit control block (defined in mfaiexit.cpy) in its COMMAREA when it is invoked by the auto-install transaction program DFHZAI. It can modify the netname, terminal ID, and/or device type before returning. If it modifies netname or terminal ID, it must set ai-name-source-exit to true. Note that a modified netname or terminal ID must be unique among terminals attached to the region, or autoinstall will fail. If it modifies device type, it must set ai-type-source-exit to true. Note that a modified device type string is not validated, and if it is not of the form "IBM-327[89]-[2345]-E" (or "IBM-3287-1" for a printer), some aspects of terminal support might not work correctly.
This control block is passed to the exit program in the COMMAREA. If the exit modifies the netname or terminal ID fields (and wants autoinstall to use its values), it should set ai-name-source-exit to true. Similarly, if the exit modifies the device type, it should set ai-type-source-exit.