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
Issue with the unix After job subroutine
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 33
- Joined: Mon Nov 12, 2007 1:02 am
- Location: Bangalore
Re: Issue with the unix After job subroutine
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
Bangalore
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Thanks alot Ray,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 ...
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.