g***@public.gmane.org
2010-06-04 01:36:43 UTC
Calling all Fortran Wizards...
I am trying to print out the sect(8,8) integer array as characters
The array is mostly zeros for that I want to print '.'(ebcidic 75)
The other values...
92 = '*'
96 = '-'
123 = '#'
78 = '+'
Easiest is to generate the appropriate constants in DATA statements:I am trying to print out the sect(8,8) integer array as characters
The array is mostly zeros for that I want to print '.'(ebcidic 75)
The other values...
92 = '*'
96 = '-'
123 = '#'
78 = '+'
INTEGER DOT,STAR,DASH,POUND,PLUS
DATA DOT,STAR,DASH,POUND,PLUS/'.','*','-','#','+'/
Otherwise, the reason it doesn't work is that they have to
be left justified.
INTEGER SRS(8)
DO 1 I=1,8
DO 2 J=1,8
SRS(J) = 75
IF (SECT(I,J) .EQ. 1) SRS(J) = 92
IF (SECT(I,J) .EQ. 2) SRS(J) = 96
IF (SECT(I,J) .EQ. 3) SRS(J) = 123
IF (SECT(I,J) .EQ. 4) SRS(J) = 78
2 CONTINUE
WRITE(6,900) (SRS(J), J=1,8)
900 FORMAT(' ',8A3)
1 CONTINUE
I am getting a blank area instead of the characters I expect.
I would expect a NUL if you do it that way. Also, if you doDO 1 I=1,8
DO 2 J=1,8
SRS(J) = 75
IF (SECT(I,J) .EQ. 1) SRS(J) = 92
IF (SECT(I,J) .EQ. 2) SRS(J) = 96
IF (SECT(I,J) .EQ. 3) SRS(J) = 123
IF (SECT(I,J) .EQ. 4) SRS(J) = 78
2 CONTINUE
WRITE(6,900) (SRS(J), J=1,8)
900 FORMAT(' ',8A3)
1 CONTINUE
I am getting a blank area instead of the characters I expect.
left justify your values, you would then want to add two blanks
such that A3 works out. Otherwise, use (' ',8(A1,2X))
SRS(J)=16777216*78+65536*40+256*40+40
-- glen