ExecSH to remove dataset in After-Job subroutine

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ASU_ETL_DEV
Premium Member
Premium Member
Posts: 43
Joined: Tue Sep 09, 2008 1:56 pm

ExecSH to remove dataset in After-Job subroutine

Post by ASU_ETL_DEV »

Hello,
I am trying to delete three work datasets after the job is done. I placed this command statement in the After-Job subroutine of the parallel job:

$orchadmin rm #$TEMP_FILES_DIR#dset_BB_USERS_aft.ds; $orchadmin rm #$TEMP_FILES_DIR#dset_BB_USERS_bef.ds; $orchadmin rm #$TEMP_FILES_DIR#dset_BB_USERS_ccap.ds

The command gets executed but only the descriptor gets deleted. The data files connected to the descriptor remain on the node directories specified in the config file.
What am I doing wrong?

Thanks
Marco
ASU Developer
rkashyap
Premium Member
Premium Member
Posts: 532
Joined: Fri Dec 02, 2011 12:02 pm
Location: Richmond VA

Post by rkashyap »

Path issue. $orchadmin is getting substituted by null so Unix is executing "rm #$TEMP_FILES_DIR#dset_BB_USERS_aft.ds" and deleting the descriptor file.

In order to fix this issue:
a) You can create a Unix script and invoke it in "After job subroutine." See steps in technote.
Or
b) Give complete path to orchadmin. i.e.

Code: Select all

$APT_ORCHHOME/bin/orchadmin rm #$TEMP_FILES_DIR#dset_BB_USERS_aft.ds
ASU_ETL_DEV
Premium Member
Premium Member
Posts: 43
Joined: Tue Sep 09, 2008 1:56 pm

Post by ASU_ETL_DEV »

Thank you! So could I add $APT_ORCHHOME/bin to the PATH variable in dsenv and keep the ExecSH command as is (without the $ signs)?
ASU Developer
rkashyap
Premium Member
Premium Member
Posts: 532
Joined: Fri Dec 02, 2011 12:02 pm
Location: Richmond VA

Post by rkashyap »

Yes, assuming all requisite variables are correctly setup in dsenv. Try it and share the results.
ASU_ETL_DEV
Premium Member
Premium Member
Posts: 43
Joined: Tue Sep 09, 2008 1:56 pm

Post by ASU_ETL_DEV »

Just to test, I created a variable, ORCHADMIN_PATH, added it to the command and it worked:

#$ORCHADMIN_PATH#/orchadmin rm #$TEMP_FILES_DIR#/dset_BB_USERS_aft.ds

I'll add it to the PATH in dsenv.

Thanks for your help.
ASU Developer
rkashyap
Premium Member
Premium Member
Posts: 532
Joined: Fri Dec 02, 2011 12:02 pm
Location: Richmond VA

Post by rkashyap »

Please note that "After Job Subroutine" will run even on jobs fails.

It will be a good idea to push deletion to a subsequent step which is only invoked on job's success.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Please note the option / check box to only run on job success.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rkashyap
Premium Member
Premium Member
Posts: 532
Joined: Fri Dec 02, 2011 12:02 pm
Location: Richmond VA

Post by rkashyap »

Craig, Thanks for pointing this. ;-)
Post Reply