Mann_B wrote:I tried giving like this
AMOUNT = (C2X(SUBSTR(REC1.RECID,POS2,8)))
but am getting an error saying Incorrect call...
here REC1.RECID,POS2,8--ths is a comp-3 var...
I would check that POS2 and RECID have valid values; TRACE the logic if necessary.
C2X will give you the hexadecimal string representing the characters;
i.e., if your packed decimal (COMP-3 in COBOLese, which should be avoided unless actually referring to COBOL) data are X'000000000000123C', (C2X(SUBSTR(REC1.RECID,POS2,8))) will return "000000000000123C". This will be treated as a character string in Rexx, and if used in a computational statement will cause the error noted in your first post.
There is no direct conversion in native Rexx (although there
are conversion functions that can be purchased as add-ons). You'll need to write your own function, something like (untested code with all error checking omitted):
C2P: procedure
arg string pos len .
foo = c2x(substr(string,pos,len))
bar = substr(foo,1,(2*len)-1)
if (substr(foo,2*len)="D") then
bar = bar * -1
return bar
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day