On Wed, 26 Apr 2017 05:07:39 -0700, Charles Mills wrote: >Move the EXPORT outside of the PROC and into the open JOB? > Is a SET within a PROC elaborated when the PROC is defined or when it is executed?
What is the scope of a symbol SET within a PROC? Is an EXPORT within a PROC elaborated when the PROC is defined or when it is executed? Can a formal parameter of a PROC be EXPORTed? Does a set override a formal parameter? Or vice-versa? Does the listing of the expanded JCL make this clearer? Does the JCL Ref. make all this clear? JCL sorely needs HLASM's DOUBLE Bif to avoid the apostrophe catastrophe. Or perhaps CLIST's &STR. Or Rexx's convention for substituting symbols. This has long been a solved problem. Why did the JCL designers feel compelled to reintroduce it? I hate JCL! >-----Original Message----- >From: Andrew Rowley >Sent: Tuesday, April 25, 2017 10:14 PM > >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? > Only triple? You're lucky! And there's no solution you need to use the symbol containing the apostrophe both in open code and as an argument to a PROC. -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
