Home » SQL Server

How to read data from vsam files also

i want to know how can i use vsam(virtual storage access method) files.... i heard that we have to install attunity software... is it right?.. and can any one will tell me the exact procedure how i can use vsam files in ssis... and  vsam is nothing but VSAM (Virtual Storage Access Method ) is an access method for IBM's mainframe operating system, MVS, now called z/OS..

so if any one have any idea about this then plz let me know..


5 Answers Found


Answer 1

Hi Priyanka,

You may try using OLE DB provider for AS400 and VSAM to access VSAM. For more infomation, please see:

Jin Chen


Answer 2

thankx for the reply :)

do we have to install some software so that we can get the access to this vsam files?? if so which are those??

i have browsed over net and there i got the information like we should have something called as Z OS.. which is from attunity..

and do we have to change the framework???

if u get any information then plz let me knw...



Answer 3

thankx for the reply :)

do we have to install some software so that we can get the access to this vsam files?? if so which are those??

i have browsed over net and there i got the information like we should have something called as Z OS.. which is from attunity..

and do we have to change the framework???

if u get any information then plz let me knw...


Did you check the link Jin sent you? It contains all information you need. You have to install Microsoft Host Integration Server 2004 to have VSAM drivers available for use in SSIS.

Answer 4

I got a new assignment in South africa .In which i need to extract VSAM files(low volume) to MIS server(SQL server 2005) using SSIS.To let you know i am not mainframe resource or SSIS .I have experince of Informatica(ETL) tool so i can manage SSIS .Kindly let me know the way to goahead .


Answer 5

I got a new assignment in South africa .In which i need to extract VSAM files(low volume) to MIS server(SQL server 2005) using SSIS.To let you know i am not mainframe resource or SSIS .I have experince of Informatica(ETL) tool so i can manage SSIS .Kindly let me know the way to goahead .



I have a text file, where the data is seperated by commas.  The first row in the data is text.

The second row has integer, text, integer, integer,

My problem, is that I don't know how to read the text part.  I tried using "char xx[100]" and reading but then this always reads 100 elements, I want the text to be split by comma.  The text values vary in length.

Here is the code:

