IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Setting CA7 user variable from data set content


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
calcop69

New User


Joined: 23 Jun 2022
Posts: 14
Location: Italy

PostPosted: Fri Jul 01, 2022 3:04 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Active Member


Joined: 15 Aug 2015
Posts: 812
Location: Bamberg, Germany

PostPosted: Fri Jul 01, 2022 3:19 pm
Reply with quote

Guess it is possible. Show the intended flow, please.
Back to top
View user's profile Send private message
calcop69

New User


Joined: 23 Jun 2022
Posts: 14
Location: Italy

PostPosted: Fri Jul 01, 2022 3:59 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1533

PostPosted: Fri Jul 01, 2022 6:09 pm
Reply with quote

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
View user's profile Send private message
calcop69

New User


Joined: 23 Jun 2022
Posts: 14
Location: Italy

PostPosted: Fri Jul 01, 2022 9:05 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8633
Location: Dubuque, Iowa, USA

PostPosted: Fri Jul 01, 2022 9:36 pm
Reply with quote

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
View user's profile Send private message
calcop69

New User


Joined: 23 Jun 2022
Posts: 14
Location: Italy

PostPosted: Sat Jul 02, 2022 1:47 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1533

PostPosted: Mon Jul 04, 2022 1:37 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts RABBIT HOLE NEEDED - "Live"... All Other Mainframe Topics 0
No new posts pass data as symbolic parameter from ... CLIST & REXX 2
No new posts How to display the leading zeros of a... DB2 5
No new posts ICE218A 6 12 BYTE VARIABLE RECORD IS ... DFSORT/ICETOOL 14
No new posts Decompress data from JMR log file Compuware & Other Tools 4
Search our Forums:

Back to Top