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

Multiple input files of different lengths

Status
Not open for further replies.

Wjburke2

Programmer
Feb 3, 2009
14
US
I am working on COBOLIII, on a VSE system. I have a program that just needs to count the records in a file not update the file. There about 6 different fixed length files ranging from 160-475 in length. In other programs here at work they define separate FD'd and open and close the one with the correct file size based on a PARM card.
I have tried coding the FD for variable record lengths and multiple 01's. I get a file open error at run time. Is this a VSE peoblem or is there a way to do this wthout many FD's? What am I ding wrong? Please help
 
If you are only counting records does it really matter if you have multiple record lengths? I would define the file as one FD with a max length of 475. Read it like a sequential file, count until end of file.

If for some reason you are using the multiple records further in your logic then you create several FDs (01) as your working storage this is assuming that each record type will have some sort of a record type to distinguish one from the other.
 
Hi,

If the 01s are of different length, this tells the compiler that the file is variable rather than fixed. . . An FD must reference a file defined the same. A variable FD will not be usable for multiple fixed-length files.

To simply count records, you might consider using the sort product in use on the system.
 
Its a more complicated than that. This is for the New "Inteligent Mail Bar Code". This program wiil count the records then call another program that will reserve a sequecnce of numbers. This program then writes the starting number to a VSAM record that can be picked up by Post (vendor software) that will number each record. Really uncomplicated but I would like to have one program to handle all of the various files.
 
Define one record description containing the maximum number of bytes, and specify RECORD CONTAINS 0 CHARACTERS in the SELECT clause. You may also have to specify BLOCK CONTAINS 0 RECORDS.
 
Ok I will try that. I think I tryed it alr but coded RECORDING MODE V. VSE is differant than MVS I know I have done this in a past life on MVS. Its Friday so you guys have a great weekend. Thanks for all the help. I will let you know how it turns out.
 
Well I didn't get very far out the door on this the input is a 373 length record.

* //GLBIN DD DSN='TDWJB00.S.TEST.LALQUAL.FILE1(0)',
* // DISP=(OLD,KEEP)

SELECT GLOBE-IN ASSIGN TO GLBIN
STATUS IS GS-IN-STATUS.

FD FILE-IN
RECORDING MODE F
RECORD CONTAINS 0 CHARACTERS
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS ARE STANDARD.
01 FILE-IN-REC PIC X(475).

EXECUTION ABNORMALLY TERMINATED WITH USER-ABEND CODE 4083 AND REASON CODE 0004.
 
VSE is picky on this one. You can't use variable files because the records do not contain the necessary length information at the beginning of each record/block. VSE also does not support the same record length information in the file labels that z/OS does, so you generally have to get the DTF right to start with.

I assume these are typical disk/tape files and not VSAM?

I suspect the only way to really do what you want is to modify the DTF dynamically before you do the open. You'd also have to make sure you coded the DTF for the largest possible record size or used dynamic storage allocation to get proper buffers and store the address in the DTF. Since this would require walking various control blocks or perhaps using some called module tricks to get the DTF address so you can modify it, I'd suggest you either continue to use the approach the others in your shop are using, or do this work with an assembler program.

Regards,

Glenn
 
I'd say that's why they did the other programs with parm/upsi fed file selection. You can't code cobol to read files with varying fixed length records. Its not a vse problem.

Why fight it. Clone one that exists and modify it for your purposes.

Or, create six sepearate sort (copy to nullfile) jobs. One for each rec length to get the count.


Dave

Dave
 
Thanks to everyone that replied to this. I guess the files I worked with at Hertz were created as variable length files so they could be read in to one input file. That was awhile ago and I slept since then. I ended up writing a EZTrieve program that works nicely.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top