Copying selective records from VSAM to VSAM



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Copying selective records from VSAM to VSAM

Postby Farhaan4mf » Mon Nov 18, 2013 5:56 pm

Hi,
My shop is using FLASHCPY to take snap of entire VSAM file.
Now, My requirement is to perform a step that will copy selective records ( say from logical record# 10 to 100 or first 1000 logical records) from a VSAM file to another VSAM file. Is It possible using FLASHCPY. I am providing below code to show how our shop currently using FLASHCPY to snap entire VSAM file to another

//STEP2V2  EXEC FLASHCPY                       
//SYSTERM  DD SYSOUT=*                         
//SYSPRINT DD SYSOUT=*                         
//SYSIN    DD *                                 
   COPY DATASET(                       -       
   INCLUDE(&FRMNAME2)) -                       
   RENAMEU((&FRMNAME2, -                       
            &HLQ..&SYSUID..XMIT.VSAM2)) -       
   ALLDATA(*)                                 -
   ALLEXCP                                    -
   SPHERE                                     -
   STORCLAS(SCSHIJ)                           -
   TGTALLOC(SRC)                              -
   VOLCOUNT(ANY)                              -
   TOL(ENQF)                                  -
   REPLACEU                                   -
   CANCELERROR                                 


&HLQ..&SYSUID..XMIT.VSAM2 is the target VSAM and &FRMNAME2 is the input VSAM.
I am wondering if there is any parameter where I can specify no.of records or (startrec and endrec values) to copy only few records. Please help
Farhaan4mf
 
Posts: 29
Joined: Mon May 13, 2013 4:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Copying selective records from VSAM to VSAM

Postby dick scherrer » Mon Nov 18, 2013 8:04 pm

Hello,

I'm not sure about FLASHCOPY, but you can probably do what you want with your SORT product.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Copying selective records from VSAM to VSAM

Postby Farhaan4mf » Mon Nov 18, 2013 8:32 pm

STOPAFT or STARTREC ENDREC that we use in DFSORT will work for VSAM files also ?
If so, how are going to establish the attributes of output file ?
For flat file, we use SORTIN SORTOUT and in DCB we use DCB=*.SORTIN.
Why I am asking this is, I never used sort on VSAM files. My input & Output files both are VSAM. Output VSAM file should have exactly same features (I mean definition) as Input VSAM file has. Please give me idea for the code.
Farhaan4mf
 
Posts: 29
Joined: Mon May 13, 2013 4:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Copying selective records from VSAM to VSAM

Postby BillyBoyo » Mon Nov 18, 2013 9:20 pm

Don't use DCB=*.SORTIN. SORT by defualt gives you the DCB of the SORTIN, but is clever enough to know if your then extend/contract records in the Control Cards.

Your VSAM file will have to exist, so as long as you define it the same as the SORTIN VSAM, you shouldn't get a problem.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Copying selective records from VSAM to VSAM

Postby dick scherrer » Mon Nov 18, 2013 9:24 pm

Hello,

The DELETE/DEFINE for the original file should be available on the system. Copy this to a new DELETE/DEFINE and change the dataset names, run the IDCAMS, and you should be good to go.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Copying selective records from VSAM to VSAM

Postby halfteck » Mon Nov 18, 2013 9:59 pm

You can also use IDCAMS REPRO utilising SKIP(nnn) COUNT(nnn). Or if KSDS fromkey(key) tokey(key) will give you a range of records
halfteck
 
Posts: 42
Joined: Tue Nov 08, 2011 8:47 pm
Has thanked: 0 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post