Hexadecimal value in Visual COBOL

[Migrated content. Thread originally posted on 25 October 2011]

Hello,

I have found a problem checking out hexadecimal values in a string. This issue makes that my application goes crazy. Look at the program below. What do you expect to be displayed? For both cases, the program displays "wcar(x) is equal to h'03'".

*$SET CALLFH("ACUFH")
*$SET RETRYLOCK
*$SET RM"ANSI"
identification division.
program-id. Program1.

environment division.
configuration section.

data division.
working-storage section.

01 wentrada pic x(80).
01 wcontrol redefines wentrada.
03 wcar pic x occurs 80.
01 wind pic 99.
01 z pic x.

procedure division.

entry-point section.
main-entrance.
move 1 to wind.
move 3 to wcar(wind).
add 1 to wind.
move H"03" to wcar(wind).
if wcar(1) equal h"03" then
display "wcar(1) is equal to h'03'"
else
display "wcar(1) is different than h'03'"
end-if.
if wcar(2) equal h"03" then
display "wcar(2) is equal to h'03'"
else
display "wcar(2) is different than h'03'"
end-if.
accept z.

end-of-program.
goback.

end program Program1.