record structure in fopen remains not



Help for C/C++ for MVS, OS/390 C/C++, z/OS C/C++ and C/C++ Productivity Tools for OS/390

record structure in fopen remains not

Postby kjesse » Fri Jul 15, 2011 2:59 pm

Hi,

I am setting a record length in the run time system of 260 but after running the program the data structure is changed. I have a length of 1280 instead. The data structure changes obviously. I do in the program a fopen("file2.txt","w"). Can I change the parameters of fopen in order to keep the record structure? Thank you for helping.

Jesse
kjesse
 
Posts: 13
Joined: Tue Sep 21, 2010 9:26 pm
Has thanked: 0 time
Been thanked: 0 time

Re: record structure in fopen remains not

Postby Robert Sample » Fri Jul 15, 2011 4:33 pm

Can I change the parameters of fopen in order to keep the record structure?
What does the manual tell you?

Did you try what the manual said?

Did it work?
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: record structure in fopen remains not

Postby kjesse » Fri Jul 15, 2011 4:46 pm

The manual says that LREC means the maximum record length for variable/fixed format. But I cannot see how the record length you take for the runtime library is kept by the system. What parameter do I have to program?
kjesse
 
Posts: 13
Joined: Tue Sep 21, 2010 9:26 pm
Has thanked: 0 time
Been thanked: 0 time

Re: record structure in fopen remains not

Postby Robert Sample » Fri Jul 15, 2011 4:57 pm

But I cannot see how the record length you take for the runtime library is kept by the system
This makes no sense to me -- an LRECL is an LRECL is an LRECL, period. And the system does not "keep" an LRECL -- the record size is either specified by the program, or it is picked up from the file (for an input file, for example). You have complete and total control over the record format, record length, block size, and so forth -- the system does not do anything with these values, and most especially will not change them. If you don't provide one (or more) of them in your program, the system will use the actual file to get the others, but it won't arbitrarily create or modify them.

Section 2.9.1.13 of the XL C/C++ Programming Guide manual on fopen() and freopen() parameters lists lrecl as one of the parameters you can provide on the fopen. If you specify lrecl=260 in the fopen, the MAXIMUM record length that can be written will be 260 (if fixed length) or 256 (if variable length).
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to C, C++

 


  • Related topics
    Replies
    Views
    Last post