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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Parameter Value

Status
Not open for further replies.

jmanj

Programmer
May 20, 2003
298
US
Hi all,

I'm writing a cobol program that calls a .ksh script
with 2 parameters. In my script it will look something
like this:

TMPDIR1="/DEVDIR/edi"
TMPDIR2="/DEVDIR/work"
WORKFILE="EDIFILE.txt"
TEMPFILE1="REJECT.TXT"
cd $TMPDIR1
parm2=$2 EXPORT parm2

IF $1=1; Then
cd $TMPDIR1

if [ -f $TMPDIR1/$TMPFILE1]; then

cp ${TMPDIR1}/${TMPFILE1} ${TMPDIR2}/`date +%y%m%d%H%M%S`${WORKFILE}

else

parm2=2

fi
fi


What I'm trying to do is to test if the file is present, if not then change parameter 2 value to 2 so that my cobol program can process the returned value. I don't know if this
is the correct way of doing it.

I'll appreciate any help on this!!!


jmanj
 
Hi,

the value you have assigned to parm2 will not be available after your script has ended, no matter whether the script has been called by a Cobol program or by anything else.
What you want to do is to check the return code of the script.
I don't know anything about Cobol, but in any programming language there should be a way of doing it; if you need help, ask in a Cobol forum.
In your shell script, call exit 2, instead of parm2=2, and have your Cobol program check if returncode is 2.

hope this helps
 
Alternatively, I guess you could write the value to a check file so that you can use that to do your test.

Alan Bennett said:
I don't mind people who aren't what they seem. I just wish they'd make their mind up.
 
Thank you all for some hints on this. I'll try the cobol forum then. I know I can do this by writing a java script(api) but my client wants it in ksh. I was just wondering if there was a way of resetting paramatera to something but you have given me an idea about exit function
tho.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top