[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: [sqr-users] Executing SQR using Unix Shell Script.



Hi Prasad,
Please see the Script Below. This is a Generic Script that can execute
any SQR with or Without Parameters and Options. 

I was a bit Lazy So INLINE Check is a Kind of Waste. You make take it
out. 

#! /usr/bin/ksh
#########################################################################################
# Program: sqrba
# Author: Dattatraya D Shetty
# Date:   May 21 2003
# Purpose:  This Program Will Run the SQR.
##########################################################################################

. .setenv.ksh

# Variables Needed to Run the SQR Programs
# $SCR/sqrba $Sqrpgm $Sqrparam $Sqrerr $Sqrlog $Sqrlis

arg=$#
case $arg in
    1)
        INLINE="Y"
        break
        ;;
    2|3|4|5)
        INLINE="N"
        break
        ;;
    *)
        echo "SQRBA_ERROR: Invalid Number for Argunets Passed.\nUsage
sqrba sqr_name [Parameter] [Error] [log]  [List]"
        exit 1
        ;;
esac
pgm=$1

Sqrpgm=$pgm.sqr
Sqrparam=${2:-$SQR_PGM/$pgm.prm}
Sqrerr=${3:-$LOGS/$pgm.err}
Sqrlog=${4:-$LOGS/$pgm.log}
Sqrlis=${5:-$SQR_PGM/$pgm.lis}

## The Implemetation Here is used for Security to Hide the User name 
#  and Password for ps command. 
$SQRS/sqr $SQR_PGM/$Sqrpgm  \? -E$Sqrerr -F$Sqrlis @$Sqrparam  <<EOFSQR
> $Sqrlog
$(cat ${STRPUSR_PWD})
EOFSQR

stat=$?
echo $stat

if  [ $stat  -ne 0 ]
then
    echo "SQRBA_ERROR: There are Errors While Running SQRBA Script
Check the Following Files for Error. Err = $Sqrerr, Log = $Sqrlog"
    exit 1
fi

exit 0

Also. 
.setenv.ksh is a file of all the Environment Variables. 


HTH. 
Datta. 
--- "Prasad. Koneru" <manukoneru@yahoo.com> wrote:
> Hello all,
> 
> We are converting our PSoft system from MVS/DB2 to
> Unix/Oracle. We have a need to execute all of our
> batch jobs using Unix Shell Scripts.
> 
> If anyone has a sample working shell script to execute
> a SQR in Unix, it will be of great help to us.
> 
> Thanks
> 
> Prasad Koneru.
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail SpamGuard - Read only the mail you want.
> http://antispam.yahoo.com/tools
> 
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users


__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users