No proper output while running routine

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
hhh
Participant
Posts: 86
Joined: Tue Aug 02, 2005 7:39 am

No proper output while running routine

Post by hhh »

While running following routine
$INCLUDE DSINCLUDE JOBCONTROL.H
InfoMessage = Arg1
PathName = Arg2
Output =''
OpenSeq PathName To FileVar Else ; * Open the sequential file or if not exist then create seq file
CREATE FileVar ELSE ABORT
WriteSeq InfoMessage TO FileVar ELSE STOP ; * writing input argument(Arg1) to FileVar
End
Ans = ''
Loop
ReadSeq FileLine From FileVar ; * Read sequential file through Fileline
On Error
Call DSLogWarn("Error from ":PathName:" status=":Status(),"MyRoutine")
End
Then
Cmd = 'grep ':'_':' ':FileLine ; * Text for searching the "_" character in InfoMessage
Call DSExecute('UNIX',Cmd,Output,SystemReturnCode) ; * Call DSExecute command to run in Unix
Ans = Output ; * Assign the Output of grep command in Ans variable
End Else
Exit
End
repeat
CloseSeq FileVar
===================
Test Output
TEST #1
*******

Arg1 = sequential_file_12345
Arg2 = /abc.txt

Test completed.


Result = grep: can't open sequential_file_12345

===============

Here i provide Arg1 = sequential_file_12345, so my result should be same as Arg1 however in this case i am gettng Output :

Result = grep: can't open sequential_file_12345

Pls look into this and advice me for same

Regards,
Hiten
Last edited by hhh on Thu Sep 21, 2006 1:18 am, edited 4 times in total.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Please edit your post and put code tags around your program so we can see the indentation.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Your code is confused. For example, consider what this code fragment does if the pathname exists. What did you want it to do?

Code: Select all

OpenSeq PathName To FileVar Else 
   CREATE FileVar ELSE ABORT 
   WriteSeq InfoMessage TO FileVar ELSE STOP 
End 
CloseSeq FileVar 
Do you REALLY want to work with files in the root directory (/abc.txt)? Do you have sufficient permission to do so?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
hhh
Participant
Posts: 86
Joined: Tue Aug 02, 2005 7:39 am

Post by hhh »

Have updated my code with code tags and comments.


[quote="kduke"]Please edit your post and put code tags around your program so we can see the indentation.[/quote]
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

hhh wrote:Have updated my code with code tags and comments.
Oh, no you haven't!
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