rsh return code

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
agathaeleanor
Participant
Posts: 76
Joined: Mon Mar 05, 2007 9:26 pm
Location: Malaysia

rsh return code

Post by agathaeleanor »

Hi all.

May i know how to have the rsh command's return code correctly?
I have my script as

`rsh 10.1.65.196 -l ciopr01 ksh "/recovery/dmprod/prepaid_loading/scripts/DM_Sqlldr_enh.ksh ${TARGET_TABLE_NAME} ${JOB_NAME} ${DATA_SOURCE_NAME} ${USER_ID} ${PASSWORD}"; echo$?`

Even if my DM_Sqlldr_enh.ksh doing sqlloading, and the sqlload return code is 2, but by default it returns me 0.

Appreciate if anyone would help out or pointing to useful resources.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Your script is working fine, hence the 0. You need to add extra logic to detect the sqlldr failure and propogate that, typically by grepping the log for ORA errors and checking to see if a "bad" file was created.
-craig

"You can never have too many knives" -- Logan Nine Fingers
agathaeleanor
Participant
Posts: 76
Joined: Mon Mar 05, 2007 9:26 pm
Location: Malaysia

Post by agathaeleanor »

It is working now. Instead of grepping the bad file, I redirect the return code of sqlloading to a file and grep the result there.

Thank you, chulett.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Good. :D

For the record, I didn't say to grep the bad file, merely checking for its existence is enough. I have been known to grep the actual 'log' file for specific errors as well as check the return code explicitly.
-craig

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