Re: A problem of character (Fortran)

"Kevin Leonard" <kl_j76-/[email protected]> Thu, 03 Jun 2010 23:30:57 -0000
Newsgroups gmane.comp.emulators.turnkey-mvs
Message-ID <[email protected]>
> Um, but isn't that going to print with a lot of spaces (or
> junk)? I'd go for setting the value in the high byte, and then
> using A1

That's what you have to do with FORTRAN IV.  Manipulating
character data wasn't exactly its strong point.  I would
end up using LOGICAL*1 variables as character, so as not
to waste storage, something like:

      LOGICAL*1 C092 /'*'/
      LOGICAL*1 C096 /'-'/
      LOGICAL*1 C123 /'#'/
      LOGICAL*1 C078 /'+'/
      LOGICAL*1 C075 /'.'/
      LOGICAL*1 SRS(8)
      DO 2 J=1,8
        SRS(J) = C075
        IF (J .EQ. 1) SRS(J) = C092
        IF (J .EQ. 2) SRS(J) = C096
        IF (J .EQ. 3) SRS(J) = C123
        IF (J .EQ. 4) SRS(J) = C078
 2    CONTINUE
      WRITE (6,900) (SRS(J), J=1,8)
 900  FORMAT (' ', 8A1)
      STOP
      END

which produces:

*-#+....

If you go that way, every character value needs to
be predeclared in a DATA-type statement, because
there's no way to assign a character value dynamically.

-- 
Kevin