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

JCL to Replace a mem of a PDS1 with another member of PDS2


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

New User


Joined: 12 Jun 2010
Posts: 31
Location: India

PostPosted: Wed Sep 01, 2010 4:20 pm
Reply with quote

Is it possible to Replace a mem of a PDS1 with another member of PDS2 with the same name?If yes , then by using which utility?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Wed Sep 01, 2010 4:21 pm
Reply with quote

IEBCOPY, IEBGENER, and it is all documented in the utilities manual.

Click the button "IBM Manuals" found at the top of almost every page, and have a good peruse.
Back to top
View user's profile Send private message
ankoo

New User


Joined: 12 Jun 2010
Posts: 31
Location: India

PostPosted: Wed Sep 01, 2010 4:58 pm
Reply with quote

I have understood that it can be done, also it is written that we have to use the replace (R) option on an INDD or COPY statement. but no example is provided. Can anyone please provide an example how to use R option on COPY statement.........
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Sep 01, 2010 5:03 pm
Reply with quote

Code:
COPY OUTDD=SYSUT2,INDD=((SYSUT1,R))
SYSUT1 and SYSUT2 can be any names you wish to use -- as long as the JCL matches.

Why are you not looking such a simple thing up in the manual yourself? The manual can be reached on the manuals link at the top of this page.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Wed Sep 01, 2010 5:07 pm
Reply with quote

Ah, Robert, the OP has categorically stated that no example exists. However, I like yourself had obviously at some time in the past read the manual thoroughly and adopted that fast dying technique

TRIAL AND ERROR

TBH, not sure if I could have worked it out myself from here though icon_rolleyes.gif
Quote:
INDD=[(]{DDname|(DDname,R)}[,...][)]
specifies the names of DD statements that locate the input data sets.
When an INDD= appears in a record by itself (that is, not with a COPY keyword), it functions as a control statement and begins a new step in the current COPY operation.

These values can be coded:


DDname
the ddname of the DD statement for the input data set. For an unload operation, only one ddname should be specified per COPY statement. If more than one ddname is specified for a copy or load operation, the input data sets are processed in the same sequence as the ddnames are specified.

R
specifies that all members to be copied or loaded from this input data set are to replace any identically named members on the output partitioned data set. (In addition, members whose names are not on the output data set are copied or loaded as usual.) When this option is specified, the ddname and the R parameter must be enclosed in a set of parentheses; if it is specified with the first ddname in INDD, the entire field, exclusive of the INDD parameter, must be enclosed in a second set of parentheses.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Wed Sep 01, 2010 5:18 pm
Reply with quote

Quote:
... but no example is provided. ...

have You been to see ophthalmologist lately, would be wise to do so as quickly as possible icon_biggrin.gif

here is the link to the page of the manual listing all the examples provided

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DGT2U130/3.6?SHELF=DGT2BK71&DT=20060626223348

and here the link to

Example 3: Copy and Replace Selected Members of a Data Set
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DGT2U130/3.6.3?SHELF=DGT2BK71&DT=20060626223348&CASE=
Back to top
View user's profile Send private message
ankoo

New User


Joined: 12 Jun 2010
Posts: 31
Location: India

PostPosted: Wed Sep 01, 2010 7:44 pm
Reply with quote

I the second link provided above an example is given in which select member is having two commas " SELECT MEMBER=((B,,R),A) ) " inside, I am copyng the JCL below.Please let me know if anyone got to know.......


//COPY JOB ...
//JOBSTEP EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=A
//OUT1 DD DSNAME=DATASET1,UNIT=disk,VOL=SER=111112,
// DISP=(OLD,KEEP)
//IN6 DD DSNAME=DATASET6,UNIT=disk,VOL=SER=111115,
// DISP=OLD
//IN5 DD DSNAME=DATASET5,UNIT=disk,VOL=SER=111116,
// DISP=(OLD,KEEP)
//SYSUT3 DD UNIT=SYSDA,SPACE=(TRK,(1))
//SYSUT4 DD UNIT=SYSDA,SPACE=(TRK,(1))
//SYSIN DD *
COPYOPER COPY OUTDD=OUT1
INDD=IN5,IN6
SELECT MEMBER=((B,,R),A)
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Wed Sep 01, 2010 7:50 pm
Reply with quote

Show us the JCL and control statements that you have created and let us know where you are getting problems, posting output to show these errors.
Back to top
View user's profile Send private message
ankoo

New User


Joined: 12 Jun 2010
Posts: 31
Location: India

PostPosted: Wed Sep 01, 2010 7:52 pm
Reply with quote

Following is the JCL I am using

