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

JCL for DSN1COPY with fastswap


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Thu Sep 24, 2009 4:27 am
Reply with quote

JCL is not really my strong point, so just asking for the best/cleanest way.


the problem : We use DSN1COPY to copy tablespaces from 1 DB2 to another (DB2D to DB2X).
currently this is rather straigthforward :
DSN=DB2D.DSNDBD.dbname.tsname.I001.A001
to
DSN=DB2X.DSNDBD.dbname.tsname.I001.A001

but since DB2 V8 (optional) and DB2 V9 (mandatory)
a tablespace VSAM can be :
DB2D.DSNDBD.dbname.tsname.I001.A001
or
DB2D.DSNDBD.dbname.tsname.J001.A001
(because of online reorg, based on a column in the catalog)

Sorry don't have the source of the JCL at hand (maybe tomorrow) but this is what it does (current)

STEP10 a cobol program retrieving DBIDs,OBIDs out of the DB2 catalog and generating a parmfile for DSN1COPY in STEP20

STEP20 DSN1COPY with hardcoded
//in DD DSN=DB2D.DSNDBD.dbname.tsname.I001.A001,disp=shr
//out DD DSN=DB2X.DSNDBD.dbname.tsname.I001.A001,disp=shr

But now this probably will fail because DB2D I001 could not exists or DB2X I001 could not exists

AFAIK there is no way of changing a DSNname at runtime
Solution 1
I was thinking about having 6 steps
step 18 LISTCAT for DB2D.DSNDBD.dbname.tsname.I* (which would set condition code 8? when not found)
step 19 LISTCAT for DB2X.DSNDBD.dbname.tsname.I* (which would set condition code 8 ?when not found)

STEP21 I001 to I001 if STEP18.CC = 0 and STEP19.CC = 0
STEP23 I001 to J001 if STEP18.CC = 0 and STEP19.CC > 0
STEP25 J001 to I001 if STEP18.CC > 0 and STEP19.CC = 0
STEP27 J001 to J001 if STEP18.CC > 0 and STEP19.CC > 0

But I'm not really happy about it (having 4 almost identical steps)

Solution 2
let step10 also determine how the files are called (it's in the db2 catalog)
generate inputparms for idcams in step18 and step30 (see below)

step18 : an IDCAMS that does a rename if the filename contains J001 to I001 (one for each DB2)

step20 do the old DSN1COPY I001 to I001

step30 do another idcams rename of the filename to J001 if it was originally J001

But again : I'm not really happy about it.

So the Questions :
1) Is there a better way ?
2) Do you have same problem and how have you solved it ?
3) if not a better way : which of the two given solutions would you choose.

Sorry if I took some shortcuts in the explanation or used wrong terminology or don't have the actual JCL.
But I would appreciate any advice
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Thu Sep 24, 2009 1:04 pm
Reply with quote

Hi GuyC,
How about the following?

Let step10 also determine how the files are called (as it's in the db2 catalog) then generate the full job for DSN1COPY in the same program and submit it through INTRDR.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Thu Sep 24, 2009 1:08 pm
Reply with quote

yeah, but they are not crazy about using intrdr at this site.
Back to top
View user's profile Send private message
Alex Bruzzone

New User


Joined: 18 Aug 2010
Posts: 4
Location: Ottawa

PostPosted: Sat Feb 12, 2011 8:21 pm
Reply with quote

The best solution is to have an automated process for creating JCL for DSN1COPY. DSN1COPY JCL is fairly simple but one pays hard for mistakes in the JCL. For instance any erroneous DB2 ID numbers will not be caught when DSN1COPY runs, but only after when DB2 opens the Tablespaces VSAM datasets.

We have hundreds of DB2 Databases with hundreds of Tablespaces so I developed a utility that can be used to generate DSN1COPY JCL to move data. This utility pulls together all the internal DB2 IDs from both Source and Target databases as well as all the other relevant DB2 Catalog information such as the "I" and the "J" that GuyC is referring to.

The utility, which is written in COBOL, is excellent. In a matter of seconds anyone can generate flawless DSN1COPY JCL to copy data amongst databases.

This utility runs in Batch. It needs

(1) Source database name
(2) Target database name
(3) Date of the backup (COPY) to be used as input to DSN1COPY

Then, just SUBMIT and in seconds you have hundreds of perfect JCL. It's hard to imagine not having this utility and having to code all JCL by hand.

One of the greatest advantages of generating JCL is that JCL becomes dynamic and new Steps can easily be added to the JCL by simply changing the Skeleton (No, I don't use ISPF File Tailoring Services).
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts DSN1COPY Error DB2 1
No new posts DSN1copy - vsam put error DB2 3
Search our Forums:

Back to Top