Consulting

Results 1 to 7 of 7

Thread: Read a Mainframe Dataset (PDS) using VBA

  1. #1

    Post Read a Mainframe Dataset (PDS) using VBA

    Hi All,

    I need an idea how to write a VBA that will read the content of the Mainframe Dataset (PDS).

    I can able to access the tables available in DB2 on the specified Database using IBM Data Provider from VBA. So, I guess there should be a solution to read a PDS content using VBA.

    Your quick response will be appreciated.

    Thanks in advance.


    Regards,
    Kuttralakani

  2. #2
    VBAX Master stanl's Avatar
    Joined
    Jan 2005
    Posts
    1,141
    Location
    I assume you are using an ADO Connection with the DB2 Driver. What does your SELECT statement look like - meaning are you accessing the PDS as a whole, or specific fields in a data subset? Stan

  3. #3
    Quote Originally Posted by stanl
    I assume you are using an ADO Connection with the DB2 Driver. What does your SELECT statement look like - meaning are you accessing the PDS as a whole, or specific fields in a data subset? Stan
    Hi Stan,

    Currently, I have hard-coded the DB2 SQL inside the macro itself. And I use ADO Connection to connect with DB2 (As you said).

    Now I wish to have the DB2 SQL in a PDS. So that I will read the SQL from the PDS and imported into VBA to run it.

    Hope I have answered your question. Let me know if you need any info.

  4. #4
    Hi All,

    I need an idea how to write a VBA that will read the content of the Mainframe Dataset (PDS).


    I can able to access the tables available in DB2 on the specified Database using IBM Data Provider from VBA. So, I guess there should be a solution to read a PDS content using VBA.

    Your quick response will be appreciated.

    Thanks in advance.

  5. #5
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Not sure how the pc side would talk to the mainframe side. I used to use a pc program to download or upload a file.

    Once you get the pds file to the pc side, one of several methods should work. I would have to have an example to test to be sure.
    e.g.
    [vba]
    Sub t()
    Dim s As String
    s = TXTStr("C:\myfiles\wp\ken.txt")
    End Sub
    Function TXTStr(filePath As String) As String

    Dim str As String, hFile As Integer

    If Dir(filePath) = "" Then
    TXTStr = "NA"
    Exit Function
    End If

    hFile = FreeFile
    Open filePath For Binary Access Read As #hFile
    str = Input(LOF(hFile), hFile)
    Close hFile

    TXTStr = str
    End Function[/vba]

  6. #6

    Read Mainframe Dataset usin VBA

    Mainframes are powerful machines now a days.
    so for reading mainframe dataset using VBA we have to go through from DB2 which can easily access to Dataset.
    VBA uses the databases to hold data in mainframes and for this purpose it uses COBOL and JCL.
    so simply to read dataset by VBA you should have command on COBOL.

  7. #7
    VBAX Newbie
    Joined
    May 2012
    Posts
    1
    Location
    Data that could have resided on a mainfram or in another PC program. The code in Listing BC3-2 places the contents of the Word List table of the recodset.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •