Path: utzoo!utgpu!water!watmath!clyde!bellcore!decvax!ucbvax!WYOCDC1.BITNET!ZSYJKAA From: ZSYJKAA@WYOCDC1.BITNET (Jim Kirkpatrick 307 766-5303) Newsgroups: comp.os.vms Subject: FORT vs. zero-length strings Message-ID: <880207233405.000025A8.GBJR.83@WYOCDC1> Date: 8 Feb 88 06:34:05 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 31 Regarding the following, earlier posting -- I tripped over the following this week (VMS 4.6, FORTRAN 4.71-271) ------------------------------------------------------------------------ $TYPE TEST.FOR CHARACTER*8 RED RED = '' END $ FORTRAN TEST %FORT-E-ZERLENSTR, Zero-length string [and so on] What the REAL problem is, is that FORTRAN character variables always have fixed length; if you say RED = 'HI' it really gets padded to RED = 'HI ' (since you declared RED as CHARACTER*8). Thus, you cannot have zero-length character variables. Somebody at DEC (or would it be ANSI) mis-interpreted this as meaning you cannot have zero-length character strings. It seems to me, if I say RED=character-string, and if character-string is less than 8 characters long, it gets padded with (8-size) blanks; why this does not apply if character-string is zero characters long, in which case 8 padding bytes should simply be added, baffles me. Every computer system I've been on has some mentally-retarded feature that doesn't handle some sort of "zero" condition properly. I remember a big argument with SDS (long ago!) that their SORT utility should not abort if the input file contains zero records, it should simply sort all zero records and build an output file containing all zero records in proper order! They insisted sorting zero records was an error condition. If anybody has the ANSI standard handy, could you look up the formal definition of a character string and let us (or me) know if zero-length strings are OK? I'd hate to flame DEC if ANSI deserves it instead.