View previous topic :: View next topic
|
Author |
Message |
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
gcicchet wrote: |
Hi,
You cannot use symbolic parameters in instream data
Gerry |
Thanks for your reply.
What if I need to passing symbolic parameters into a program that accesses DB2? Can you please advise? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, goodness me, they have updated the manual. Robert's quote is from the Enterprise Cobol Version 5 Release 1 Programming Guide, which has been available for about three weeks.
Not only have they updated the manual, but they've included an example which is basically how I code it rather than using "reference-modification" :-)
There we go. And you don't have to wait for V5.1 to use it. It would work from OS/VS COBOL onwards, and it is not the COBOL that provides the limit, it is when OS appeared (and they decided to allow a PARM in the JCL). The ODO for a variable-length field worked in 1964 at least, the earliest I can track it down to through documentation... |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
One way to do it is to not use the PARM directly. Have a new, not very big, program which takes the PARM and writes it to a file. Read that file in your DB2 program, instead of trying to use the PARM.
You could also look to "generate" the Control Cards to execute your program, allowing for the symbol-substitution to take place and then be included in the generated cards.
You may also want to investigate the Language Environment route, from the piece which Robert posted. I'm not sure what "TSO" is going to do with options it doesn't recognise.
It is not, at any current release of z/OS, going to work how you have coded it. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
you can try this
Code: |
// SET PAR='ABC'
//SORT0001 EXEC PGM=SORT,
// PARM='JP1"&PAR",LIST'
//SORTOUT DD DSN=&&PARMS,
// DISP=(,PASS,DELETE),
// UNIT=SYSDA,
// SPACE=(TRK,(1))
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=OUT,REMOVECC,NODETAIL,
HEADER1=(' PARMS(',X'7D',JP1,C',0004',X'7D',C')')
//SORTIN DD *
/*
//RUNPRG EXEC PGM=IKJEFT01,DYNAMNBR=20
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(DB11)
RUN PROGRAM(TST00000) PLAN(TESTPLAN) -
// DD DSN=&&PARMS,
// DISP=(OLD,DELETE)
//SYSPRINT DD SYSOUT=*
|
Gerry |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
And you can easily adapt Gerry's example to write the parameter to a file.
You can "maximise" the potential length of the parameter, but if you need more than 69/71 characters, you'll need to find out how to divide-and-continue the parameter. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Thanks Robert and Thanks Bill for confirming that it is a new bit of writing! |
|
Back to top |
|
|
|