On Sat, Jul 27, 2013 at 4:52 AM, Charles Mills <[email protected]> wrote:
> Am I correct in my reading of the C manuals? (I find the information > somewhat scattered and oddly organized.) > > If I want to write a typical old-fashioned z/OS dataset in format VB and > that contains binary fields in a field-oriented record layout, then (1) my > only choice is to use fwrite() (or one of its variants) and (2) I would > declare the struct and construct the record *without* the llbb control word > and specify the length of the record (without the llbb) only in the > fwrite()? > you are correct. The fopen needs to specific "wb, type=record" or "wb,type=record,recfm=*" or some other variant with the lrecl and blksize specified if you want to control the dcb attributes from within your program. The important part is the wb and type=record. Then the fwrite needs to specify the size to 1 and the count to the lenth of the record not including the RDW length. for example fwrite( &structure, 1, recordLentth, outFile); //where recordLength = amount of data to write. If recordLength > lrecl of file, record is truncated. See chapter 3 in the C/C++ Run-Time Library Reference SA22-7821 for details about fwrite Also see chapter 10 in the C/C++ Programming Guide SC09-4765 for details on OS I/O operations. If there is no requirement to reposition the file using fseek, etc., include the noseek parameter in the call to fopen. > > Charles > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
