Hi,
In a local : 1 a (a80)
in my program I want to keep the size of a: b=80.
Is there a way to calculate the length (a as a redefition)?
Hi,
In a local : 1 a (a80)
in my program I want to keep the size of a: b=80.
Is there a way to calculate the length (a as a redefition)?
If I understand you correctly, you can use the following code:
define data local
1 #dyn (A) dynamic
1 #a (A80)
end-define
#dyn := #a
write 'length of #a in byte:' *LENGTH(#dyn)
end
if you are just looking for the length of the text in the fixed length field (Matthias’ example will always return “80” as the length), then take a look at the EXAMINE statement with the GIVING LENGTH clause.
EXAMINE #a FOR ’ ’ GIVING LENGTH #b