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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic length file declaration in COBOL in VS Cobol II 5

Status
Not open for further replies.

A123I

Programmer
Oct 15, 2003
8
0
0
US
Hi Folks,
Is there someway to declare file defination whose record length and record format coming in dynamically when running the program.
I can mingle around with the logic to populate this in a variable before opening the file...

Thanks and regards,
A123I
 
It *might* work for creating a "not known at compile time" recrod length. However, it is certainly NOT supported for that purpose - and therefore, may fail in the future.

The bottom-line is that there is NO truly supported way to do this.

Another (unsupported) solution (for QSAM - nto VSAM) would be to create a "random" record layout in your source fprogram; after you OPEN the file, do a CALL "assembler-program" USING FD-name.

Then the Assembler subprogram will receive addresability to the DCB and could "manually" modify the attributes.

HOWEVER, the bottom-line is that (Standard and/or IBM) COBOL is NOT intended to create "dynamic" files.

Bill Klein
 
I'm having the same issue when attempting to process multiple input file with varing record length in a single program. I've tried everything listed for this but still have not solved the problem. Slade cau you share a cpy of CHARLIE HOTTEL code?
 
Hi Big Mike,

Sure. What'a your e-addr?

Regards, Jack.
 
I want to thank those of you (Slade, Crox, WMK, webRabbit) that took the time to assist me in this. I was able to use the ideas in the code provided by Slade to determine the LRECL of the input files. This was a big help. Next, I wanted to use the input lengths to dynamically determine an output length. I couldn't find a way to handle that part (see other postings), but I finally settled on using RECFM=V output file (even though all the records are the same length) -- not quite what I wanted, but close.

I wonder what would happen if I used the same code Slade provided to find the LRECL and write a new value to it (after opening it with a very large LRECL, but never yet writing) -- would this work, or would Cobol choke on the first write?

Again, I appreciate all the help.

Craig
 
Just a reminder to anyone working with an IBM mainframe COBOL compiler - and creating (OPEN OUTPUT) RECFM=V files.

Make certain that you use the AWO compiler option. To the besto of my knowledge, this compiler option NEVER causes a problem - and is always a "performance" (and space) benefit when writing blocked VB files.

See:


Bill Klein
 
Slade, any chance I could get a copy of that famous COBOL-program? I have sent you my e-mail address.

I am working with a similar problem trying to write a general program that works on different input and output files - record sizes not known until run time.

Regards
Olav
 
Olav et al,

If you find a way to dynamically set output record length (new file), PLEASE let me know.

Thanks, Craig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top