home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programming
/
powerprogramming1994.iso
/
progtool
/
clipper
/
nannws36.arc
/
EBCDIC2.PRG
next >
Wrap
Text File
|
1989-05-01
|
8KB
|
233 lines
* Program: EBCDIC2.prg
* Authors: Gerry Braganza and Diane Lask
* Version: Clipper Summer '87
*
* Copyright (c) 1989 Nantucket Corp. All Rights Reserved.
*
* Note(s): Initialize Extended Binary Coded Decimal Interchange
* Code (IBM's EBCDIC) table to corresponding American
* Standard Code for Information Interchange (ASCII) -
* ANSI X3.4.
PUBLIC EBCDIC
EBCDIC = CHR(0)+; && NULL: Space filler character.
CHR(1)+; && SCH : ^A Start of header.
CHR(2)+; && STX : ^B Start of text.
CHR(3)+; && ETX : ^C End of text.
' '+; && PF : No ASCII value.
CHR(9)+; && HT : ^I Horizontal tab.
' '+; && LC : No ASCII value.
CHR(127)+; && DEL : Delete.
' '+; && GE : No ASCII value.
' '+; && RLF : No ASCII value.
' '+; && SMM : No ASCII value.
CHR(11)+; && VT : ^K Vertical tab.
CHR(12)+; && FF : ^L Form Feed.
CHR(13)+; && CR : ^M Carriage return.
CHR(14)+; && SO : ^N Shift out.
CHR(15)+; && SI : ^O Shift in.
CHR(16)+; && DLE : ^P Data link escape.
CHR(17)+; && DC1 : ^Q Device control 1.
CHR(18)+; && DC2 : ^R Device control 2.
' '+; && TM : No ASCII value.
' '+; && RES : No ASCII value.
' '+; && NL : No ASCII value.
CHR(8)+; && BS : ^H Backspace.
' '+; && IL : No ASCII value.
' '+; && CAN : No ASCII value.
CHR(25)+; && EM : ^ Y End of medium.
' '+; && CC : No ASCII value.
' '+; && CU1 : No ASCII value.
' '+; && IFS : No ASCII value.
' '+; && IGS : No ASCII value.
' '+; && IRS : No ASCII value.
' '+; && IUS : No ASCII value.
' '+; && DS : No ASCII value.
' '+; && SOS : No ASCII value.
CHR(28)+; && FS : ^ \ File Separator.
' '+; && Reserved.
' '+; && BYP : No ASCII value.
CHR(10)+; && LF : ^J Line feed.
CHR(23)+; && ETB : ^W Up/down to line.
CHR(27)+; && ESC : Left Arr; end trans blo
' '+; && Reserved.
' '+; && Reserved.
' '+; && SM : No ASCII value.
' '+; && CU2 : No ASCII value.
' '+; && Reserved.
CHR(5)+; && ENQ : ^E Inquiry.
CHR(6)+; && ACK : ^F Acknowledgement.
CHR(7)+; && BEL : ^G Bell.
' '+; && Reserved.
' '+; && Reserved.
CHR(22)+; && SYN : ^V Synchronous idle.
' '+; && Reserved.
' '+; && PN : No ASCII value.
CHR(30)+; && RS : ^^ Record Separator.
' '+; && UC : No ASCII value.
CHR(4)+; && EOT : ^D End of trans.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && CU3
CHR(20)+; && DC4 : ^T Device control 4.
CHR(21)+; && NAK : ^U Negative acknow.
' '+; && Reserved.
CHR(26)+; && SUB : ^Z Substitute.
' '+; && SP : No ASCII value.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && (cent): No ASCII value.
CHR(46)+; && . : Period.
CHR(60)+; && < : Less than sign.
CHR(40)+; && ( : Opening parenthesis.
CHR(43)+; && + : Plus sign.
CHR(124)+; && | : Vertical line.
CHR(38)+; && & : Ampersand.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
CHR(33)+; && ! : Exclamation point.
CHR(36)+; && $ : Dollar sign.
CHR(42)+; && * : Asterisk.
CHR(41)+; && ) : Closing parenthesis.
CHR(59)+; && ; : Semicolon.
' '+; && : No ASCII value.
CHR(45)+; && - : Hyphen or minus sign.
CHR(47)+; && / : Slash.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
CHR(124)+; && | : Vertical line.
CHR(44)+; && , : Comma.
CHR(37)+; && % : Percent sign.
CHR(95)+; && _ : Underscore.
CHR(62)+; && > : Greater than sign.
CHR(63)+; && ? : Question mark.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
CHR(58)+; && : : Colon.
CHR(35)+; && # : Number sign.
CHR(64)+; && @ : At sign.
CHR(39)+; && ' : Apostrophe.
CHR(61)+; && = : Equal sign.
CHR(34)+; && " : Quotation mark.
' '+; && Reserved.
[abcdefghi]+; && Lower case characters.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
[jklmnopqr]+; && Lower case characters.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
CHR(126)+; && ~ : Tilde.
[stuvwxyz]+; && Lower case characters.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
CHR(123)+; && { : Opening brace.
[ABCDEFGHI]+; && Upper case characters.
' '+; && Reserved.
' '+; && Reserved.
' '+; && No ASCII value.
' '+; && Reserved.
' '+; && No ASCII value.
' '+; && Reserved.
CHR(125)+; && } : Closing brace.
[JKLMNOPQR]+; && Upper case characters.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
CHR(92)+; && \ : Backward slash.
' '+; && Reserved.
[STUVWXYZ]+; && Upper case characters.
' '+; && Reserved.
' '+; && Reserved.
' '+; && No ASCII value.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
[0123456789]+; && numerics
CHR(124)+; && | : Vertical line.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' '+; && Reserved.
' ' && EO : No ASCII value.
USE Test
* Message while indexing.
@ 23, 0 SAY "Indexing based on EBCDIC code..."
INDEX ON index_eb(name) TO ebindex
@ 23, 0
FUNCTION index_eb
PARAMETERS asc_string
PRIVATE i
FOR i = 1 TO LEN(asc_string)
asc_string = STUFF(asc_string, i, 1,;
CHR(AT(SUBSTR(asc_string, i, 1),EBCDIC)))
NEXT
RETURN(asc_string)