I have a requirement where in which i need to validate the comp-3 field in the input file, I have coded it in rexx as below.
I am using C2X function to convert the packed to hexadecimal and validating it for numeric check, but the code is giving problem.
The comp-3 field declaration is as follows
S9(9)V99 COMP-3
NUMB = OFFC
CALL PAK2DEC(NUMB)
IF ¬DATATYPE(RESULT,N)
THEN DSN = 'AMOUNT NOT VALID'
IF (RESULT = -NUMB)
THEN DSN = 'AMOUNT is NEGATIVE'
EXIT
PAK2DEC:
/* CONVERT PACKED DATA TO HEX AND SPLIT */
ERG = C2X(NUMB)
SIGN = RIGHT(ERG,1)
NUMB = LEFT(ERG,LENGTH(ERG)-1)
/* CHECK SIGN AND NUMERIC SECTIONS */
IF VERIFY(SIGN, "ABCDEF" ) > 0 THEN ,
RETURN ""
IF VERIFY( NUMB, "0123456789" ) > 0 THEN ,
RETURN ""
/* CHECK NEGATIVE SIGN */
IF POS(SIGN, "BD" ) > 0 THEN,
RETURN -NUMB
ELSE ,
RETURN NUMB
I am getting one error as below
Bad arithmetic conversion