DataStage Import Command Line

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
oacvb
Participant
Posts: 128
Joined: Wed Feb 18, 2004 5:33 am

DataStage Import Command Line

Post by oacvb »

Hi,

We are importing our code from One environment to other by using dssh and DS_IMPORTDSX. After compiling the jobs in Development environment, We have exported out code and moved to common place. We have exported both Design and Executables. When we imported the code into Testing environment by using dssh and DS_IMPORTDSX it imports only the binary but not design. Please let me know how to resolve the issue.

Regards,
Venkatesh Babu Obla
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Can you export/import successfully using Designer client? If so, then there's something wrong with the way you are using dssh or DS_IMPORTDSX but, without more information, there's no help we can give you on that - you need to let us know precisely what you did and what error messages obtained.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
oacvb
Participant
Posts: 128
Joined: Wed Feb 18, 2004 5:33 am

Post by oacvb »

Hello,

I could able to import the job from Designer. Please see the below commands that is used to import the job from Command Line.

#!/usr/bin/ksh
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Import DataStage jobs
# Parameters: 1. Directory where DSX files reside
# 2. DS project to import DSX files into
#
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function log {
print `date +%Y%m%d-%T` [$script] " -" $*
print `date +%Y%m%d-%T` [$script] " -" $* >> $LOGFILE
}

#----------------------
# Initialisation
#----------------------
script=$0
dssh=$DSHOME"/bin/dssh"

#----------------------
# 0. Verify parameters
#----------------------
if [[ $# -ne 2 ]]; then
print `date` [$script] " - Script Invocation Error - Please pass 2 parameters to script;"
print `date` [$script] " - 1. Import BSX directory - Fully Qualified"
print `date` [$script] " - 2. Data Stage Project Directory - Fully qualified"
print `date` [$script] " - Script Invocation Error - Please pass 2 parameters to script;"
exit 1
fi
#----------------------
# 1. checking for directory existence
#----------------------
if [ ! -d $1 ]; then
print `date` [$script] " - Parameter 1 must be an existing directory : " $1 " - does not exist"
exit 1
fi
if [ ! -d $2 ]; then
print `date` [$script] " - Parameter 2 must be an existing directory : " $2 " - does not exist"
exit 1
fi
IMPORTDIR=$1
PROJECTDIR=$2

LOGFILE="${IMPORTDIR}/importJobs.`date +%Y%m%d-%T`.out"
log '>>> Starting Execution <<<'
log ""
log 'Logfile ===> ' $LOGFILE
log 'Project Dir. ===> ' $PROJECTDIR
log 'Import Dir. ===> ' $IMPORTDIR
#----------------------
# 2. Get user confirmation to import into project
#----------------------

log " ===> Please confirm you want to import into Project: ${PROJECTDIR##*/} (y/n) :"
read RESPONSE
log "user response: $RESPONSE"
if [[ $RESPONSE != 'y' ]] ; then
log "importJobs aborted by user!"
exit 0
fi
#----------------------
# 3. list files to process
#----------------------
jobcount=0
log " >>> Files found to import <<<"
for file in $IMPORTDIR/*.DSX
do
let jobcount=jobcount+1
log $jobcount $file
done

#----------------------
# .3 Get user confirmation to proceed
#----------------------
log " ===> Please confirm you want to PROCEED with import of the above DSX files (y/n) :"
read RESPONSE
log "user response: $RESPONSE"
if [[ $RESPONSE != 'y' ]] ; then
log "importJobs aborted by user!"
exit 0
fi
log "User confirmation received - will continue with import ... "
log " >>> Files found to import <<<"
for file in $IMPORTDIR/*.DSX
do
let jobcount=jobcount+1
log $jobcount $file
done
#----------------------
# .4 Get user confirmation to proceed
#----------------------
olddir=`pwd`
cd $PROJECTDIR
totaljobs=$jobcount
jobcount=0
set -o xtrace

for file in $IMPORTDIR/*.DSX
do
let jobcount=jobcount+1
log "=================================>>>> IMPORT No:$jobcount of $totaljobs - $file "
log "Issuing command:" $dssh \"DS_IMPORTDSX $file -OVERWRITE -RTN \"
eval $dssh \"DS_IMPORTDSX $file -OVERWRITE\" > tmp.out 2>&1

status=$?

{ while read line;do
log $line
done } < tmp.out

log "<<<<==================================IMPORT Complete - Status Code = $status"
# if [[ $status = 0 ]] ; then
# echo "success - $status"
# else
# echo "failure - $status"
# fi

done

cd $olddir
grep "IMPORT Complete - Status Code" $LOGFILE > $LOGFILE.summary
log '>>> Finished execution <<<'
exit
naveen.p
Participant
Posts: 55
Joined: Sat Nov 21, 2009 5:19 am
Location: Chennai

Post by naveen.p »

Hi,

I too faced the same issue..
Could you please let me know how to resolve it

Naveen
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There are two solutions already in this thread.
:roll:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply