I don't run COMMANDS via jcl but I know you can, IEKJ* is think will do it. But I don't have access to a mainframe now. So I'm assuming that's what you're trying to do. The only method I've seen used to solve this type of problem is to use a program in an earlier step to replace the variable with it's value and use that program's output as the control card.
I've seen two methods used to solve this problem.
1. Use a different control card for each scenario. I hate this solution but see it quite often in production environments.
2. Use something like REXX or CLIST to make the substitution. This is a better solution in my opinion. But the implementations I've seen using this method haven't been general enough and for some reason the shops I've worked in usually have some extra restrictions on REXX and CLIST that tended to make them less desirable as a solution for some projects.
3. To solve this problem, many moons ago I created a simple COBOL program to make the substitution. Haven't had one problem using this method. It takes the name of the 'control card/deck', and a parameter that consistes of the string replacement information as input and puts out the new control card as output which is then used in the step that needs it. This process does have the drawback of needing an extra step in your jcl but that's not too bad.
The good thing about this method is people who don't know much about the mainframe can use it.
If there is interest, I can provide the COBOL source I use for this or answer any questions.
Here is what the jcl might look like:
Code:
//**********************************************************
//* THIS STEP READS IN A CONTROL CARD TEMPLATE THAT HAS TEXT //* THAT NEEDS TO BE REPLACED WITH VALUES OF SYMBOLIC
//* PARAMETERS. THE OUTPUT IS THE CONTROL CARD WITH VALUES
//* REPLACED.
//*
//* IN THE PARM BELOW:
//*
//* , = THE DELIMITER USED IN THE PARM ITSELF. IN THIS CASE ','
//* WILL BE USED TO SEPARATE ITEMS IN THE PARM.
//*
//* STRING1 = A STRING IN THE CONTROL CARD THAT YOU WANT TO
//* REPLACE
//*
//* VAR1 = IS THE SYMBOLIC PARAMATER YOU WANT TO USE TO
//* REPLACE STRING1. IT'S INCLOSED IN '&' AND '.' SO THE
//* VALUE OF THE SYMBOLIC PARAMETER IS USED.
//* WITHOUT THOSE, 'VAR1' WOULD BE USED.
//*
//* STRING2 = ANOTHER STRING IN THE CONTROL CARD THAT YOU
//* WANT TO REPLACE
//*
//* VAR1 = IS THE SYMBOLIC PARAMATER YOU WANT TO USE TO
//* REPLACE STRING1. IT'S INCLOSED IN '&' AND '.' SO THE
//* VALUE OF THE SYMBOLIC PARAMETER IS USED.
//* WITHOUT THOSE, 'VAR1' WOULD BE USED.
//**********************************************************************
//JAS02A EXEC PGM=JAS02,REGION=6M,
// PARM=(',STRING1,&VAR1.,STRING2,&VAR2.')
//STEPLIB DD DISP=SHR,
// DSN=WHATEVER.MAKES.SENSE.FOR.YOUR.SHOP
// DD DISP=SHR,DSN=CEE.SCEERUN
//SYSOUT DD SYSOUT=*
//IN01 DD DISP=SHR,DSN=INPUT.CONTROL.CARD
//OUT01 DD DISP=(NEW,PASS,DELETE),
// DSN=&&JAS02AO,
// SPACE=(80,(100),RLSE),LRECL=80,RECFM=FB
//**********************************************************************