Using Host file provider - MsHostFileClient in HIS 2006 for VSAM and other mainframe files
Hostfile provider :
Microsoft.HostIntegration.MsHostFileClient.Dll in HIS 2006
Purpose :
Provide access( read , update, Query data) to Mainframe Host files like :
VSAM files :
( RRDS, VRRDS, KSDS, KAIX, ESDS, EAIX)
Libraries :
( PDS, PDSE)
FLAT files :
FB and VB
Using Hostfiles Provider needs :
1. Assembly designed in TI which looks like the one attached .
Assembly needs to be registered and GACed
2. Connection String pointing to Host
1 ) configure SNA for APPC communication to Mainframe
2) Create connection string using Data access Tool for Mainframe file System( Select Connection string properties as configured in step above )
3. Host Data file
Can be created by FTP or submitting JCL to create new file.
4. C# App with sample code :
using
Microsoft.HostIntegration.MsHostFileClient;
using
System.Reflection;
namespace
ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
HostFileConnection cn = new HostFileConnection();
string cnstring = @"Provider=SNAOLEDB;User ID=XYZ;Password=xyz;APPC Remote LU Alias=REMOTE;APPC Local LU Alias=LOCAL;APPC Mode Name=MODENM;Network Transport Library=SNA;Host CCSID=37;PC Code Page=1252;Network Port=999;Process Binary as Character=False;Persist Security Info=True;Cache Authentication=False;Default Library=XYZ;Host Column Description File=;Repair Host Keys=False;Strict Validation=False;";
cn.ConnectionString = cnstring;
try
{
string query = "SELECT INT1 FROM VBREC";
HostFileRecordSet rs;
HostFileCommand cmd = new HostFileCommand();
cmd.Connection = cn;
cmd.CommandText = query;
cmd.CommandType = System.Data.CommandType.Text;
// This code would set :Metadata="VBlock, Version=1.0.0.0, Culture=neutral,
// PublicKeyToken=9218ec74baad7731" in connection string
cn.Metadata = Assembly.LoadFile(@"C:\HISTests\DataTests\Binaries\HostFileProvider\VBlock.DLL");
cn.Open();
rs = cmd.ExecuteRecordSet();
int i = 0;
while (rs.Read())
{
System.Console.WriteLine(rs.GetValue(i));
i++;
}
}
catch (Exception e)
{
System.Console.WriteLine(e.Message);
}
finally
{
cn.Close();
}