Exec Command Activity

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
neeraj
Participant
Posts: 107
Joined: Tue May 24, 2005 4:09 am

Exec Command Activity

Post by neeraj »

Hello,

In one of my Job, I have used a Exec command stage activity in which I am trying to capture the Job Statistics from the server as below

DSHOME=`cat /.dshome`;. $DSHOME/dsenv;
SRC_CNT=$($DSHOME/bin/dsjob -linkinfo MCB_IDAP_P jb_SRC_to_TGT_Norm_Load ODBC_Delta lnk_ODBC_Delta | awk 'NR>1{exit};1{print $5}');
TGT_CNT=$($DSHOME/bin/dsjob -linkinfo MCB_IDAP_P jb_SRC_to_TGT_Norm_Load XFM_Split_I_D_U lnk_XFM_Split_I_D_U | awk 'NR>1{exit};1{print $5}');
REJ_CNT=$($DSHOME/bin/dsjob -linkinfo MCB_IDAP_P jb_SRC_to_TGT_Norm_Load XFM_Null_Handling lnk_XFM_Reject | awk 'NR>1{exit};1{print $5}');
JOB_STATUS=$($DSHOME/bin/dsjob -jobinfo MCB_IDAP_P jb_SRC_to_TGT_Norm_Load | egrep 'Job Status');
JOB_START_TIME=$($DSHOME/bin/dsjob -report MCB_IDAP_P jb_SRC_to_TGT_Norm_Load | egrep 'Job start time');
JOB_END_TIME=$($DSHOME/bin/dsjob -report MCB_IDAP_P jb_SRC_to_TGT_Norm_Load | egrep 'Job end time');
JOB_ELAPSED_TIME=$($DSHOME/bin/dsjob -report MCB_IDAP_P jb_SRC_to_TGT_Norm_Load | egrep 'Job elapsed time');
echo $SRC_CNT,$TGT_CNT,$REJ_CNT,$JOB_STATUS,$JOB_START_TIME,$JOB_END_TIME,$JOB_ELAPSED_TIME;

The expected outcome of this activity is
Reply=0
Output from command ====>

Status code = 0

Status code = 0

Status code = 0

Status code = 0
23945,1313,88,Job Status : RUN with WARNINGS (2), Job start time=2019-04-10 16:21:38, Job end time=2019-04-10 16:22:27, Job elapsed time=00:00:49

And most of times the job gives me correct result but in last few days my jobs are randonly failing as I am getting additional row (Status =0) which is making the return row count to 6 instead of 5

Reply=0
Output from command ====>

Status code = 0

Status code = 0

Status code = 0

Status code = 0

Status code = 0
23945,1313,88,Job Status : RUN with WARNINGS (2), Job start time=2019-04-10 16:21:38, Job end time=2019-04-10 16:22:27, Job elapsed time=00:00:49

And job fails as it is trying to read the Row no. 5.

When I reset the sequncer and re-run the same job, it executes successful and create the correct output i.e. 5 rows instead of 6.

Can anyone help me in fixing this behaviour which looks quite wiered, how the same job can return different values when there is no change anywhere.

Regards
Neeraj
Post Reply