View previous topic :: View next topic
|
Author |
Message |
calcop69
New User
Joined: 23 Jun 2022 Posts: 14 Location: Italy
|
|
|
|
Hi, i'd like to set my variable VAR1
Code: |
// EXEC PROC=MYPRC,REGION=0M,
// VAR1='MYVARIABLE' |
with the content of my file
Code: |
EDIT AM45.MY.VARIABLE
Command ===>
=COLS> ----+----1----+----2----+----3----+----4
****** ***************************** Top of Data ****
000001 ABCDEFGHIJKLMNOPQ
****** **************************** Bottom of Data ** |
Do You know if it's possible to obtain VAR1=ABCDEFGHIJKLMNOPQ ?
Thanks |
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1353 Location: Bamberg, Germany
|
|
|
|
Guess it is possible. Show the intended flow, please. |
|
Back to top |
|
 |
calcop69
New User
Joined: 23 Jun 2022 Posts: 14 Location: Italy
|
|
|
|
Sorry for my poor english...the scope is to obtain 1 JCL able to write the output data set with a variable name
1.JCL SQL step to obtain a column value from a specific DB2 table. This value is the desidered data set name (Done)
2.Assign to VAR1 the data set content created at step 1(To do)
3.REPRO or SORT step using VAR1 as name of the output data set (Done)
I hope I explained myself |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2159 Location: USA
|
|
|
|
calcop69 wrote: |
2.Assign to VAR1 the data set content created at step 1(To do) |
Any JCL SET-variable is resolved before the JCL is submitted for execution.
During the execution phase there is no way to set, or to change any previously defined SET-variable.
You cannot replace the ignition plugs while driving your car!
But it is possible (in many different ways) to convert the output of your Step 1 to the input control statements REPRO for IDCAMS utility in your Step 3.
If only you provided with details: what and how you have done for your Step 1, and Step 3, some volunteers would help you in doing this.
Such trick doesn't work for most other utilities, including SORT. They require DSNAMEs to be defined by JCL DD statement, which is not possible with your design.
BTW, the CA7 product is not related in any manner to this issue. |
|
Back to top |
|
 |
calcop69
New User
Joined: 23 Jun 2022 Posts: 14 Location: Italy
|
|
|
|
This is the table
Code: |
TABLE PR01.TAB_DSN
JCL DSNAME
£1 £2
CH(8) CHARACTER(40)
<---+--> <---+----1----+----2----+----3----+---->
000001 JTB01 PR31.TS000.LIST01 |
With STEP01 put the value 'PR31.TS000.LIST01' into the file PR31.TS000.SYSREC
Code: |
//STEP01 EXEC DB20TAUL,DB2=DBAP,CEN=X,CENN=Y,
// UID=JTB01,SQL=YES
//P2.SYSREC00 DD DSN=PR31.TS000.SYSREC,
// DISP=(,CATLG,DELETE),
// SPACE=(TRK,(1,1))
//P2.SYSPUNCH DD DUMMY
//*
//P2.SYSIN DD *
SELECT DSNAME FROM PR01.TAB_DSN WHERE JCL='JTB01';
/* |
Then i'd like to copy a file with name 'PR31.TS000.MYFILE' into a new file with name 'PR31.TS000.LIST01' (or any other value stored in the column DSNAME of the table PR01.TAB_DSN)
Code: |
//STEP0201 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=F
//*
//IN DD DSN=PR31.TS000.MYFILE,DISP=SHR
//*
//* The OUT DSN should be the content of the PR31.TS000.SYSREC:
//OUT DD DSN=PR31.TS000.LIST01,
// DISP=(,CATLG,DELETE),SPACE=(CYL,(100,100)),
// DCB=*.IN
//SYSIN DD *
REPRO INFILE(IN) OUTFILE(OUT)
//* |
|
|
Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
As long as your STEP0201 does NOT execute in the same job as your STEP01 you can do that. It cannot be done in a single job, though, since JES runs your JCL through its converter / interpreter (CI) as soon as the job is submitted. And once the job has been through the CI, you cannot make any changes to the JCL -- period. Hence what you want to do CANNOT be done in a single job the way you've described it. |
|
Back to top |
|
 |
calcop69
New User
Joined: 23 Jun 2022 Posts: 14 Location: Italy
|
|
|
|
Ok, I'll make a second job for the STEP0201.
Can You please explain me how to assign to the OUT DSN the name contained in the file PR31.TS000.SYSREC? |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2159 Location: USA
|
|
|
|
calcop69 wrote: |
Ok, I'll make a second job for the STEP0201.
Can You please explain me how to assign to the OUT DSN the name contained in the file PR31.TS000.SYSREC? |
First of all, read the IDCAMS manual once again, and find out for yourself: how to avoid using INFILE(ddname) or OUTFILE(ddname), and use instead INDATASET(dsname) or OUTDATASET(dsname). This would eliminate the requirement to code your dataset name(s) at JCL level, but use control statements under //SYSIN DD for IDCAMS step.
And no need for the second job! |
|
Back to top |
|
 |
|