Issue with the unix 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
monaz
Participant
Posts: 98
Joined: Sat Aug 23, 2008 3:14 am

Issue with the unix After job subroutine

Post by monaz »

Hi all,

I am using the below unix script is it possible to call DS functions in the script.

Please guide me on this.

#! /usr/bin/ksh
# Load into od_trans_map_output table for HALO Transaction Mapping

#$INCLUDE DSINCLUDE JOBCONTROL.H

echo $1 $2 $3 $4 $5 $6
isql -U$4 -P$5 -S$2 <<-EOI1
use $3
go
truncate table $3..od_trans_map_output_new
go
EOI1
bcp $3..od_trans_map_output in $1 -U$4 -P$5 -S$2 -c -t "," > $6'\'od_trans_map_opt.log

LOG_COUNT=`grep -c 'failed' od_trans_map_opt.log`
Log=`grep -n 'failed' od_trans_map_opt.log`
echo "count:$LOG_COUNT"
if $LOG_COUNT = 1 then
call DSLogFatal("The job aborted because of bcp failed ","ExecSH")
# Abort
end
else
cat od_trans_map_opt.log
fi
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vrishabhsagar
Participant
Posts: 33
Joined: Mon Nov 12, 2007 1:02 am
Location: Bangalore

Re: Issue with the unix After job subroutine

Post by vrishabhsagar »

monaz wrote:Hi all,

I am using the below unix script is it possible to call DS functions in the script.

Please guide me on this.

#! /usr/bin/ksh
# Load into od_trans_map_output table for HALO Transaction Mapping

#$INCLUDE DSINCLUDE JOBCONTROL.H

echo $1 $2 $3 $4 $5 $6
isql -U$4 -P$5 -S$2 <<-EOI1
use $3
go
truncate table $3..od_trans_map_output_new
go
EOI1
bcp $3..od_trans_map_output in $1 -U$4 -P$5 -S$2 -c -t "," > $6'\'od_trans_map_opt.log

LOG_COUNT=`grep -c 'failed' od_trans_map_opt.log`
Log=`grep -n 'failed' od_trans_map_opt.log`
echo "count:$LOG_COUNT"
if $LOG_COUNT = 1 then
call DSLogFatal("The job aborted because of bcp failed ","ExecSH")
# Abort
end
else
cat od_trans_map_opt.log
fi

I am not very sure of what you are trying to do in the script, But if you are trying to send a message into the logs, then you can probably use dsjob command utility.
Rishabh Sagar V
Bangalore
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Call DSLogFatal is not available in a shell script. It is only available within the DataStage BASIC programming language, which only executes within the DataStage run machine. The same is true of $INCLUDE, though you've commented this out.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
monaz
Participant
Posts: 98
Joined: Sat Aug 23, 2008 3:14 am

Post by monaz »

ray.wurlod wrote:Call DSLogFatal is not available in a shell script. It is only available within the DataStage BASIC programming language, which only executes within the DataStage run machine. The same is true of $I ...
Thanks alot Ray,

I am actually capturing the log of bcp and searching if it fails then i need to abort the job.

So i need to write other routine to search and abort the same job. Is it the correct way to follow.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No, all you need to do is make sure your script exits with a non-zero status if your load has a problem, the job will notice and abort automatically.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply