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
cvrupesh
Posts: 20
Joined: Tue Jun 02, 2009 9:59 am
Skillset: JCL and COBOL Beginner
Referer: My Self
Location: Bangalore
Contact:

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.

Robert Sample
Global moderator
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
Referer: other forum
Location: Dubuque, Iowa, USA

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.

NicC
Global moderator
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
Referer: Google
Location: Pushing up the daisies (almost)

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

cvrupesh
Posts: 20
Joined: Tue Jun 02, 2009 9:59 am
Skillset: JCL and COBOL Beginner
Referer: My Self
Location: Bangalore
Contact:

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.

ritikasingh
Posts: 39
Joined: Wed Sep 01, 2010 9:12 pm
Skillset: Operating Systems: MVS
Environment: Mainframe, Windows
Databases: VSAM, DB2 Tables
Programming Languages: COBOL, JCL,TSO/ISPF, CICS, DB2 (SQL),
Software Tools: File-AID, Endeavor, SORT, ICETOOL, SNDM, HP Quality Center,
OPC, DRMS,IDCAMS, SMARTIS, VISIO, Vision plus, HP(Service Manager),TSO,ISPF
Referer: google

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..

Robert Sample
Global moderator
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
Referer: other forum
Location: Dubuque, Iowa, USA

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.


  • Similar Topics
    Replies
    Views
    Last post