mercredi 12 août 2015

Wrapper Macro USING REFLECTION IBM TOOL

Hi I am basically java developer but currently assigned a project which contains wrapper macros rsf files. We need to debug the rsf files using reflection ibm tool these rsf contains vb script code. I am unable to debug this code, please any body help me how to debug and fix the code.

Sub CopyOOOMaxSchedule() Dim strMacroData As String Dim objADODBConn As Object Dim strSuccess As String

Dim failureCount As Integer
Dim successCount As Integer
Dim rowCount As Integer
Dim totalCount As Integer

strMacroData = MacroData
'strMacroData = "xxx::xxx::114062::Update::Provider=OraOLEDB.Oracle;Data Source=MACRODB;User ID=RxMacro;Password=mac20ro15;"
'strMacroData = "pbalaji1::swarup463::114500::ADD::Provider=OraOLEDB.Oracle;Data Source=MacroDB;User ID=RxMacroUAT;Password=Rx15Macro;"
 strMacroData = "pbalaji1::swarup463::114500::ADD::Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION =(ADDRESS =(PROTOCOL =TCP)(HOST =es01)(PORT =1521))(CONNECT_DATA =(SERVER =DEDICATED) (SERVICE_NAME =y37st01svc.uhc.com)));User Id=RxMacroUAT;Password=Rx15Macro;"

On Error GoTo Error_Main
If strMacroData <> "" Then
    Dim connstring As String
    Dim jobId As String
    Dim hostname As String
    Dim userName As String
    Dim passWord As String

    Dim modSwitch As String
    Dim macroInput() As String

    Dim WorkTableDataSet As Variant
    Dim CountsDataSet As Variant

    Dim objADODBRS As Object
    Dim strSQL As String

    Dim planStatus As Long

    Dim workTableRec(1 To 5) As String

    failureCount = 0
    successCount = 0
    rowCount = 0
    totalCount = 0

    macroInput() = Split(strMacroData, "::") 'Wrapper Macro Change

    'Start-Wrapper change to connect to host dynammically

    'connect to DB -  Begin
    connstring = macroInput(4)
    Set objADODBConn = CreateObject("ADODB.Connection")
    objADODBConn.open connstring
    objADODBConn.Errors.Clear
    'connect to DB - End

    'Connect to Host based on Host ID
    userName = macroInput(0)
    passWord = macroInput(1)
    jobId = macroInput(2)
    strTypeOfAction = macroInput(3)
    hostname = connectToHost(jobId, objADODBConn)
    'End of Connect to Host

    'Extract mod_switch field from macro_config table
    modSwitch = getModuleSwitch(objADODBConn)

    'Update the macro_status table with process ID based on job_id
    strSuccess = updateProcessDetailsForJob(jobId, objADODBConn)

    'Fetch the failure/success count from the macro_status table based on job_id
    CountsDataSet = getJobProcessCounts(jobId, objADODBConn)
    failureCount = CountsDataSet(1)
    successCount = CountsDataSet(2)
    totalCount = CountsDataSet(3)

    'jobId = 1

    'Get the records from work group table
    strSQL = "Select * from WRK122CP_OOO_MAX_SCHED WHERE JOB_ID =" & jobId & " AND STATUS IS NULL ORDER BY SEQ_NUM"
    Set objADODBRS = objADODBConn.Execute(strSQL)

   'Iterate the work group records
    If Not objADODBRS.EOF Then
        Do Until objADODBRS.EOF
            rowCount = rowCount + 1
            ErrorMessage = ""

            workTableRec(COL.CON_COL_FROM_SCHEDULE) = fxPadSpaces(objADODBRS("FROM_SCHEDULE"), 10)
            workTableRec(COL.CON_COL_TO_SCHEDULE) = fxPadSpaces(objADODBRS("TO_SCHEDULE"), 10)
            workTableRec(COL.CON_COL_DESCRIPTION) = fxPadSpaces(objADODBRS("DESCRIPTION"), 40)

            workTableRec(COL.CON_COL_NOTE) = objADODBRS("NOTE")

            workTableRec(COL.CON_COL_SEQ_NO) = objADODBRS("SEQ_NUM")

            'Set the status to processing in the work group table
            strSuccess = updateStatusForWorkTable(jobId, "Processing..", workTableRec(COL.CON_COL_SEQ_NO), objADODBConn)

            'Do the macro changes
            planStatus = fxProcessOOOMaxSchedule(userName, passWord, workTableRec)

            If planStatus <> 1 Then
                failureCount = failureCount + 1
            Else
                successCount = successCount + 1
            End If

            'If Error Message is empty then update Macro completed Successfully
            If Trim(ErrorMessage) = "" Then
                If planStatus <> 1 Then
                    ErrorMessage = STATUS_UPDATION_FAILED
                Else
                    ErrorMessage = STATUS_UPDATED_SUCCESSFULLY
                End If
            End If
            'Update the Work table Status as per Error Message Received
            strSuccess = updateStatusForWorkTable(jobId, ErrorMessage, workTableRec(COL.CON_COL_SEQ_NO), objADODBConn)
            strSuccess = updateCountsDetailsForJobInProgress(jobId, successCount, failureCount, objADODBConn)

            'Navigate to Next Record
            objADODBRS.MoveNext
        Loop
    End If

    'Check the mismatch in the records
    If (rowCount <> totalCount) Then
        failureCount = totalCount - successCount
    End If
End If
 strSuccess = updateCountsDetailsForJob(jobId, WRAPPER_COMPLETED, successCount, failureCount, objADODBConn)

Error_Main: 'update the macro status table with failure/success count and completed If (rowCount <> totalCount) Then failureCount = totalCount - successCount End If If Err.Number <> 0 Then strSuccess = updateCountsDetailsForJob(jobId, WRAPPER_FAILED, successCount, failureCount, objADODBConn) 'MsgBox Err.Number & ": " & Err.Description End If 'clean up variables Set objADODBConn = Nothing End Sub





Aucun commentaire:

Enregistrer un commentaire