Deletion of output file
Moderators: chulett, rschirm, roy
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)
$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
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.
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.
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
"You can never have too many knives" -- Logan Nine Fingers
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,
==============================
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
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?
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
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 {} \;
#------------------------------------------------------------------------------
# Deleting the Reject files of size =0
#------------------------------------------------------------------------------
find $REJECTDIR/ -size 0c -exec rm -f {} \;
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.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.
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
"You can never have too many knives" -- Logan Nine Fingers
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'.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. ...
Thanks a lot, for all your suggestions.
dsx