|
Here is what I use for new line and carriage return: ** Hex Constants D#NL C x'0D' D#CR C x'25' Here is the translation code, too: I think I got most of this from the 'Who Knew....' book and source code. Chris from this list helped out a lot and I recently read that Scott Klement has a tutorial on sockets that includes ASCII/EBCDIC translations. Try http://klement.dstorm.net/rpg/socktut/. ** ASCII/EBCDIC conversion D#p_InBuff S * D#p_InBytes S * inz(%addr(#InBytes)) D#InBytes S 10I 0 D#p_OutBuff S * D#p_OutBytes S * inz(%addr(#OutBytes)) D#OutBytes S 10I 0 ** To ASCII Conversion DS D#ToAscii DS D #ICORV_A 1 4b 0 D #ICOC_A 5 52b 0 DIM(00012) ** To EBCDIC Conversion DS D#ToEbcdic DS D #ICORV_E 1 4b 0 D #ICOC_E 5 52b 0 DIM(00012) ** ASCII - US English Code Page - 813 D#p_Qascii S * inz(%addr(#Qascii)) D#Qascii DS 32 D #asciiCP 1 4b 0 inz(00813) D #asciiCA 5 8b 0 inz(0) D #asciiSA 9 12b 0 inz(0) D #asciiSS 13 16b 0 inz(1) d #asciiIL 17 20b 0 inz(0) d #asciiEO 21 24b 0 inz(1) d #asciiR 25 32a inz(*allx'00') ** EBCDIC - US English Code Page - 37 D#p_Qebcdic S * inz(%addr(#Qebcdic)) D#Qebcdic DS 32 D #ebcdicCP 1 4b 0 inz(00037) D #ebcdicCA 5 8b 0 inz(0) D #ebcdicSA 9 12b 0 inz(0) D #ebcdicSS 13 16b 0 inz(1) D #ebcdicIL 17 20b 0 inz(0) D #ebcdicEO 21 24b 0 inz(1) D #ebcdicR 25 32a inz(*allx'00') ** translate response to ASCII C eval #p_InBuff = %addr(#SocketData) + 2 C eval #p_OutBuff = #p_InBuff C eval #InBytes = %len(#SocketData) C eval #OutBytes = %len(#SocketData) C eval #RC = IConv(#ToAscii: C %addr(#p_InBuff): C #p_InBytes: C %addr(#p_OutBuff): C #p_OutBytes) ** translate response to EBCDIC C eval #p_InBuff = #BasePtr C eval #p_OutBuff = #BasePtr C eval #InBytes = #SockDtaPtr - #BasePtr C eval #OutBytes = #InBytes C eval #RC = IConv(#ToEBCDIC: C %addr(#p_InBuff): C #p_InBytes: C %addr(#p_OutBuff): C #p_OutBytes) ** setup code page conversion ebcdic - ascii c eval #ToAscii = IConvOpen(#p_Qascii: c #p_Qebcdic) ** setup code page conversion ascii - ebcdic c eval #ToEbcdic = IConvOpen(#p_Qebcdic: c #p_Qascii) HTH, Patrick Conner www.ConnecTown.com (828) 244-0822 "Smith, Nelson" <NSmith@lincare.c To: rpg400-l@midrange.com om> cc: Sent by: Subject: ASCII control codes rpg400-l-admin@mi drange.com 08/17/01 09:47 AM Please respond to rpg400-l I'm formatting a message text line in an RPG program that gets sent out as regular email through a called utility program. Does anyone know what the hex codes are for a carriage return and linefeed? Also, the utility I'm using to send email must translate my EBCDIC code to ASCII, so wouldn't I need to use hex codes that would get translated to the proper ASCII codes?
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.