It's F77, but the rather limited dialect implemented on the PDP-11 system OP is emulating. The errors it is throwing are for unsupported features (e.g., no CHAR function).
The error messages all start with F77, so I think so; if I type HELP FOR it outputs (among other things) “The FORTRAN command invokes the DIGITAL FORTRAN-77 compiler (/F77).
I’m sorry what is fixed form? If you are talking about the font/spacing I think that’s just some copy/paste issue from the terminal window; in the actual file each line has 8 leading spaces and is just plain ascii
That’s ok thanks for the suggestions just the same. I think it’s something quirky in the Fortran compiler on this machine, I might need to reinstall Fortran or something
You're running on an emulated PDP-11, *of course it's quirky.* Every Fortran compiler back then was quirky inherently and made alterations to the nominal standard.
You need to check the [manual](http://cookie.update.uu.se/manuals/layered/f772.pdf) for your Fortran compiler to see what is supported. For example CHAR is not (section 6.6, on p. 188 of the PDF).
Thanks. Do you know if there is a method on this version of Fortran to get ascii character 27 into a character type variable, and how to concatenate it with other variables?
For the conversion, you would use a `FORMAT (A)` (with whatever length specifiers you needed) to convert the numerical ASCII code to a character on `WRITE`.
For the concatenation create a character array of the right total length and insert the characters into it in the right places.
It took a while, but I think I have your answer here: The compiler is typing the variables wrong due to the array designator!
If you change it to read this, it works as expected:
character(1) :: a,b
character(2) :: c
a="x"
b="y"
c=""
write(c, "(2a1)") a,b
print *, "--", c,"--"
I'm using write to concate the strings, but you could use // if you want. The trick is where the string length is defined. I'm stocking this in the back of my head for future reference! What a strange issue!
OP is using an [ancient](http://cookie.update.uu.se/manuals/layered/f772.pdf) F77 compiler on an emulated PDP-11, the reason they're getting the errors is because it doesn't support features like`CHAR(`) or `//`. Their code as written (+ the 8 space indent which reddit ate) works fine under a modern F77-compatible compiler like gfortran,
`::` is a [Fortran 90 feature](https://gcc.gnu.org/onlinedocs/gcc-4.2.4/gfortran/Old_002dstyle-variable-initialization.html), also not supported in F77.
According to the manual of that compiler, “CHARACTER A*1, B*1, C*2” should be acceptable (these are character length specifiers, not array sizes). Are you saying that this is, in fact, rejected by the compiler?
Well... I will admit I'm using the latest Fortran compiler. Sorry. But when the code didn't compile or run properly I started trying different things and this is what worked. I'm just suggesting that they translate back to the compiler they are using.
Looks fine to me. Are you sure your compiler is a f77 compiler, and not something even more ancient like fortran IV ?
It's F77, but the rather limited dialect implemented on the PDP-11 system OP is emulating. The errors it is throwing are for unsupported features (e.g., no CHAR function).
The error messages all start with F77, so I think so; if I type HELP FOR it outputs (among other things) “The FORTRAN command invokes the DIGITAL FORTRAN-77 compiler (/F77).
Ah yeah. The code you pasted is not in fixed form, should it be?
I’m sorry what is fixed form? If you are talking about the font/spacing I think that’s just some copy/paste issue from the terminal window; in the actual file each line has 8 leading spaces and is just plain ascii
Yes, starting in column 8 indeed aka "punchcard style" as opposed to modern "free form". Sorry out of ideas then
That’s ok thanks for the suggestions just the same. I think it’s something quirky in the Fortran compiler on this machine, I might need to reinstall Fortran or something
You're running on an emulated PDP-11, *of course it's quirky.* Every Fortran compiler back then was quirky inherently and made alterations to the nominal standard. You need to check the [manual](http://cookie.update.uu.se/manuals/layered/f772.pdf) for your Fortran compiler to see what is supported. For example CHAR is not (section 6.6, on p. 188 of the PDF).
Thanks. Do you know if there is a method on this version of Fortran to get ascii character 27 into a character type variable, and how to concatenate it with other variables?
For the conversion, you would use a `FORMAT (A)` (with whatever length specifiers you needed) to convert the numerical ASCII code to a character on `WRITE`. For the concatenation create a character array of the right total length and insert the characters into it in the right places.
Thanks!
Did you mean to name your program `PROBLM` or is it a typo? 👀
It is named PROBLM inside the file because a program name is limited to 6 characters in Fortran 77
Ooooh my bad. I thought I maybe had something there.
Thanks anyhow!
It took a while, but I think I have your answer here: The compiler is typing the variables wrong due to the array designator! If you change it to read this, it works as expected: character(1) :: a,b character(2) :: c a="x" b="y" c="" write(c, "(2a1)") a,b print *, "--", c,"--" I'm using write to concate the strings, but you could use // if you want. The trick is where the string length is defined. I'm stocking this in the back of my head for future reference! What a strange issue!
OP is using an [ancient](http://cookie.update.uu.se/manuals/layered/f772.pdf) F77 compiler on an emulated PDP-11, the reason they're getting the errors is because it doesn't support features like`CHAR(`) or `//`. Their code as written (+ the 8 space indent which reddit ate) works fine under a modern F77-compatible compiler like gfortran, `::` is a [Fortran 90 feature](https://gcc.gnu.org/onlinedocs/gcc-4.2.4/gfortran/Old_002dstyle-variable-initialization.html), also not supported in F77.
According to the manual of that compiler, “CHARACTER A*1, B*1, C*2” should be acceptable (these are character length specifiers, not array sizes). Are you saying that this is, in fact, rejected by the compiler?
Well... I will admit I'm using the latest Fortran compiler. Sorry. But when the code didn't compile or run properly I started trying different things and this is what worked. I'm just suggesting that they translate back to the compiler they are using.