Dim objApp As Object
Dim objModel As Object
Dim objDataSource As Object

Dim filename as String
Dim folder as String
Dim publish As String


Sub Main ()
    Rem On Error Resume Next

    folder = "C:\GAPS\Portal\System\Models"
    rem filename = "fin_belege.pyi"
    rem publish = "C:\GAPS\Portal\System\Cube_out\temp"

    rem folder = GetField(Command, 1, ",")
    filename = GetField(Command, 1, ",")
    rem publish = GetField(Command, 3, ",")

    Set objApp = CreateObject("CognosTransformer.Application")
    Set objModel = objApp.OpenModel(folder + "\" + filename)
   
    For i = 1 to objModel.DataSources.Count
        Set objDataSource = objModel.DataSources.Item(i)
        Print objDataSource.Name
        Print objDataSource.LocalPath
        If objDataSource.SourceType = 4 Then
           Print objDataSource.SQLExpression
        End If
        Print "--"
    Next
   
    objModel.Close
    objApp.Quit
End Sub
