Converting BMS maps and using the Map class

Many CICS® server programs use Basic Mapping Support (BMS) to implement their 3270 screen designs. The server programs can then use symbolic names for the individual screen maps and for the 3270 fields on those maps. If the BMS source files are available, they can be copied to the Client daemon development environment and used in the implementation of a Visual Basic EPI program.

The CICS BMS Conversion Utility (CICSBMSC.EXE) that is provided produces a Visual Basic definitions file (a .BAS file) from the source BMS file (.BMS file). This definitions file can then be included in a Visual Basic program, and the same symbolic names used to identify maps and their fields in the server program can be used in the client program with the EPI Map COM class.

The /B option should be specified when running the conversion utility to produce Visual Basic definitions:

           CICSBMSC /B <filename>.BMS
The following example shows how to use the Map COM class to access fields by their BMS symbolic names:
        Dim EPI As CclOEPI
        Dim Terminal As CclOTerminal
        Dim Session As CclOSession
        Dim Screen As CclOScreen
        Dim Map as CclOMap
        Dim Field As CclOField
First the EPI is initialized and a 3270 terminal connection to CICS is started as in the earlier example:
        Sub EPIConnect_Click()
            'Create Ccl.EPI first to initialize EPI
            Set EPI = New CclOEPI
            'Create a terminal object and connect to CICS
            Set Terminal = New CclOTerminal
            Terminal.Connect "CICSNAME","",""
            'Create a session object (defaults to synchronous)
            Set Session = New CclOSession
        End Sub
Then the BMS application is started. This example uses a transaction code "EPIC" which runs the CICS supplied server program EPIINQ:
        Sub EPIRunBMS_Click()
            Terminal.Start Session, "EPIC", ""
            Set Screen = Terminal.Screen
At this point the CICS server program has returned the first screen to the client. This is expected to be a known map "MAPINQ1" so we create a Map object, and use the Map.Validate method to initialize it and to verify that we received the expected 3270 screen. Fields can then be accessed using the Map.FieldByName method:
            Set Map = New CclOMap
            If (Map.Validate(Screen,MAPINQ1)) Then
                Set Field = Map.FieldByName(MAPINQ1_PRODNAM)
                List1.AddItem Field.Text
                Set Field = Map.FieldByName(MAPINQ1_TIME)
                List1.AddItem Field.Text
            Else
                List1.Text= "Unexpected screen data"
            End If

A more complex application would then enter data into selected fields, set the required AID key (Enter, Clear, PF or PA key) and navigate through further screens as required. The client application can mix the use of the Screen COM class (and its FieldByIndex and FieldByPosition methods) with the use of the Map COM class.