- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have the variable:
character*50 :: TableType
From the debugger, I can see that
TableType == 'SYSTEM TABLE ',
However, in an if-statement the relation
(TableType /= 'SYSTEM TABLE')
returns .TRUE. as does
(TRIM(TableType) /= 'SYSTEM TABLE')
But, if I declare another variable variable
character*12 :: temp
and set
temp = TRIM(TableType)
and then execute the if-statement with
(temp /= 'SYSTEM TABLE')
it returns .FALSE. as expected...
Does anyone have any ideas as to why using the variable temp works, but directly comparing does not? The manual leads me to believe that the trailing blanks shouldn't be a problem...
Thank you,
Elaine Hale
character*50 :: TableType
From the debugger, I can see that
TableType == 'SYSTEM TABLE ',
However, in an if-statement the relation
(TableType /= 'SYSTEM TABLE')
returns .TRUE. as does
(TRIM(TableType) /= 'SYSTEM TABLE')
But, if I declare another variable variable
character*12 :: temp
and set
temp = TRIM(TableType)
and then execute the if-statement with
(temp /= 'SYSTEM TABLE')
it returns .FALSE. as expected...
Does anyone have any ideas as to why using the variable temp works, but directly comparing does not? The manual leads me to believe that the trailing blanks shouldn't be a problem...
Thank you,
Elaine Hale
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a typo in the original message -- TableType is equal to 'SYSTEM TABLE'//38 Blanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My guess is that there are non-blanks in the "trailing" space - possibly NULs. What does LEN_TRIM give you?
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tip: you can see exact contents of a string variable by typing variable name in "Memory" Debugger window.
Jugoslav
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page