Copying Vsam contents into a flat file based on the key cond

Post your questions related to VSAM

Moderator: Moderator Group

Post Reply
harsmys
Member
Posts: 4
Joined: Mon May 06, 2013 5:05 pm

Copying Vsam contents into a flat file based on the key cond

Post by harsmys » Mon May 06, 2013 5:12 pm

Hi guys,

I want to copy the records from a VSAM into a flatfile based on the key condition, I want to use the repro commamnd could u pls suggest me any suitable method.
eg: key field
12ab34567
12cd84393
46ab88380
78ab93909
84cd94923

output should contain only
12ab34567
46ab88380
78ab93909 the third n fourth position of the key should be compared.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Mon May 06, 2013 6:39 pm

You want to extract based on position 3 and 4 of your key? Use SORT, with INCLUDE/OMIT

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Tue May 07, 2013 1:07 am

Suggest you Not use REPRO.

As WC mentioned, using your sort product is a better way to go - expecially if the volume is large.
Have a good one

harsmys
Member
Posts: 4
Joined: Mon May 06, 2013 5:05 pm

Post by harsmys » Tue May 07, 2013 11:26 pm

thank u William Collins & DikDude...:)

harsmys
Member
Posts: 4
Joined: Mon May 06, 2013 5:05 pm

Post by harsmys » Tue May 07, 2013 11:33 pm

One more thing, I just came across commands such as INCCHAR and INCREL, which exactly does wat I want,but this parameter should be used only with CPYF command.So could any one tell me whether this CPYF (copy file)command be used in JCL,If it could be used what shoud be PGM=


here is the link for details the two parameters

http://pic.dhe.ibm.com/infocenter/iseri ... opyrec.htm


http://pic.dhe.ibm.com/infocenter/iseri ... pyreco.htm

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Tue May 07, 2013 11:46 pm

Are you running on an iSeries system or a z/OS system?

Is there some reason you have not used the sort to do what you want?
Have a good one

harsmys
Member
Posts: 4
Joined: Mon May 06, 2013 5:05 pm

Post by harsmys » Wed May 08, 2013 8:16 am

I am using z/OS system only.

We already have a JCL which extracts records based on key field character using repro fromkey tokey, I need to add two more comparison valueS to the key field, I mean totally three key field values to be picked up from the whole of VSAM.For that I might need to use fromkety tokey three times.So wanted to know whether i can use the CPYF command along with INCCHAR and INCREL.

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Wed May 08, 2013 4:49 pm

If what you want to run is only available on iSeries, then you won't be able to run it on z/OS.

From what you have shown, you will not be able to do it with REPRO and a KEY, as what you want to select on is in the "middle" of a key.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Thu May 09, 2013 12:21 am

If you had used the sort as suggested, this would have been running yesterday (and more efficiently) . . . :?
Have a good one

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others