Hi,
in case anyone wants it, after much trial and error I finally found this
working example of a multi-line STDPARM shell script for BPXBATCH. I still
haven't found a way to have #comment lines, which seem to generate syntax
errors, but if I accept that limitation, I am happy enough with this.
// EXPORT SYMLIST=*
// SET BCDHOME='/usr/lpp/bcp/' home directory for BCP
// SET E='/u/xxxxx/' error messages here
//*
//* multiline shell script with complex control structures
//*
//* haven't found a way yet to include #comments without error
//*
//BPXBATCH EXEC PGM=BPXBATCH
//OUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDPARM DD *,SYMBOLS=(EXECSYS,OUT)
SH (
set -o verbose ;
set -o errexit ;
set -x ;
for jarname in `ls &BCDHOME.batch/*.jar 2>/dev/null` ;
do
if [ -z "$(echo $jarname | grep Doc\.jar)" ] ;
then
echo adding to ClassPath ;
CLASSPATH="$CLASSPATH":"$jarname" ;
fi
done ;
echo CLASSPATH is $CLASSPATH ;
)
> &E.bcd-write.out 2>&E.bcd-write.err
//
What I like about this is when there is a syntax error I get the message in
STDERR, and when there isn't the normal and error output goes to my specified
files. I needed this as the placement of the semicolons was a bit hard to
glean from the manual, e.g. 'for' needs one but not 'then' or 'fi', etc.
If anyone can suggest how to put a comment it that works without error, I'm all
ears.
For example of the error, this code that has the #comment added to the 'for',
SH (
set -o verbose ;
set -o errexit ;
set -x ;
for jarname in `ls &BCDHOME.batch/*.jar 2>/dev/null` #comment ;
do
if [ -z "$(echo $jarname | grep Doc\.jar)" ] ;
then
echo adding to ClassPath ;
CLASSPATH="$CLASSPATH":"$jarname" ;
fi
done ;
echo CLASSPATH is $CLASSPATH ;
)
> &E.bcd-write.out 2>&E.bcd-write.err
gives this error in STDERR:
FSUM7332 syntax error: got EOF, expecting do
I'm still learning the ins and outs of SH but I was surprised to read that a
comment is "EOF".
best regards,
Peter
(MVS-OE seems a little quiet so I thought I might start here).
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN