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

Utility to copy 1 file to N files.


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

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Thu Feb 23, 2006 7:52 pm
Reply with quote

Hi guys,


I have a problem. I want to copy a flat file to multiple files using some JCL utility. I want to do this using single JCL STEP. Does anyone know any such utility?


Also, one more question related to this.

Say my JCL looks like this:

//STEP1 EXEC PGM=COBPRO
//INFILE DD DSN=<infile>
//OUTFILE DD DSN=<outfile1>
//OUTFILE DD DSN=<outfile2>

with multiple OUTPUT files with same ddname. And my program has FILE-CONTROL entry as shown below:

FILE-CONTROL.

SELECT COB-INFILE ASSIGN TO INFILE.
SELECT COB-OUTFILE ASSIGN TO OUTFILE.

Will I get compilation error? NO.
Will I get JCL error? I don?t know.
Will I get RUNTIME ABEND? I don?t know.
Or will program will write at the same time to both the output files.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Feb 23, 2006 8:40 pm
Reply with quote

Hi umeshkmrsh

Quote:

I have a problem. I want to copy a flat file to multiple files using some JCL utility. I want to do this using single JCL STEP. Does anyone know any such utility?


There are a lot of utilities that you can use. I like to use IDCAMS for this type of copy. I'm sure you will hear from others with different solutions.


Code:

//JS00100  EXEC PGM=IDCAMS                         
//INDD1    DD DSN=         
//SYSPRINT DD SYSOUT=*                             
//OUTDD1   DD DSN=OUTPUT.DATASET1
//OUTDD2   DD DSN=OUTPUT.DATASET2
//SYSIN    DD *                                     
 REPRO INFILE(INDD1) OUTFILE(OUTDD1)               
 REPRO INFILE(INDD1) OUTFILE(OUTDD2)               
/*     


Quote:

Also, one more question related to this.

Say my JCL looks like this:

//STEP1 EXEC PGM=COBPRO
//INFILE DD DSN=
//OUTFILE DD DSN=<outfile1>
//OUTFILE DD DSN=<outfile2>

with multiple OUTPUT files with same ddname. And my program has FILE-CONTROL entry as shown below:

FILE-CONTROL.

SELECT COB-INFILE ASSIGN TO INFILE.
SELECT COB-OUTFILE ASSIGN TO OUTFILE.


Quote:

Will I get JCL error? I don?t know.


A. You will not jet a JCL error with this

Quote:

Will I get RUNTIME ABEND? I don?t know.


A. You will not get a RUNTIME ABEND

Quote:

Or will program will write at the same time to both the output files.


A. You program will write to the file defined in the FIRST //OUTFILE DD. The second will be ignored at execution time

Dave,
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 Feb 23, 2006 10:07 pm
Reply with quote

Quote:
I have a problem. I want to copy a flat file to multiple files using some JCL utility. I want to do this using single JCL STEP. Does anyone know any such utility?


You can do this in one pass with DFSORT (as opposed to multiple passes with IDCAMS). For example:

Code:

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


You can also do this in one pass with DFSORT's iCETOOL as follows:

Code:

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

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Fri Feb 24, 2006 11:59 am
Reply with quote

Thank's Davidat and Frank for your for helping me out.
Back to top
View user's profile Send private message
ranga_subham

New User


Joined: 01 Jul 2005
Posts: 51

PostPosted: Wed Mar 08, 2006 8:24 pm
Reply with quote

Hi,

Can anybody let me know how to achieve it using the SYNCSORT as we don't have DFSORT at our shop.

Thanks for your time.
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 290
Location: Basel, Switzerland

PostPosted: Fri Mar 10, 2006 7:07 pm
Reply with quote

hy ranga,

use IDCAMS it is one of the most common IBM
utilities on a mainframe and always supplied with
any installation.

to know IDCAMS is a must for all mainframers.

martin9
Back to top
View user's profile Send private message
Ayyappan

New User


Joined: 05 Jul 2005
Posts: 31
Location: India

PostPosted: Fri Mar 10, 2006 7:27 pm
Reply with quote

Hi Ranga,

You can use the following JCL to copy a single file to multiple files.

Code:

//STEP010   EXEC  PGM=SORT                       
//SORTIN   DD  DSN=&HLQ..T21412.UNWAY.DETAIL,     
//             DISP=SHR                           
//SORTOF01 DD  DSN=&HLQ..T21412.UNWAY.TEST1,     
//             DISP=(,CATLG,DELETE),             
//             UNIT=SYSDA,SPACE=(CYL,(25,5),RLSE),
//             DCB=(*.SORTIN)                     
//SORTOF02 DD  DSN=&HLQ..T21412.UNWAY.TEST2,     
//             DISP=(,CATLG,DELETE),             
//             UNIT=SYSDA,SPACE=(CYL,(25,5),RLSE),
//             DCB=(*.SORTIN)                     
//SYSUDUMP DD SYSOUT=D                           
//SYSOUT   DD SYSOUT=*                           
//SYSPRINT DD SYSOUT=*                           
//SYSLIST  DD SYSOUT=*                           
//SYSTOTAL DD SYSOUT=*                           
//SYSIN    DD  *                                 
  SORT FIELDS=COPY                               
  OUTFIL FILES=(01,02)                           
/*                                               


Thanks.
Ayyappan
Back to top
View user's profile Send private message
Thiruppathi

New User


Joined: 12 Mar 2006
Posts: 2
Location: memphis,TN, USA

PostPosted: Sun Mar 12, 2006 7:07 pm
Reply with quote

umeshkmrsh wrote:
Hi guys,


I have a problem. I want to copy a flat file to multiple files using some JCL utility. I want to do this using single JCL STEP. Does anyone know any such utility?


Also, one more question related to this.

Say my JCL looks like this:

//STEP1 EXEC PGM=COBPRO
//INFILE DD DSN=<infile>
//OUTFILE DD DSN=<outfile1>
//OUTFILE DD DSN=<outfile2>

with multiple OUTPUT files with same ddname. And my program has FILE-CONTROL entry as shown below:

FILE-CONTROL.

SELECT COB-INFILE ASSIGN TO INFILE.
SELECT COB-OUTFILE ASSIGN TO OUTFILE.

Will I get compilation error? NO.
Will I get JCL error? I don?t know.
Will I get RUNTIME ABEND? I don?t know.
Or will program will write at the same time to both the output files.


[color=blue]Answer for your query

1.For copying single input to multilple output you can use SORT utility
2. when use 2 dd name as a same you won't get any compilation errors but you should get JCl errors
[/color]
Back to top
View user's profile Send private message
ranga_subham

New User


Joined: 01 Jul 2005
Posts: 51

PostPosted: Sat Mar 18, 2006 10:08 am
Reply with quote

Thanks a lot Ayyappan.
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top