Path: utzoo!attcan!uunet!husc6!uwvax!dogie!uwmcsd1!ig!agate!ucbvax!UKANVAX.BITNET!sloane From: sloane@UKANVAX.BITNET (Bob Sloane) Newsgroups: comp.os.vms Subject: RE: RE: Re: VMS C reading fortran files Message-ID: <8806141516.AA07132@ucbvax.Berkeley.EDU> Date: 14 Jun 88 15:16:52 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 64 X-Unparsable-Date: Wed, 8 Jun 1988 10:12:12.54 CDT >>I agree that C under VMS has problems with fortran carriage control >>files. First, if the first line of the file starts with a blank, C >>will return a newline immediatly. ... >It sounds like VAX C is converting the carriage control exactly as it should >to match the definition of FORTRAN carriage control. Note that it is not >necessarily the conversion most people expect. We ran into this when >implementing FORTRAN carriage control conversion for VMS Kermit. The >definition of FORTRAN carriage control given in the VAX RMS Reference Manual >on page 5-23 indicates that a blank in the carriage control column indicates >that when printed the record should be *preceded* by a line feed and >followed by a carriage return. This is not what most people expect, but it >is the only definition of FORTRAN carriage control I know of that allows it >to actually match the characteristics implied by the FORTRAN '77 standard. >- Nick Bush Interesting. I looked up the manual reference and Nick is correct. On page 5-22 it also gives the definition of Carriage Return Carriage Control, which says the same thing as single space Carriage Control in FORTRAN. Unfortunately, Carriage Return Carriage Control is not interpreted according to the manual. Suppose I do the following: $ ver='f$verify(1)' $ create testfort.c ! write a short test program #include /* get the standard defs */ main() /* start of main routine */ { char str[80]; /* buffer to read string */ while ( fgets( str, sizeof(str)-1, stdin ) != NULL ) /* copy stdin */ fputs( str, stdout ); /* to stdout */ } $ cc testfort ! compile test program $ link testfort,sys$library:vaxcrtl/lib ! link test program $ convert/fdl=sys$input testfort.c forttest.c ! make a FORTRAN CC file RECORD CARRIAGE_CONTROL fortran $ define/user sys$input testfort.c ! use CR CC file as stdin $ run testfort $ define/user sys$input forttest.c ! use FORTRAN CC file $ run testfort $ ver='v$verify(ver)' I would expect the output of the 2 runs of the program to be identical, since the ONLY difference between the input files is the CARRIAGE_CONTROL attribute. They are NOT the same. There is a blank line at the start of the FORTRAN Carriage Control file. Since this file was created by CONVERT, it seems obvious that CONVERT and C are treating Carriage Control differently. While I don't have a copy of the FORTRAN 77 standard at hand, I doubt that it specifies that a program that writes output to a printer with blanks in column 1 should skip the first line on the first page. If it does, then CONVERT, TYPE and several other utilities on VMS interpret FORTRAN Carriage Control incorrectly. Bob Sloane University of Kansas Computer Center (913) 864-0444 SLOANE@UKANVAX.BITNET SLOANE@KUHUB.CC.UKANS.EDU