Copying data back and forth between VSAM and Flat files



Help for IBM's record-oriented filesystem VSAM, ESDS, KSDS, RRDS, LDS and Storage management Subsystems

Copying data back and forth between VSAM and Flat files

Postby cvrupesh » Tue Oct 05, 2010 5:10 pm

Hi All,

I was going through some of the JCL's which include VSAM's in their processing.
I have come across similar situation in many JCL's that 2 similar steps are present one after another when ever VSAM is involved.

The first step looks like copying data from VSAM file to a Flat file and the very next step is copying back data from Flat file to VSAM file.
Can some one throw some light if there any significance behind this?

I can see from comments that Step1 is called Securing(Backup) VSAM file by copying contents to Flat file and Step2 Restoring(Reload) where data is copied from Flat file back to VSAM.
Thanks Always,
-Rupesh.
cvrupesh
 
Posts: 20
Joined: Tue Jun 02, 2009 9:59 am
Location: Bangalore
Has thanked: 0 time
Been thanked: 0 time

Re: Copying data back and forth between VSAM and Flat files

 

Re: Copying data back and forth between VSAM and Flat files

Postby Robert Sample » Tue Oct 05, 2010 6:45 pm

If the VSAM file is indexed (KSDS), inserting records can cause splits of the controlinterval and possibly even the controlarea. This can cause inefficient access and excess used space. Unloading the VSAM file, redefining it, and reloading the VSAM file is the only way to recover the space.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: Copying data back and forth between VSAM and Flat files

Postby NicC » Tue Oct 05, 2010 7:08 pm

Also, by reading the backup right away you are ensuring its quality.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: Copying data back and forth between VSAM and Flat files

Postby cvrupesh » Tue Oct 05, 2010 7:11 pm

Exactly, I got the same answer from a System Programmer here also couple of minutes ago that this process will remove CI and CA splits which improves the structure of the index.

One more point he added here is, some programmers code in this way to make the Restart mechanism easy in case of failures.
Thanks Always,
-Rupesh.
cvrupesh
 
Posts: 20
Joined: Tue Jun 02, 2009 9:59 am
Location: Bangalore
Has thanked: 0 time
Been thanked: 0 time

Re: Copying data back and forth between VSAM and Flat files

Postby ritikasingh » Tue Oct 05, 2010 8:19 pm

Hi when any processing happens for VSAM file.
you will always see these steps ALWAYS :

Step1: Taking backup in flat file.
Step 2: Sorting the file on the key(if not sorted this will cause and error)
Step3: Copy back(REPRO) the data from flat file to VSAM..
ritikasingh
 
Posts: 39
Joined: Wed Sep 01, 2010 9:12 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Copying data back and forth between VSAM and Flat files

Postby Robert Sample » Tue Oct 05, 2010 8:28 pm

ritikasingh, you are not correct. If there are no data changes, an IDCAMS REPRO to a sequential file will already be in key sequence, so there is absolutely no reason to run a sort before the loading back of the data into the VSAM file. There may be other processing going on that requires sorting the data but a straight unload / reload does not.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times


Return to VSAM/SMS

 


  • Related topics
    Replies
    Views
    Last post