Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can BTEQ return an error code to Unix shell script?

Status
Not open for further replies.

CapsuleCorpJX

IS-IT--Management
Jun 23, 2004
70
US
BTEQ when used in UNIX returns a "return code" at the end of the run. Is there a way to manually set the RC?
Bascially if one of my BTEQ queries find something bad in the data, I want it to send a signal to the Unix Job (shell script) it is running under, that something went wrong, and then have Unix Job itself return an error code (abend).
 
check the manuals for EXIT/QUIT, there's an option:

.quit ERRORCODE|ERRORLEVEL|ACTIVITYCOUNT|1234

Dieter
 
Hello All:

Talking about "error code" in bteq, is there any variable that keep the error code when one error ocurrs in a bteq ? I know that in mloads we've got "&sysrc" but in a bteq?

Thanks.
 
Well I think you can store it in a korn shell script variable. But you'd have to split your BTEQ portion up into chunks inside your ksh script.

Say BTEQ "A" does this, and an error code is stored in $ErrorCodeA, and BTEQ "B" is called afterwards, and the error code is stored in $ErrorCodeB.

For example:

<Korn shell script start>
echo "hello"
BTEQ << EOF

< your bteq statements >

.IF Activity_Count <> 0 THEN .quit <errorcode>
EOF

ErrorCodeA=${?}

BTEQ << EOF

< your bteq statements >

.IF Activity_Count <> 0 THEN .quit <errorcode>
EOF

ErrorCodeB=${?}

<Korn shell script end>


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top