Page 1 of 1

Function works in debug mode but does not work in normal mod

Posted: Thu Jul 06, 2017 9:06 pm
by anajitKS
I have created a user defined function.
Here is the code in the function

Code: Select all

      WorkFileName = 'wrk':FileName
      XMLFileName = 'XML.':FileName

      If OutputDirectoryPath = '' Then
         OutputDirectoryPath = InputDirectoryPath
      End
      If Store = 'XGLOBAL' Then
         Store=''
      End 
      MoveCommand = 'mv ':InputDirectoryPath:'/':FileName:' ':InputDirectoryPath:'/':WorkFileName
 
      CountCommand = 'wc ':InputDirectoryPath:'/':WorkFileName

      RemoveCommand = "rm ": InputDirectoryPath:"/":XMLFileName:" ": InputDirectoryPath:"/":WorkFileName
      Call DSExecute('UNIX',RemoveCommand ,Output,ReturnCode)


      CALL DSExecute('UNIX',MoveCommand,Output,ReturnCode)
      If ReturnCode<> 0 Then
         ReturnCode= ReturnCode:'-':Output
         Goto Exit
      End

      Call DSExecute('UNIX',CountCommand,Output,ReturnCode)
      If ReturnCode <> 0 Then
         ReturnCode = ReturnCode :'-':Output
         Goto Exit
      End

      RecordCount = Left(TRIM(Output),index(TRIM(Output)," ",1)-1)

      HdrXML = '<Header line_count="':RecordCount:'"': ' download_id="':FileName:'"':' target_org_node="':Store:'"': ' download_time="IMMEDIATE"  apply_immediately="true" />'

      XMLCreateCommand = "echo  ":"'": HdrXML :"'": " >": InputDirectoryPath:"/":XMLFileName
      PrependHdrCommand = "cat " : InputDirectoryPath:"/":XMLFileName:" ": InputDirectoryPath:"/":WorkFileName : " > " :OutputDirectoryPath:"/":FileName
      RemoveCommand = "rm ": InputDirectoryPath:"/":XMLFileName:" ": InputDirectoryPath:"/":WorkFileName

      Call DSLogInfo( 'XMLCreateCommand --' : XMLCreateCommand, 'jobcontrol')
      Call DSLogInfo( 'PrependHdrCommand --' : PrependHdrCommand, 'jobcontrol')
      Call DSLogInfo( 'RemoveCommand     --' : RemoveCommand , 'jobcontrol')

      Call DSExecute('UNIX',XMLCreateCommand:";":PrependHdrCommand:";": RemoveCommand ,Output,ReturnCode)
      If ReturnCode <> 0 Then
         ReturnCode = ReturnCode :'-':Output
         Goto Exit
      End



Exit:
      Ans=ReturnCode
This function is invoked from a Transformer and works fine in debug mode.
In normal Mode it cannot get pass the Transformer where this function is used and comes back with an error.Log indicates the error on a stage that is used before so many stages before the Transformer. It shows the correct Link count of the link which is input to the Transformer.But it does not get pass the transformer

What am I missing here?

Posted: Fri Jul 14, 2017 10:18 am
by chulett
Did you ever get this figured out?

Posted: Mon Jul 17, 2017 3:58 am
by ray.wurlod
Start by providing the exact error message, and the FUNCTION line from your routine (so that we understand what the arguments are).