convertion ASCII Character in Decimal Value

It is possible to convert ASCII Character in Decimal Value using natural v 6.3.3 on open system?
Anybody can help me?
Thanks :slight_smile:

I am not quite sure what your exact need is; but you should probably be looking at the EXAMINE statement. In particular, EXAMINE TRANSLATE with a user supplied table might be appropriate. If it is one character in particular that you wish to convert you could just EXAMINE for that character and REPLACE with the required character.

steve

Hy Steve, thanks …
but i need to examine a string of characters and to obtain for each one the corresponding decimal value.
All this to calculate (with a particular algorithm) a cesksum of all string
By
Mauro

Let Natural perform the calculation. Pass your string to USR4011N and it will return a hash value.

If I understand your question, I think you just need to redefine your character as a B1 field:

DEFINE DATA LOCAL
1 MY-STRING (A20)
1 REDEFINE MY-STRING
  2 CHAR-VALUEB (B1/1:20)
1 CHAR-VALUE (N3)
1 INDEX (I4)
END-DEFINE
MOVE 'My string' TO MY-STRING
FOR INDEX = 1 TO 20
  MOVE CHAR-VALUEB(INDEX) TO CHAR-VALUE
  WRITE CHAR-VALUE
END-FOR
END

On the mainframe (EBCDIC) this outputs:

Page 1 12/02/08 15:11:17

212
168
64
162
163
153
137
149
135
64
64
64
64
64
64
64
64
64
64
64