Welcome Guest [Log In] [Register]
Welcome to Brackenwood. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
if anyone knows fortran, I need help errorchecking
Topic Started: Oct 1 2007, 04:47 AM (1,709 Views)
redheadstepchild
Member Avatar
Brackenwood Lightweight
My fortran class assigns weekly projects, and I'm having a little trouble with the latest one.

Code:
 

!NAME : Anthony
!CLASS : CS 1503
!LAB TITLE : Lab 4
!LAB TIME : 11
!
!DESCRIPTION : determines if the pieces of string 1 are chronological members of string 2
!
!

MODULE ModMain
   
   IMPLICIT NONE

   !Data Dictionary
   LOGICAL :: result = .FALSE.
   LOGICAL :: exitloop = .FALSE.
   CHARACTER (LEN = 100) :: message
   CHARACTER (LEN = 100) :: checkstring
   INTEGER :: lenMessage
   INTEGER :: lenCheckString
   INTEGER :: counter = 1
   INTEGER :: messageposition = 1
   CHARACTER (LEN=1) :: messagechar
   CHARACTER (LEN=1) :: checkchar

CONTAINS    


   SUBROUTINE main
       DO
           CALL getstring
           CALL check
       END DO    
   END SUBROUTINE main
       


   SUBROUTINE getstring
       WRITE (*,*) 'Please input 2 strings'
       READ (*,*) message, checkstring
       message = TRIM(message)
       checkstring = TRIM(checkstring)
       lenMessage = LEN(message)
       lenCheckString = LEN(CheckString)

       exitloop = .FALSE.

       DO WHILE (exitloop .EQV. .FALSE.)
           DO counter = 1, lenmessage, 1
               messagechar = message(counter)
               SELECT CASE (messagechar)
                   CASE ('A' : 'Z')
                       CYCLE
                   CASE ('a' : 'z')
                       CYCLE
                   CASE ('0' : '9')
                       CYCLE
                   CASE (' ')
                       CYCLE
                   CASE DEFAULT
                       WRITE (*,*) 'The input for string 1 &
                            can only contain alphanumeric characters'
                       READ (*,*) message
                       message = TRIM(message)    
                       lenMessage = LEN(message)
                       EXIT
               END SELECT
       exitloop = .TRUE.
           END DO
       END DO

       exitloop = .FALSE.

       DO WHILE (exitloop .EQV. .FALSE.)
           DO counter = 1, lencheckstring, 1
               checkchar = checkstring(counter)
               SELECT CASE (checkchar)
                   CASE ('A' : 'Z')
                       CYCLE
                   CASE ('a' : 'z')
                       CYCLE
                   CASE ('0' : '9')
                       CYCLE
                   CASE (' ')
                       CYCLE
                   CASE DEFAULT
                       WRITE (*,*) 'The input for string 2 &
                            can only contain alphanumeric characters'
                       READ (*,*) checkstring
                       checkstring = TRIM(checkstring)    
                       lencheckstring = LEN(checkstring)
                       EXIT
               END SELECT
       exitloop = .TRUE.
           END DO
       END DO

       IF ((message == 'EXIT') .AND. (checkstring == message)) THEN
           STOP
       END IF
   END SUBROUTINE getstring

   SUBROUTINE check
       messageposition = 1
       result = .FALSE.
       messagechar = message(1)
       DO counter = 1, lenCheckString, 1
           checkchar = checkstring(counter)
       
           IF (messagechar == checkchar) THEN
               messageposition = messageposition + 1
               messagechar = message(messageposition)

               IF (messageposition > lenmessage)THEN
                   result = .TRUE.
                   EXIT
               END IF

           END IF
       END DO

       IF (result .EQV. .TRUE.) THEN
           WRITE (*,*) 'YES'
       ELSE
           WRITE (*,*) 'NO'
       END IF
   END SUBROUTINE check


END MODULE ModMain




PROGRAM AllinAll

   USE ModMain
   IMPLICIT NONE

   CALL main

END PROGRAM AllinAll


The compiler gives me the following as error messages, but I don't know what's wrong, or how to fix it.

Code:
 
C:\fortran\Lab4.f95:50.16:

               messagechar = message(counter)
              1
Error: Unclassifiable statement at (1)
C:\fortran\Lab4.f95:76.16:

               checkchar = checkstring(counter)
              1
Error: Unclassifiable statement at (1)
C:\fortran\Lab4.f95:106.8:

       messagechar = message(1)
      1
Error: Unclassifiable statement at (1)
C:\fortran\Lab4.f95:108.12:

           checkchar = checkstring(counter)
          1
Error: Unclassifiable statement at (1)
C:\fortran\Lab4.f95:112.16:

               messagechar = message(messageposition)
              1
Error: Unclassifiable statement at (1)
C:\fortran\Lab4.f95:137.15:

   USE ModMain
             1
Fatal Error: Can't open module file 'modmain.mod' for reading at (1): No such fi
le or directory
gfortran: Internal error: Aborted (program f951)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


Any speculation or help would be appreciated
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · All the others · Next Topic »
Add Reply