DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
Author Message
anajitKS



Group memberships:
Premium Members

Joined: 18 Dec 2014
Posts: 28
Location: Kansas City
Points: 544

Post Posted: Thu Jul 06, 2017 9:06 pm Reply with quote    Back to top    

DataStage® Release: 9x
Job Type: Server
OS: Unix
Additional info: Linux
I have created a user defined function.
Here is the code in the function

Code:
      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

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 42475
Location: Denver, CO
Points: 218489

Post Posted: Fri Jul 14, 2017 10:18 am Reply with quote    Back to top    

Did you ever get this figured out?

_________________
-craig

I know I don't say this enough, but I like when you talk to me. It's much better than when nobody talks to me. Or when people that I don't like will not stop talking to me.
Rate this response:  
Not yet rated
ray.wurlod

Premium Poster
Participant

Group memberships:
Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group

Joined: 23 Oct 2002
Posts: 54166
Location: Sydney, Australia
Points: 293772

Post Posted: Mon Jul 17, 2017 3:58 am Reply with quote    Back to top    

Start by providing the exact error message, and the FUNCTION line from your routine (so that we understand what the arguments are).

_________________
RXP Services Ltd
Melbourne | Canberra | Sydney | Hong Kong | Hobart | Brisbane
currently hiring: Canberra, Sydney and Melbourne
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours