This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JDBC and the fly likes Reading COBOL ISAM files with java`? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Reading COBOL ISAM files with java`?" Watch "Reading COBOL ISAM files with java`?" New topic
Author

Reading COBOL ISAM files with java`?

�yvind Valland
Greenhorn

Joined: Sep 27, 2003
Posts: 16
Hello everyone,
I'm new to the site, and have a potentially difficult question...: How can I read a COBOL ISAM file using Java? I need to access a COBOL ISAM file to obtain stock level corresponding to a given product number.. this stock level is then used to update a MySQL database. I have tried searching the web for help on the issue but have so far come up blank.
If you can offer any help, I'll be very grateful! Thanks!
�yvind
Gary Joehlin
Greenhorn

Joined: Sep 18, 2003
Posts: 16
First you need to answer a few questions:
But first a statement of interest:
COBOL and ISAM do not own each other, one is a programming language and the other is a file access method, they are independent items.
Secondly, ISAM is considered obsolete, especially if you're talking about the mainframe environment, do you really mean VSAM, it's newer cousin?
If indeed it's VSAM, then what sub-type of VSAM file? (KSDS, ESDS, RRDS or LDS) You can find this out with the VSAM utility, LISTCAT, and some help of a system or application programmer.
Just curious, because I haven't heard of an ISAM file being used in over a decade.
You may wish to access it via a stored procedure, if it's VSAM. ISAM, I don't believe is supported any longer.
Regards,
Gary Joehlin
colo spgs.
�yvind Valland
Greenhorn

Joined: Sep 27, 2003
Posts: 16
Thanks for your input, Gary!
I'll explain as best as I can, with my limitied knowledge of the issue. The problem is part of a large university assignment/project (systems development) where we have to integrate an old COBOL inventory system with our new Java/JSP system which is based around a MySQL database. In order to maintain concurrent stock levels in both systems, we need to read the 'inventory.dat' file maintained by the COBOL system. The following information is all that the university provides regarding this specific file:
"The [COBOL]Inventory System is built around the traditional file technology. It contains an ISAM file called inventory.dat which has inv-prod-number as its primary key and inv-prod-type as well as inv-bin-number as its two secondary keys. The file has been created using a MicroFocus Cobol program and conforms to the indexing standards specific to this implementation platform. This means that only MicroFocus Cobol programs can access the file directly using the keys."
This file, inventory.dat, is updated in a batch job every 24 hours. After this batch job runs, our system has to read the file in order to obtain current inventory information. If you have any ideas, I'd be most grateful!
Cheers,
�yvind
Gary VanMatre
Greenhorn

Joined: Sep 26, 2003
Posts: 6
You might consider adding a step to the end of your nightly batch cycle to dump a sequence file to be downloaded. You might be able to pull it from the mainframe via FTP. If this option is available, you could automate it with a simple java class. Otherwise you will have to work with your 3270 terminal emulator software.
The record layout of the file should be �display� or text type to make the translation to ASCII simple.
Then you would need a batch job to import into your new DB schema.
I hope this helps. Sounds like fun.
Steve Schowiak
Greenhorn

Joined: Oct 21, 2002
Posts: 20
I agree with Gary. The easiest way to to port this over to a new platform is to write a quick and dirty COBOL program that reads the ISAM file and spits it back out in a plain sequential file, delimited with TAB's for MySQL. It might also be done using a DYL script or FileAide. You could insert a step in your JCL/JOB to handle this. Then just FTP the sequential file to your new environment. Porting the actual ISAM file itself would be a REAL pain in the butt.
Hmmmmm. ISAM files. That's real old stuff. Before the IT market went down the toilet, I used to ba a rather accomplished mainframer. Never dealt with an ISAM file yet though.


I am not insane. The voices in my head told me so.
�yvind Valland
Greenhorn

Joined: Sep 27, 2003
Posts: 16
Thank you both for your replies...
Well, I took this wretched file and opened it with my trusty WordPad... and, to my greenhorn surprise, I could actually understand the structure of the file just by looking at it (I'd seen a description of what this file should contain beforehand).... so now one of my programming buddies has decided he's going to try and process the file line by line, char by char..
If that fails, we'll definitely try your methods!
Thanks!
�yvind
 
wood burning stoves
 
subject: Reading COBOL ISAM files with java`?