I need copy some records from Master VSAM file to Test VSAM file based on Orig-date condition(Orig-date must be greater than or equal to 01-01-2007 (01-01-2007 is stored as 1070101 in the master file). Orig-date is declared as PIC S9(3) COMP-3.
For this I used the following method.
1. Defined TEST VSAM file using DEFINE CLUSTER
2. Copied the 30000 records from Master file using IDCAMS and REPRO into a Sequential file.
3. Used Sequential file as SORTIN file and sorted records based on condition into SORTOUT(TEST VSAM file). Used INCLUDE COND (1,11,PD,GE,10701).
Is there any other method to do the above procedure?. Please let me know.
(01-01-2007 is stored as 1070101 in the master file). Orig-date is declared as PIC S9(3) COMP-3.
Used INCLUDE COND (1,11,PD,GE,10701)
If you are going to do the include cond against a comp-3 field, and declare it as such, you have to give it the full field, i.e., INCLUDE COND (1,11,PD,GE,1070101)
Give that a try and let us know, good or bad, how it turns out.
I actually created the TEST file based on the condition and checked at the data in that file, it looked good. My question is, is there any other way to copy the VS AM file with condition?. Instead of using the sequential file, is there any way to copy from master file using that condition?. Any CL utilities available to copy vsam to vsam based on condition.
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
You could read the vsam file with Easytrieve or a little COBOL program and either create a flat file to load or write the new records into a new vsam file.
Does your site use DFSORT or Syncsort?
I seem to recall that with both sorts you can process vsam in and back out to a new vsam file. The DFSORT manual shows an example of vsam in and vsam out in a sort. I may be mistaken about Syncsort as i have no doc here for Syncsort. If you are interested and send a reply, i'll check tomorrow when i've all the doc available.