Page 3 of 3

Posted: Tue Oct 17, 2006 7:04 am
by chulett
Again, not possible from this particular bit of code. Seek your culprit elsewhere.

Posted: Tue Oct 17, 2006 9:14 am
by Latha1919
Routine Code is as below:

$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF

ErrorCode = 0 ;* set this to non-zero to stop the stage/job

MoutDir= Field(InputArg,"~",1)
WarnFileName= Field(InputArg,"~",2)
dttm = Field(InputArg,"~",3)

WarnRows = DSGetLinkInfo(DSJ.ME,"WarningOutbox","ToWarningOutbox", DSJ.LINKROWCOUNT)

If WarnRows = 0 Then
Command = 'Erase "':MoutDir:'\':WarnFileName:'.':dttm:'.war.csv"'
End

Call DSExecute("NT", Command, Output, SystemReturnCode)

Posted: Wed Oct 18, 2006 6:03 am
by Latha1919
How do I test before/after job routine in DataStage Manager, which is using DSGetLinkInfo for getting the DSJ.LINKROWCOUNT.

Posted: Wed Oct 18, 2006 6:40 am
by chulett
You can't. You'll either need to write a teeny little test job that calls it or get sneaky and test a version of it in the Manager as a different type. :wink:

Create a test Transform Function and dump this code in it. Change Arg1 to be named InputArg and add the teeny bit of code needed so it can run stand-alone:

* Add a line to call DSAttachJob to get a handle. It would be all right to 'hard-code' the name of the job you intend to use the B/A version in.
* Use the obtained handle in place of DSJ.ME in the DSGetLinkInfo call.
* Good form says you call DSDetachJob when done with a handle.

Then you can 'Test' your routine in the Manager and pass back as the Ans any of the bits you need to check.

Posted: Wed Oct 18, 2006 7:40 am
by Latha1919
I am getting the following message, when I click on the Return value, in DataStage Manager.
==============================
Test completed.

DSLogFatal called from : DSGetLinkInfo
Message to be logged is...
> Job control fatal error (-7)
> (DSGetStageInfo) Unknown stage name WarningOutbox in job ValidationJob

Result = -7
===============================

Stage Name: WarningOutbox exists in ValidationJob. Why is it throwing error.

Thanks,

Posted: Wed Oct 18, 2006 7:48 am
by chulett
Make sure you've spelled it exactly right - case matters. And it needs to be an active stage - like the Transformer that feeds the output stage, not the output stage itself.

Posted: Wed Oct 18, 2006 10:07 am
by Latha1919
Craig,

I modified the routine as what you suggested. Tested the routine adn its working fine. This routine I had set as After-Job routine.

This job will be called recursively by the controller job, to process the input files and empty files will be deleted after each job run.
When I place only one file in the input folder and process it by the controller job, it's able to delete the empty file (if created). However, when I keep multiple files in the input folder and process it, the job (which is having the after-job routine) is hanging.

Why is it so? Any ideas?

Posted: Fri Oct 20, 2006 11:25 am
by dsscholar
I used following command to delete reject files with 0 size..

#------------------------------------------------------------------------------
# Deleting the Reject files of size =0
#------------------------------------------------------------------------------


find $REJECTDIR/ -size 0c -exec rm -f {} \;

Posted: Fri Oct 20, 2006 12:15 pm
by chulett
Latha1919 wrote:However, when I keep multiple files in the input folder and process it, the job (which is having the after-job routine) is hanging.
Typically that would mean your command is prompting for a user response - asking for permission or confirmation of something. There is no user there to answer so it hangs at that point.

You need to structure your command such that it either doesn't need to ask anything or a 'yes' answer is assumed. At this point, three pages into this conversation, I've got no idea what your code looks like any more. If you can't figure this one out, post it again.

Posted: Mon Oct 23, 2006 4:32 am
by Latha1919
chulett wrote:Make sure you've spelled it exactly right - case matters. And it needs to be an active stage - like the Transformer that feeds the output stage, not the output stage itself. ...
When I corrected the stage name with that of the Transformer Stage, it worked out. This issue was fixed on the same day, which you mailed me above. All these days I am off, so couldnt update the post as 'resolved'.

Thanks a lot, for all your suggestions.