Deletion of output file

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

chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Again, not possible from this particular bit of code. Seek your culprit elsewhere.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Latha1919
Premium Member
Premium Member
Posts: 178
Joined: Mon May 22, 2006 2:32 pm

Post 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)
dsx
Latha1919
Premium Member
Premium Member
Posts: 178
Joined: Mon May 22, 2006 2:32 pm

Post by Latha1919 »

How do I test before/after job routine in DataStage Manager, which is using DSGetLinkInfo for getting the DSJ.LINKROWCOUNT.
dsx
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Latha1919
Premium Member
Premium Member
Posts: 178
Joined: Mon May 22, 2006 2:32 pm

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

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Latha1919
Premium Member
Premium Member
Posts: 178
Joined: Mon May 22, 2006 2:32 pm

Post 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?
dsx
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Post 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 {} \;
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Latha1919
Premium Member
Premium Member
Posts: 178
Joined: Mon May 22, 2006 2:32 pm

Post 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.
dsx
Post Reply