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...
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.
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?
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?
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.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.