We used the following code to read the number. I think it's for the same
comp-3 format - but you will have to verify and update the code to
output the number rather than import it.

Hth
Colin Alfke
Calgary, Canada

SUBROUTINE CONVERT.AMOUNT(STRING)
 STR.LEN = LEN(STRING)
NUMBER = ''
NEGATIVE = 0
BYTE = STRING[STR.LEN,1]
BEGIN CASE
 CASE BYTE = '}'
   LAST.DIGIT = 0
   NEGATIVE = 1
 CASE BYTE = 'J'
   LAST.DIGIT = 1
   NEGATIVE = 1
 CASE BYTE = 'K'
   LAST.DIGIT = 2
   NEGATIVE = 1
 CASE BYTE = 'L'
   LAST.DIGIT = 3
   NEGATIVE = 1
 CASE BYTE = 'M'
   LAST.DIGIT = 4
   NEGATIVE = 1
 CASE BYTE = 'N'
   LAST.DIGIT = 5
   NEGATIVE = 1
 CASE BYTE = 'O'
   LAST.DIGIT = 6
   NEGATIVE = 1
 CASE BYTE = 'P'
   LAST.DIGIT = 7
   NEGATIVE = 1
 CASE BYTE = 'Q'
   LAST.DIGIT = 8
   NEGATIVE = 1
 CASE BYTE = 'R'
   LAST.DIGIT = 9
   NEGATIVE = 1
 CASE 1
   LAST.DIGIT = BYTE
 END CASE
NUMBER = STRING[1,STR.LEN - 1]:LAST.DIGIT
NUMBER = NUMBER + 0
IF NEGATIVE THEN
 NUMBER = 0 - NUMBER
END
STRING = NUMBER
RETURN 

>-----Original Message-----
>From: Coelho, Gregory
>
>EEEK! Hummm, Is there anyone that can help me with number 
>conversion? I need to convert a negative monetary amount 
>pulled in by FMT(OCONV(X.AMOUNT, "MD"), "8\0R") to meet 
>S9(6)V99 or Z8.2 format.
>COBOL programmers may recognize this comp-3 format - padded 
>with leading zeros the right most character must use an EBCDIC 
>symbol to reflect a negative amount:} = 0, J = neg. 1, K = 
>neg. 2, L = neg. 3 ... R = neg.
>9. Any help or direction would be greatly appreciated.
>
>Thanks Gordon...
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to