Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Multiple input files of different lengths

Multiple input files of different lengths

Multiple input files of different lengths

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

RE: Multiple input files of different lengths

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.

RE: Multiple input files of different lengths


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.

RE: Multiple input files of different lengths

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.

RE: Multiple input files of different lengths

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.

RE: Multiple input files of different lengths

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.  

RE: Multiple input files of different lengths

Well I didn't get very far out the door on this the input is a 373 length record.

* //           DISP=(OLD,KEEP)                        

                            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).  


RE: Multiple input files of different lengths

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.



RE: Multiple input files of different lengths

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.



RE: Multiple input files of different lengths

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.    

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close