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

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
anajitKS
Premium Member
Premium Member
Posts: 28
Joined: Thu Dec 18, 2014 7:57 pm
Location: Kansas City

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

Post 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?
ABHIJIT DUTTA
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Did you ever get this figured out?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply