Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read any file into COBOL program??

Status
Not open for further replies.

dallasdino

Programmer
Nov 27, 2002
28
US
I have written a smart compare that I use. I would like to be able to read any file much like other utilities do. Currently I supply the length of the file and the length and starting displacement of the key if adds or deletes are expected. Another thing I do on occassion is change the record length and related fields then recompile.

I can reformat the input files with a sort to a specific generic format like FB 4096 and it works fine. Maybe VB 4096 would be better for space. However what I would really like is to not have to know the input atributes. How would I do this? Is there any trick or return code processing that can be used?

Must I write an assembler called program?

If someone has solve this please let me know.
 
Hi Dallasdino,
Not sure if there is a way to do this in Cobol but at my place of work we have an assembler routine that does this.
Marc
 
Can you send me a copy of source?

I would appreciate it.
 
Actually there is a tool commonly used that has been in use for many years: DDL (Data Definition Language).

If you are already familiar with DDL, then, I am just going off (again) on a limb here.

Every time, a file definition changes, these records (or working storage data areas) are compiled using DDL (the same way you recompile a changed program.

When DDL finds no errors, the data declarations are saved into a file that programs can COPY from. But, most importantly, all data characteritics are saved into a DDL dictionary.

The DDL dictionary contains everything (I think) that you may want to about any piece or group of data that exist in your database (OK, only those you chose to submit to DDL. In my opinion every piece of data should got through a tool like DDL - it keeps things neat and tidy and simply useful.

Oh, I almost forgot, you can - through the same DDL compilation - create COPY files for a number of languages (COBOL, C,PLI, Assembler (I think), PL/I, TAL, ...), and a report file containing other exotic information, besides record length, you get offsets, number of bytes per field declaration, and it goes on.

You can creatively use the DDL dictionary (it is VSAM like, with keys, etc...) to write smart programs that don't COPY files, but consult the dictionary to know how to deal with any file.

Since COBOL uses VSAM files, dallasdino, then this tool can be written in COBOL.

Here is a suggestion/strategy:

1. (If you use DDL skip this step)
Record definitions should be compiled (everytime they change and keep relevant information in some sort of COBOL or VSAM file definitions.

2. Use the saved information creatively - you are already headed in that direction. Here is a tool (it implements some your features):
And mostly, have fun - write it in COBOL. Remember, in determined hands, any program can do anything the other languages are doing - its just that, not all functions or routines are implemented (canned, really) in every language. Maybe from disinterest? Or the need to keep the hulking size of compilers down? By sticking to what the market niche is asking for?). If you included all features into a single compiler, you may not necessarily get a friendly superior usable languge; remember ADA?

Dimandja
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top