Knowledge Base

$DEBUG Modifies Behavior of SELECT CASE in PowerStation 1.0

Article ID: 118394

Article Last Modified on 10/17/2003


APPLIES TO


This article was previously published under Q118394

SUMMARY

The description of the SELECT CASE construct in the "Language Guide" states that if the test expression does not match any of the cases and there is no default case, execution proceeds after the END SELECT. However, the documents fail to mention that $DEBUG modifies this behavior. The description for $DEBUG states that an error message is generated for test expressions that do not match any of the CASEs; this error message reads as follows:
run-time error F6105 $DEBUG
- no matching CASE found for SELECT CASE

MORE INFORMATION

To generate the debug message, compile and run the sample code below. Type anything other than 0 or 1 at the prompt. The program runs without error if the CASE DEFAULT lines are uncommented.

NOTE: You can use compiler option /4Yb instead of the $DEBUG metacommand.

Sample Code

c compile options needed: none

   $DEBUG
         INTEGER I
         write (*,'(A,\)') ' Enter selection <0 or 1>: '
         READ (*,*) I
         SELECT CASE (I)
         CASE (0)
            WRITE(*,*) 'First case: I =',i
         CASE (1)
            WRITE(*,*) 'Second case: I =',i
   c      CASE DEFAULT
   c         WRITE(*,*) 'Default case I =',i
         END SELECT
         END
				

Additional query words: 1.00 1.00a

Keywords: kberrmsg kblangfortran KB118394