//IEBCPY1 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//DD1 DD DISP=SHR,DSN=PWSX.R9SSHC6.MYALLOC8
//*THIS JOB REPLACES THE MEMBER CONTENTS OF OUTPUT FILE WITH
//*THE MEMBER CONTENTS OF INPUT FILE
//DD2 DD DSN=PWSX.R9SSHC6.EDT235,DISP=MOD
//* DISP=(NEW,CATLG,DELETE),
//* DCB=(RECFM=FB,LRECL=200,BLKSIZE=26000,DSORG=PO)
//SYSIN DD *
COPY INDD=DD1,OUTDD=DD2
SELECT MEMBER=((JCL,R))
//* COPY INDD=((DD1,R)),OUTDD=DD2
//* SELECT MEMBER=((B,,R),A)
/*
//
Back to top
View user's profile Send private message
ankoo

New User


Joined: 12 Jun 2010
Posts: 31
Location: India

PostPosted: Wed Sep 01, 2010 7:54 pm
Reply with quote

Following is the error I am getting in spool
IEBCOPY MESSAGES AND CONTROL STATEMENTS
IEBCOPY FMID HDZ1A10 SERVICE LEVEL UA46465 DATED 20090319 DFSMS 01.1
R9SSHC6G IEBCPY1 08:58:49 WED 01 SEP 2010 PARM=''
COPY INDD=DD1,OUTDD=DD2
SELECT MEMBER=(JCL,R)
COPYING FROM PDS INDD=DD1 VOL=CPX956 DSN=PWSX.R9SSHC6.MYALLOC8
TO PDS OUTDD=DD2 VOL=CPX940 DSN=PWSX.R9SSHC6.EDT235
NO MEMBERS COPIED FROM INPUT DATA SET REFERENCED BY DD1
R WAS SELECTED BUT NOT FOUND IN ANY INPUT DATA SET
THERE ARE 0 UNUSED TRACKS IN OUTPUT DATA SET REFERENCED BY DD2
JOB HAS TERMINATED WITH ERROR(S)
END OF JOB - 4 WAS HIGHEST SEVERITY CODE
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Wed Sep 01, 2010 8:02 pm
Reply with quote

Take a look at the syntax given to you by Robert.
Then use a simple SELECT MEMBER= card like
Code:
 SELECT MEMBER=name


or use the format of SELECT card that you are currently using, BUT, read the manual very carefully regarding syntax when using REPLACE on a SELECT statement.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Sep 01, 2010 8:16 pm
Reply with quote

There are none so blind as those who WILL NOT see (or read posts and ignore what is posted).
Back to top
View user's profile Send private message
ankoo

New User


Joined: 12 Jun 2010
Posts: 31
Location: India

PostPosted: Wed Sep 01, 2010 8:27 pm
Reply with quote

Ok now I know what it does and how to do it
Actually "SELECT MEMBER=((INPUT,JCL,R))" select statement will copy the contents of INPUT member of PDS1 and put in the member JCL of PDS2, even if the JCL is already present in PDS2, it will just overrite the contents of the member JCL, and if a new member name is given example JCL2(in second parameter of select statement) then it will create a new member JCL1 and put contents of INPUT to the JCL1.......
Thanks guys :-)
Back to top
View user's profile Send private message
ankoo

New User


Joined: 12 Jun 2010
Posts: 31
Location: India

PostPosted: Wed Sep 01, 2010 8:35 pm
Reply with quote

Another think which I would like to add here is that if we write
"SELECT MEMBER=((JCL,JCL,R))" statement it will give MAXCC=4 and the updated member JCL (first parameter in select) form input PDS will not be copied to output JCL member of PDS2
Any idea how to do it will be greatly appreciated......
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Sep 02, 2010 5:06 am
Reply with quote

Hi,

the correct syntax for copying and replacing an existing member using your code is
Code:
SELECT MEMBER=((JCL,,R))


Also the other issue you are having is you cannot use MOD for a PDS.


Gerry
Back to top
View user's profile Send private message
ankoo

New User


Joined: 12 Jun 2010
Posts: 31
Location: India

PostPosted: Thu Sep 02, 2010 9:59 am
Reply with quote

If i write the above select statement then the JCL member form PDS1 will be copied to the R member in PDS2, what actually I want is that yhe JCL member from PDS1 should be copied to JCL member in PDS2.....
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Sep 02, 2010 10:44 am
Reply with quote

Hi,

did you try the code I provided ?


Gerry
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Thu Sep 02, 2010 11:24 am
Reply with quote

ankoo wrote:
If i write the above select statement then the JCL member form PDS1 will be copied to the R member in PDS2, what actually I want is that yhe JCL member from PDS1 should be copied to JCL member in PDS2.....

Please explain the rationale behind this comment.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Thu Sep 02, 2010 7:30 pm
Reply with quote

Hello,

Quote:
Please explain the rationale behind this comment.
I believe that all this says is that when an incorrect control statement is submitted, incorrct results occur. . .
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 Using Multiple IFTHEN and WHEN condit... SYNCSORT 12
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
No new posts How to copy the -1 version of a membe... TSO/ISPF 4
Search our Forums:

Back to Top