File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes importing data from a VSAM file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "importing data from a VSAM file" Watch "importing data from a VSAM file" New topic

importing data from a VSAM file

Udit Manektala
Ranch Hand

Joined: Sep 17, 2006
Posts: 30
So we have some Data in a Mainframe, that is in VSAM files. And we need to be able to import the data into a DB2 Database using Java. Any ideas ?

One that I was thinking about was converting the VSAM data to a flat file CSV and then going from there. Anyone know how to convert VSAM files to CSV ? Any other approaches?
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
You can use a COBOL program or file utility (maybe FileAide?) to export from VSAM to fixed length fields in flat text, and then read that in Java. Substring out the fields using from and length information.

CSV is a bit trickier write and read because you have to escape commas and quotes and such.

Do fixed-length records sound like something you could try?

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: importing data from a VSAM file
It's not a secret anymore!