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

How to COPY VSAM file to FLAT file


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

New User


Joined: 22 Mar 2005
Posts: 9

PostPosted: Wed Apr 06, 2005 2:21 pm
Reply with quote

hi,
How to copy a flat file or(non Vsam) to VSAM file
Back to top
View user's profile Send private message
Great Indian

New User


Joined: 05 Apr 2005
Posts: 9

PostPosted: Wed Apr 06, 2005 3:17 pm
Reply with quote

You can use IDCAMS REPRO command to load data from QSAM(PS) to VSAM file.

Here is the JCL for your reference.

Code:
//XDWCOPY JOB (0213),'IDCAMS',CLASS=0,MSGCLASS=Z,
//                       NOTIFY=&SYSUID
//IN1    DD  DSN=PBLT.TEST.PS1,DISP=SHR
//OUT1 DD  DSN=PGLT.TEST.KSDS,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD  SYSOUT=*
//SYSIN      DD  *
   REPRO INFILE(IN1) OUTFILE(OUT1)
/*
//


NOTE: make sure that duplicates should not be there in primary key....if duplicates exist loading will not be successful.
Back to top
View user's profile Send private message
callkris_cit

New User


Joined: 22 Apr 2006
Posts: 44

PostPosted: Thu May 25, 2006 8:37 pm
Reply with quote

Hi All,

I have the VSAM file. I want to copy that dataset to Flat file without specifying DCB parameter.

My requirements, Flat file should take the VSAM parameters, without specifying DCB parameter.

Please refer below code:

Code:
//STEP1  EXEC PGM=IDCAMS
//INDD   DD    DSN= Input VSAM file name, DISP=SHR
//OUTDD DD   DSN= Output Flat file name, DISP=(NEW,CATLG,DELETE),
//                   SPACE=(CYL,(2,2)),UNIT=3390
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
   REPRO INFILE(INDD) OUTFILE(OUTDD)
/*
Back to top
View user's profile Send private message
rajandhla

Active User


Joined: 18 Oct 2005
Posts: 182
Location: Luton UK

PostPosted: Thu May 25, 2006 9:09 pm
Reply with quote

Why can't you specify the DCB parameters for the flat file as VSAM file...............

but No idea about the command to copy the attributes of input file out file..........

regards
jai
Back to top
View user's profile Send private message
Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 463

PostPosted: Fri May 26, 2006 9:35 am
Reply with quote

Hi,

Quote:
I have the VSAM file. I want to copy that dataset to Flat file without specifying DCB parameter.


We can copy VSAM file into Flat file using IDCAMS utility, but in that we need to mention DCB parameter if file is new.

Hope this helps

Regards

Rupesh
Back to top
View user's profile Send private message
Pollyannaish

New User


Joined: 09 Jul 2005
Posts: 31
Location: Pune, India

PostPosted: Fri May 26, 2006 11:19 am
Reply with quote

Hi

it has been long since i have used this idea.. so not sure whether it will work or not but just give it a try..

DD DSN="new file name",DISP=(NEW,KEEP),
LIKE="a file name for which u want new file to be modelled "

i hope this helps.

if you have any problem let me know..
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat May 27, 2006 5:27 am
Reply with quote

I did something like that just today using SORT. But I had to use the DCB to specify that my OP was PS and our shop uses SMS so I didn't need to use SPACE either.

Code:
//s1 exec sort
//sortin dd dsn=vsam.file, disp=shr
//sortout dd dsn=flat.file,dip=(,catlg,delete),dcb=dsorg=ps
//sortin dd *
SORT FIELDS=COPY
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: Sat May 27, 2006 8:07 pm
Reply with quote

I'm not sure why you would need to use DSORG=PS. I would think that would be the default. Perhaps your site is overriding it somehow.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat May 27, 2006 8:48 pm
Reply with quote

I don't know, Frank. When I tried w/o dsorg I got an ESDS ds as OP.

I assumed that sort copied the IP attributes to the OP ds, but you may be right, the site may have overridden it.
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: Sun May 28, 2006 8:23 pm
Reply with quote

Quote:
I assumed that sort copied the IP attributes to the OP ds, but you may be right, the site may have overridden it.


DFSORT would not create a VSAM output data set automatically when it copies a VSAM input data set. A VSAM output data set has to be predefined, or defined via JCL parameters - DFSORT doesn't do that under the covers. I suspect your site has something set up (in the ACS routine, maybe) to define the output data set as an ESDS - that would happen before DFSORT uses it.
Back to top
View user's profile Send private message
callkris_cit

New User


Joined: 22 Apr 2006
Posts: 44

PostPosted: Tue May 30, 2006 3:32 pm
Reply with quote

Hi All,

Thanks for all your kind help.

My Requirement was, to Copy all the VSAM file to TAPE.

( Since we should not store the VSAM file directly in to TAPE, We need to convert this VSAM file as FLAT file)

Thats the reason i have asked this question.

Finally i have created a REXX tool, for Copying the VSAM file to Flat file without specifying the DCB parameters explicitly.

Thanks for your help. I am doing some correction in that. I will post that once the problem has been properly resolved.

Thanks
Suresh.
Back to top
View user's profile Send private message
gamarendra

New User


Joined: 12 May 2006
Posts: 13
Location: bangalore

PostPosted: Thu Jun 01, 2006 12:24 am
Reply with quote

Hi,
can't we use

// DCB=(*.VSAMIFile) ???
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 Jun 01, 2006 1:20 am
Reply with quote

Quote:
can't we use

// DCB=(*.VSAMIFile) ???


I wouldn't think so. A VSAM data set does NOT actually have DCB attributes (e.g. LRECL, BLKSIZE). VSAM data sets use an ACB, not a DCB, and have different attributes (e.g. RECSIZE, CISIZE).

When you copy a VSAM data set to a non-VSAM data set with DFSORT, it sets some of the non-VSAM data set's attributes based on the VSAM data set's attributes by default if appropriate, but it's not a one-to-one correspondence.

I'd be surprised if a referback of the DCB to a VSAM file would be accepted or meaningful. Anybody know different?
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 Unable to interpret a hex value to De... COBOL Programming 4
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts how to eliminate null indicator value... DB2 7
No new posts Use Copy Utility DB2 7
No new posts VSAM LISTCAT INFORMATION JCL & VSAM 2
Search our Forums:

Back to Top