To avoid dealing with additional variables I coded a simple function. Plus I want to hexdump B-fields, too. This is my second function.
define function #A2hex
returns (A) dynamic
define data parameter
1 #A (A) dynamic by value
end-define
move edited #A (EM=H(536870912)) to #A2hex
end-function
end
*****
define function #b2hex
returns (A) dynamic
define data parameter
1 #b (B) dynamic by value
end-define
move edited #b (EM=H(536870912)) to #b2hex
end-function
end
Try this:
define data local
01 #b2 (B2) init <H'0001'>
end-define
write #b2hex(<H'0001'>) (AL=10)
write #b2hex(<#b2 >) (AL=10)
write #a2hex(<H'0001'>) (AL=10)
write #a2hex(<#b2 >) (AL=10)
end
My output is:
0001
0001
0001
31
So when converting #b2 to (A) dynamic, the value of #b2 is treated as an unsigned integer. A real trap for the unwary…