Today we will start our Azure Logic Apps Mission Critical Series: "We Speak", with the "IBM Host Files" technologies.
There are multiple types of IBM Host Files. Host files can exist in Mainframes or Midranges and have their own types and characteristics.
For instance, VSAM or Virtual Storage Access Method is a file storage access method used in Mainframes and Midranges. It was introduced by IBM in 70’s and it organizes and maintains data in a catalog structure.
VSAM files can be used in COBOL programs like other physical sequential files. VSAM are the logical datasets for storing records. The records in a VSAM file can be of fixed length or a variable Length. VSAM files can be read sequentially and randomly in COBOL programs.
With an increasing demand on modernizing or migrating Mainframe or midranges applications that use Host File data such as VSAM files to Azure, it is becoming more common to access this files and integrate them into Modern solutions.
Microsoft provides two ways to access and operate with IBM Host Files. The first by connecting directly to them via the Managed Host Files Provider and the second to operate with them in a disconnected manner via the IBM Host Files connector (offline parser).
The Managed Host File Provider for Direct Access to Host Files
The Managed Host File Provider operates in most ways as a normal data provider: you can connect to a host file system, execute commands, and retrieve data.
To use it, you will need the Host Integration Server development edition along with Visual Studio 2019.
The Host Integration Designer XML (HIDX) file is used to create the record layout for your IBM host file. The HIDX file is created via the Host Integration Server Designer (HIS Designer) which is a graphical user interface that you can use to create to create Host Integration Server projects in Visual Studio.
If your data looks like this:
You will need a COBOL copybook that expresses the data layout as follows:
Once you create a Host File project in Visual Studio, you will be able to import it and create an HIDX file that looks like this:
The Data Access Tool:
The Data access tool helps creating connection strings for DB2, Host Files and Informix. It is part of Host Integration Server.
Once you select the Data Access Tool, click on New Data Source and then Host Files. For an IBM Mainframe, you will be asked to enter information about your SNA configuration: Local LU, Remote LU, Mode along with information about the type of data you are trying to access.
One of the steps in the wizard, will ask you for an HIDX file. You will need to reference it here.
At the end of the process, you will be able to obtain a connection string that looks like this:
User ID=USER1; APPC Remote LU Alias=REMOTELU1; APPC Local LU Alias=LOCALLU1; APPC Mode Name=PA62TKNU; Network Transport Library=SNA; Host CCSID=37; PC Code Page=1252; Network Port=446; LoadBalancing=False; Process Binary as Character=False; Connection Pooling=False; Default Library=LIBRARY; Metadata=C:\Path\CustomerDataBaseZOS.hidx; Password=UserPassword;
The following example uses a IDataReader to return data from a query:
The following is sample data obtained with this query:
To Read data:
SELECT * FROM <TABLE>
WHERE POSITION EQUALS(<POSITION>)
WHERE KEY (<COLUMN>) EQUALS (<VALUE>)
WHERE KEY (<COLUMN>) BETWEEN (<VALUE>) AND (<VALUE>)
To Write data:
INSERT INTO <TABLE> (<FIELD>) VALUES(<VALUE>)
UPDATE <TABLE> SET(<FIELD>) (<VALUE>)
DELETE FROM <TABLE>
UPDATE and DELETE WHERE clauses follow the Select WHERE clause format.
To conduct a Bulk update of a VSAM table using the Host File Adapter:
HostFileDataAdapter myAdapter = new HostFileDataAdapter(sqlCommand, connString);
int nRowsUpdate = myAdapter.Update(dataSet);
int nRowsFill = myAdapter.Fill(dataSet);
The IBM Host File Built-in Connector (Parser)
The IBM Host File Standard connector is a thin wrapper round the Host Integration Server feature “Flat File Parser”.
This is an offline connector. As such, it requires its data to come from any Trigger or Action that produces binary data, e.g., FTP or a Blob Storage action.
Some customers prefer not to connect directly to Host Files but to process them in Azure. They prefer local appliances that make IBM Host files available offline and that can be uploaded and processed in the cloud.
For this purpose, you will need to create an HDIX file as shown in the previous section and use it along with the Host File connector. You will not need to install Host Integration Server but to download the HIS Designer for Logic Apps. There is one setting that you should enable in the Visual Studio options that will make your HIDX file compatible with the connector. The setting is “Include support for Flat File Processor and Logic Apps”. Then you can proceed to create your HIDX file.
Once you have created your Logic App, then you should upload your HIDX file in Maps as illustrated below:
In your workflow, you should add the IBM Host Files connector:
Then you should Create a connection. You will need a name and a Code Page. You should enter 37 (EBCDIC USA/Canada). E.g., 273 (EBCDIC for Austria/Germany).
In the next step, you will then need to enter the HIDX file name and the Schema name. The Schema name can be extracted from the properties of the Table in your HIDX file:
In the Binary contents field you will need to read the data from the Mainframe FTP, a Blob Storage or Azure File Storage. In this case, I am reading the content from a Blob Storage.
The following video explains how to work with IBM Host Files and includes a demonstration of the features available in Host Integration Server and Azure Logic Apps for that purpose.