Knowledge Base

PRB: Error in ICHAR() Using Multi-Character Input Argument

PSS ID Number: 150135

Article Last Modified on 11/2/1999


The information in this article applies to:


This article was previously published under Q150135

SYMPTOMS

Attempting to use a multi-character string input argument to the ICHAR() intrinsic function results in the following compilation error:
error FOR2326: character length of argument number 1 of intrinsic procedure ICHAR is too long

RESOLUTION

Use a one-haracter substring of the multi-character string input argument to the ICHAR() intrinsic function.

STATUS

This behavior is by design.

MORE INFORMATION

The following code illustrates the problem and workaround:

Sample Code to Illustrate Behavior and Workaround

! Compile options needed: none

      PROGRAM MAIN
      CHARACTER*16 STR
      STR='THIS IS A STRING'
      K=ICHAR(STR)           ! FOR2326 error - comment for workaround
!      K=ICHAR(STR(1:1))     ! uncomment for workaround
      PRINT *, K
      END
				

Additional query words: 4.00

Keywords: kbcode kbLangFortran KB150135
Technology: kbAudDeveloper kbFORTRANPower400NT kbFortranSearch kbZNotKeyword8