hi
i want to do validation for packed decimal(p5,2).
iam using EM edit mask iam getting error
thanks in advance
hi
i want to do validation for packed decimal(p5,2).
iam using EM edit mask iam getting error
thanks in advance
The Natural Help says, that the following should work (but it’s not recommended):
define data local
01 #a4 (A4) init <H'1234567D'> /* packed -12345.67
01 redefine #a4
02 #p5_2 (P5.2)
end-define
*
if #p5_2 = MASK (NNNZ)
write 'packed'
else
write 'not packed'
end-if
*
end
It must be MASK(NNNNNNZ), as N checks a digit (not a byte), whereas Z checks a byte for a signed digit (so in total 4 bytes / 7 digits are checked). This check is the only way to check a packed value for a correct value and thus, of course, recommended. What is not recommended, is the redefinition of a alpha string, but in Natural we are used to do this.
[quote="Wilfried B