int Read_xAbTbl(void)
 int iVal_0;
 int fVal_1;
 int iVal_2;
 int iVal_3;
 int iVal_4;
 double iVal_5;
 double iVal_6;
 double iVal_7;
 double iVal_8;
 char sVal[100];

 int x, ab_version;
 char chrX[1000]; 
 int ret=0;
 int i=1;

 FILE * infile; 
 char temp_name[1000];
 strcpy(temp_name, cRunLocation);
 strcat(temp_name, "xGmabVerTbl.csv");
 infile = fopen(temp_name, "r");

 if(infile == NULL)
  LogFile<<"Error - unsuccessful open of file xGmabVerTbl.csv"<<endl;
  exit(0); //Do not necessarily have to read file
  LogFile<<"Successfully opened file xGmabVerTbl.csv"<<endl;

 ret = fscanf(infile,"%s",chrX); //Skip past the header
 { ret = fscanf(infile,"%d,%s,%lf,%d,%d,%d,%d,%d,%d", 

   ab_version = iVal_0;
   x = ab_version;  //VERSION INDEX
   SL_AbLoopVerArr[1] = 2;
   AbFee[x] = fVal_1;
   AbStepUpYr[x][1] = iVal_2;
   AbStepUpYr[x][2] = iVal_3;
   AbStepUpYr[x][3] = iVal_4;
   if(iVal_5 == 1) AbBenSw[x] = TRUE; else AbBenSw[x] = FALSE;
   AbMatYr[x] = iVal_6; //AB Maturity Year
   if(iVal_7 == 1)  AbStepAnnualSw[x] = TRUE; else AbStepAnnualSw[x] = FALSE;
   if(ret == EOF) break;
 return 0;





I am creating a Windows Service in VB.net to read a data from file. I need to read only particular measurement in that file and extract the data.  Can someone suggest how to do this?

Thnx in Advance!



I would like some guidance/suggestions on best practices with respect to handling the following scenario:

I have a text file that is being updated by another application every 30seconds.  I ultimately want/need this data in SQL Server.

So what would be the best method to read the last row of this text file at timed intervals, and push the data into SQL Server?

Thanks so much for any info/suggestions.

Warren M



1. I need to be able to read data in from an excel file.  Is there any code samples showing that?





I'm trying to import data from 7 columns in an excel spread using OpenXml and C#. I've looked through a bunch of documentation and examples but I can't seem to find a simple example that shows how to read and reference row data. I won't know how many rows I have, but I will know the column layout. Is there way to reference each cell in the row until the row has no data? I want to loop through the data row by row and insert to a db via linq. I know how to do the linq part.

Thanks. All help is appreciated.



Hi there, I'm using .NET 4.0 and I want to read the Excel 2010 document and store it in an access database. How Can I do this in c#.

Can anybody provide a some tutorials in Office related Application Development.

Regards Puboo My blog : http://thurupathan.spaces.live.com

I'm learning C#, coming from a C++ background. I'm trying to rewrite my C++ database code in C#, and I'm wondering what is the best way to read and write the individual data records. In C++, I often did something like this:

WriteFile(hFile,(LPCVOID) &aRecord, (DWORD) sizeof(aRecord), &dwBytesWritten,NULL);

where aRecord is an instance of a subclass of an abstract class Record. It is always a class with members which are "simple" data types: int, character array, bool

Since I got the size of the Record with the sizeof operator, I could easily navigate to certain offsets in the database file and know that I could read a record at a certain offset.

So my question is, what is the best way to write and read these records in C#? (I mean, which functions/approach should I use?)

If I use the automated serialization mechanism in C#, my understanding is that I end up writing additional data like the name of the class, the assembly, etc. So I'm thinking that I can achieve the same result I had in C++ by providing a Serialize member function to my record subclasses, and that function sequentially writes only the data members, in order, and nothing else. 

Would this be a plausible approach? Any input appreciated.




 I am storing some data regarding Windows form postion and windows state in an INI file before closing the form.When we again opens the form i am reading the Form postions from ini file and dispaing the form at that postion.

Right now i am using some API calls to achive this functionality.Is there any direct way to Read Those data from ini file and Write into that ini file without usng API?

ini file contents:

[PANE Rep Information Area]

[PANE Tabbed Detail Area]


Code to read or write files from/to INI :

'API callsPublicDeclareFunction GetPrivateProfileString Lib"kernel32"Alias"GetPrivateProfileStringA" (ByVal lpApplicationName AsString, ByVal lpKeyName AsInteger, ByVal lpDefault AsString, ByVal lpReturnedString AsString, ByVal nSize AsInteger, ByVal lpFileName AsString) AsIntegerPublicDeclareFunction WritePrivateProfileString Lib"kernel32"Alias"WritePrivateProfileStringA" (ByVal lpApplicationName AsString, ByVal lpKeyName AsInteger, ByVal lpString AsInteger, ByVal lpFileName AsString) AsInteger'Function To read the Data from ini FIlePublicFunction ReadDimensions(ByRef sIniFile AsString, ByRef objForm As frmMngtWkBook) AsObjectDim sReturnString AsString = String.Empty
Dim tmpPtr As IntPtr
sReturnString = NewString(" ".c,20)

tmpPtr = Marshal.StringToHGlobalAnsi("Height")
        Dim g_objProfile AsNew BLCommon.clsProfile
          lReturnCode = GetPrivateProfileString(objForm.Name, tmpPtr, String.Empty, sReturnString, cReturnLength, sIniFile)
        EndTryIf lReturnCode > 0 Then
          objForm.Height = Strip(sReturnString) / 15
        EndIfEndFunction'Function To write the Data into ini FIlePublicFunction WriteDimensions(ByRef sIniFile AsString, ByRef objForm As frmMngtWkBook, OptionalByRef bIgnoreSplitter AsBoolean = False) AsObjectDim sInputString AsString = String.Empty
  Dim tmpPtr5 As IntPtr
  Dim tmpPtr6 As IntPtr
 sInputString = (objForm.Height *15).ToString().Trim()
 tmpPtr5 =Marshal.StringToHGlobalAnsi("Height")
          lReturnCode = WritePrivateProfileString(objForm.Name, tmpPtr5, tmpPtr6, sIniFile)
          sInputString = Marshal.PtrToStringAnsi(tmpPtr6)




Hi Guys

I have created a Library project in .net and used Nunit to test some methods in other dll's. I have integrated NUnit with VS IDE and i can now run the test from the VS IDE itself. When i execute my tests from the Visual Studio using this option, all my tests are executing properly. When i execute this application by Executing the NUnit seperately from the iDE some strgange things started coming up. The line

string securityKey = ConfigurationManager.AppSettings["GetData.Key"].ToString();

is not able to pick anything from the config file. Can anyone help us on this





 a file contain only this     " free space  =234"

234 here value changes on different drives like(234,22222,433,2,1)

how can write vbscript read 234  to variable

 wating for your Answer



I have a fixed width flat file which contains many columns including a BLOB column. Each row of data spreads out to about 15-20 rows or more in the flat file because the BLOB data cannot fit in one row on the flat file. Also the BLOB data is Base 64 encoded.


I want to be able to read the BLOB data, I know the starting and ending character number e.g. from 150 to 32450. I want to extract this data & decode it. Is this possible?






my recorded script fail when it is replayed.  Is appears that a textfield accepts only number.  However, generated codes (during recording) in UiMap.designe.cs defines the field as string as below:

public void myTest()


HtmlEdit uITbFN4DigitEdit = this.UIIMPACTCaseManagementWindow.TestCaseManagementDocument2.UITbFN4DigitEdit;


In public class myTestParams()


public string UITbFN4DigitEdit = "1234";


Eventually, this feild will be populated with data lists in a .cvs file.  How to covert a string data from .cvs file to interger number? 

I tried the belows but they don't work.  Please help resolve this issue.

this.UiMap.methodParams.ControlSuchAsTextField = int.Parse(testContext.DataRow["column"].toString());

since the script do more than just populate a textfield, I also noticed that the script skipped selecting checkbox or selecting items from drop-down list.


While I'm trying to read connection string which is in App.Config file I'm getting error like "Object reference not set to an instance of an object."

string strconn = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"].ToString();

For the windows service where I need to keep app.config file and how to integrate that config file with the windows service exe file.

Thanks in advance.



I need some help in developing a task. I have a source database which is Oracle and it has a ZIP file stored inside the database in Binary format. When I move this data into the sql server 2005 database I get the data as binary data.

Now the task begins with SSIS, I need to read the binary data which gives us a zip file and then unzip this zip file and read the XML data which is present inside the Zip file.

I beleive some one might have already developed this task can you share the solution with us.

Note: As this has to be moved into production I dont have permission to use third party tools like Cozy roc or install winrar.exe and simpy calling this exe from the execute process task in SSIS.




I have an Excel file called Products.xls .
I have Columns A and B, with the titles NAME and QUANTITY.
The name of the sheet is SHEET1.
The file has about 40 lines.

How do i show these data on a Gridview or Listview ?

Thank you.



I have got a page in which there is a file upload option where I have to upload/import the csv file. What I want to do is to check if the correct format of file is uploaded for instance if any other than csv file is uploaded, the system should give an error message. Also what I need to do is to check certain fields of the csv file for instance there are some mandatory fields in the csv file which should be there like name , postcode, How can I check that these fields are not empty . After performing these task, the system should automatically upload the csv file onto the sql sever 2008. Any ideas  or tutorial ... will be highly appreciated. 


Private Sub DoMSExcel(ByRef ds As DataSet)
            Dim selectConnection As New OleDbConnection
            selectConnection.ConnectionString = ("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Me.myFilePath & "; Extended Properties=""Excel 8.0;""")
                enumerator = Me.TablesMapped.Keys.GetEnumerator
                Do While enumerator.MoveNext
                    Dim dataSetTable As String = Conversions.ToString(enumerator.Current)
                        Dim sourceTable As String = Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject("[", Me.TablesMapped.Item(dataSetTable)), "]"))
                        Dim adapter As New OleDbDataAdapter(("select * from " & sourceTable), selectConnection)
                        adapter.TableMappings.Add(sourceTable, dataSetTable)
                        adapter.Fill(ds, dataSetTable)


Exception :

I am getting  error

The Microsoft Jet database engine could not find the object 'abcgroup'.  Make sure the object exists and that you spell its name and the path name correctly.

how can i fix this error


The XML files will be uploaded by third party to a common location which can be access by us.
Now, I need to read the XML file when ever the files are uploaded by the third party user(our system should automatically check when ever files uploaded).
then i will read the data in XML file and update the status to my DB.
what method i can follow to do this process. I should automatically read the files when ever they uploaded.
i need the easy soultion for this.
please suggest me.
thanks in advance.


I am reading data from a TXT file that requires me to replace some of the existing data, and then write it back to the file.  The issue is, there are special characters in the file that get corrupted when I write the text back to the file.

For example, I have a string in a file "foo.txt" that has the following "€rdrf  +À [HIGH]".  My application reads the text into a string, goes through the line and replaces [HIGH] with a value, and then writes back to the file.  The issue is, the special text characters get corrupted.

Here is an abbreviated version of the code base:

string fileText = System.IO.File.ReadAllText("foo.txt");
fileText= iPhoneReferenceText.Replace("[HIGH]", low);
TextWriter tw = newStreamWriter("Path");

How do I read from the file without corrupting the special text characters?



how to read xml content in csharp XDocument.Load()


<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure