I am trying to create some JCL procedures using symbols in instream
data, with the ability to override the symbol using standard procedure
calling conventions.
This almost works:
//JOB1 JOB CLASS=A,
// MSGCLASS=H,
// NOTIFY=&SYSUID
//*
//TEST PROC MESSAGE='''Hello World'''
//SYMBOLS EXPORT SYMLIST=(SYM)
// SET SYM=&MESSAGE
//S1 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD DUMMY
//SYSUT1 DD *,SYMBOLS=JCLONLY
&SYM
//SYSUT2 DD SYSOUT=*
// PEND
//*
//S1 EXEC TEST
//S2 EXEC TEST,MESSAGE='''Hello Again'''
//*S3 EXEC TEST
Output is
Hello World
Hello Again
but if you uncomment S3 the output is:
Hello World
Hello World
Hello World
I think the problem is the placement of the EXPORT statement - the proc
can't EXPORT the parameters used to call it. I used the SET statement to
get around that but it has side effects.
I can get it to work (I think) with nested procedures:
//JOB2 JOB CLASS=A,
// MSGCLASS=H,
// NOTIFY=&SYSUID
//*
//TEST PROC MESSAGE='''Hello World'''
//SYMBOLS EXPORT SYMLIST=(MESSAGE)
//INNER EXEC INNER,MESSAGE=&MESSAGE
// PEND
//*
//INNER PROC
//S1 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD DUMMY
//SYSUT1 DD *,SYMBOLS=JCLONLY
&MESSAGE
//SYSUT2 DD SYSOUT=*
// PEND
//*
//S1 EXEC TEST
//S2 EXEC TEST,MESSAGE='''Hello Again'''
//S3 EXEC TEST
Output is as expected:
Hello World
Hello Again
Hello World
but nested PROCs is getting a bit clunky. I suspect it would work if the
caller exported the symbols before calling the proc, but the idea of
procs is to hide that sort of detail.
Does anyone know of a neater way to do this (using JCL only)? Is there
any way to avoid the need for the triple apostrophes?
I'm also interested to know if I am breaking any JCL rules that might be
tightened up later.
--
Andrew Rowley
Black Hill Software
+61 3 5331 8201
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN