Compilation failed due to following error(s).
9 | IF (CARD2(1:2).EQ.' ')THEN
| 1
Error: IF clause at (1) requires a scalar LOGICAL expression
compilation terminated due to -fmax-errors=1.
As has been noted earlier, there is a pattern in these posts. Arbitrary changes are made to the source code in an attempt to make compilation errors go away. When that fails, a fresh post is made asking something along the lines of âwhat do I do to fix this?â. Such an approach is misguided and a waste of everyoneâs time.
A computer program is an expression of ideas. For it to succeed, the ideas must be clear and based on a logical framework. The programmer has to be conversant, if not fluent, in the programming language chosen, willing to engage in well-reasoned discourse, and willing to read the appropriate language guides and reference manuals.
This user (and now also under a different user-id) does not appear to be interested in actually learning and understanding Fortran (or really even programming in general), properly understanding the existing software they are working on, nor respecting the time and efforts of the helpful community here. They appear to be (poorly) attempting to procure free consulting services in what is possibly the least effective way to do so. While some of their questions have provided learning opportunities and potentially useful discussions for future users, this user appears to have ignored nearly every word of it. I find it to be highly disrespectful and unprofessional conduct.
I propose a meta question for this forum: Should any action be taken towards such users and their posts, and if so what?
Edit: I actually donât want to be that guy. As disrespectful as I find this userâs actions, I donât want them silenced. Iâd simply suggest that other users disregard any questions from them that arenât likely to provide useful information to others and not necessarily worry about fixing their specific code.
The code provided in this thread is more or less the same as in the earlier one. I see no point in having two separate threads to debug the same function of 12 lines of code.
Let us set the syntax problems aside and look at the semantics of the program. The logical type function RUZE ignores the input values of its arguments, and always returns .TRUE. Therefore, the whole program could be replaced by just these two lines:
It is not clear what the function RUZE is supposed to do. It receives two strings, it uses a single one and the result is independent of the arguments. I assume this is merely a first version to get something that the compiler can chew on, but can you explain what you want this function to do precisely? Then we can try and help getting it to work properly.
I looked and flag_sockpuppets wasnât enabled. I just enabled it. Letâs see how it goes, we can always revert if we discover an issue with it. I think it will be a good change.
The notation is from the FORTRAN 77 era. It means the same thing as:
character(len=*) :: card1
The first * indicates for character variables that the length will follow and the second that the actual length is adopted from the calling program unit. You may also find:
character*20 string1, string2*40
where the first character variable, string1, gets the length 20 from the âcharacter*20â part and the second, string2, gets a length 40 because a specific length is specified for that one.
character a ! fixed-length character scalar (length = 1)
character*(4) b ! fixed-length character scalar (length = 4)
character*(*) c ! assumed-length character scalar
character*(*) d(:) ! assumed-shape array of assumed-length characters
character*(*) e(*) ! assumed-size array of assumed-length characters
Chapter 5 for arrays, Chapter 6 for text, Chapter 11 for basic C-interop. Itâs a learn-by-example kind of book so not good for looking up a specific function and its API.
Modern Fortran Explained is a reference book. I donât recommend it for learning the language, but itâs the best for looking up how something works once you know you need it.
Before asking a technical question by e-mail, or in a newsgroup, or on a website chat board, do the following:
Try to find an answer by searching the archives of the forum or mailing list you plan to post to.
Try to find an answer by searching the Web.
Try to find an answer by reading the manual.
Try to find an answer by reading a FAQ.
Try to find an answer by inspection or experimentation.
Try to find an answer by asking a skilled friend.
If youâre a programmer, try to find an answer by reading the source code.
When you ask your question, display the fact that you have done these things first; this will help establish that youâre not being a lazy sponge and wasting peopleâs time. Better yet, display what you have learned from doing these things. We like answering questions for people who have demonstrated they can learn from the answers.
That is a rather pointless question, because your function ruze2 ignores the values of its arguments and always returns .true if the arguments are valid. If the arguments are invalid, the program is invalid, so âwhat if I haveâŚâ is again a pointless question.
You have not stated the purpose of your program despite repeated requests to do so by people trying to help. You have shown various versions of program code that cannot be compiled successfully, and whose purpose is unknown.
Jonathan Swift derided such an approach to discovering knowledge in the fifth chapter of his satirical novel Gulliverâs Travels, Part 3.
Expect fewer and fewer responses if you continue along the same path, because most people would consider it a waste of time to investigate the effect of making arbitrary changes to nonfunctioning programs.