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

Copying a dataset into two datasets


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

New User


Joined: 04 Aug 2008
Posts: 6
Location: chennai

PostPosted: Thu Nov 13, 2008 12:22 pm
Reply with quote

Hi,

I want to copy a dataset into two different datasets which are created during copy.These should be done in single STEP.

I have used IEBGENER utility,But,It copied only one dataset,which i created first.

can anyone help me to find out?


Thanks,
Ponkala
Back to top
View user's profile Send private message
Amsar

New User


Joined: 26 Sep 2008
Posts: 84
Location: Chennai

PostPosted: Thu Nov 13, 2008 12:35 pm
Reply with quote

Ponkala,

You can do it through sort.

Code:
//XXXXXXXX JOB (QQQQ),'SORT JOB',CLASS=I,MSGCLASS=X,     
//         NOTIFY=&SYSUID,REGION=4096K                   
//STEP00   EXEC PGM=SORT                                 
//*                                                     
//SYSOUT   DD SYSOUT=*                                   
//SYSPRINT DD SYSOUT=*                                   
//SORTMSG  DD SYSOUT=*                                   
//*                                                     
//SORTIN   DD DSN=input---,DISP=SHR                     
//SORTOF01 DD DSN=output1---,DISP=SHR                   
//SORTOF02 DD DSN=output2----,DISP=SHR                   
//*                                                     
//SYSIN    DD *                                         
      SORT FIELDS=COPY                                   
      OUTFIL FILES=01                                   
      OUTFIL FILES=02                                   
                                                         
//*                                                     



Regards,
Amol
Back to top
View user's profile Send private message
ponkala

New User


Joined: 04 Aug 2008
Posts: 6
Location: chennai

PostPosted: Thu Nov 13, 2008 12:47 pm
Reply with quote

Thanks Amol,

I got the result. icon_lol.gif
Back to top
View user's profile Send private message
Amsar

New User


Joined: 26 Sep 2008
Posts: 84
Location: Chennai

PostPosted: Thu Nov 13, 2008 12:57 pm
Reply with quote

Glad to hear icon_smile.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Nov 13, 2008 1:16 pm
Reply with quote

Or
Code:

//SYSIN    DD    *     
  SORT FIELDS=COPY     
  OUTFIL FILES=(01,02)
/*                     
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Nov 13, 2008 1:40 pm
Reply with quote

Or even this icon_smile.gif
Code:
//SYSIN    DD    *     
  SORT FIELDS=COPY     
  OUTFIL FILES=01

SORTOUT will have a copy by default.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Nov 13, 2008 8:53 pm
Reply with quote

Keep in mind that SORT will usually outperform IEBGENER or IDCAMS for copying purposes anyway.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Nov 13, 2008 11:05 pm
Reply with quote

Not sure why people continue to use FILES=nn and SORTOFnn when sort products have had the FNAMES=ddname parameter available for a very long time. A more "modern" DFSORT job for this situation would be:

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN DD DSN=... input file
//OUT1 DD DSN=...  output file1
//OUT2 DD DSN=...  output file2
//SYSIN   DD   *
   OPTION COPY
   OUTFIL FNAMES=(OUT1,OUT2)
/*


You could also do it with DFSORT's ICETOOL like this:

Code:

//S2   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=... input file
//OUT1 DD DSN=...  output file1
//OUT2 DD DSN=...  output file2
//TOOLIN DD *
COPY FROM(IN) TO(OUT1,OUT2)
/*
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Nov 13, 2008 11:19 pm
Reply with quote

Quote:
Not sure why people continue to use FILES=nn and SORTOFnn when sort products have had the FNAMES=ddname parameter available for a very long time.
Frank,

Do we have any advantage by using FNAMES over FILES in DFSORT particularly for this case?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Nov 13, 2008 11:28 pm
Reply with quote

Just readability and ease of use. The full ddname is easier to use and understand than using a parameter with two characters of the ddname (FILES=01) and 'SORTOF' prepended to those two characters.

Note also that with FILES=dd, the use of the SORTDD=cccc parameter requires ccccOFdd (e.g. SORTDD=ABCD requires ABCDOF01 instead of SORTOF01), whereas FNAMES=ddname is NOT affected by SORTDD.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Nov 14, 2008 12:06 am
Reply with quote

Frank,

Thank you !!
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 FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
Search our Forums:

Back to Top