function str_ebc2asc, in, qstop=qstop, str=str ; ;+ ;NAME: ; str_ebc2asc ;PURPOSE: ; To convert a string from EBCDIC to ASCII ;INPUT: ; in - Input string (or byte array) ;OUTPUT: ; RETURNS - The byte array equivalent in EBCDIC of the ; input. If the "str" keyword is used, the ; output is converted to a string variable ;OPTIONAL INPUT: ; qstop - Stop the routine at the end (for debugging) ; str - If set, the value returned is converted to ; a string. ;HISTORY: ; Written Oct-91 by M.Morrison ;- ; ; EBCDIC = ref2( ASCII ) ; ASCII = ref( EBCDIC ) ; ;Convert from EBCDIC to ASCII ; ref = [ 0, 1, 2, 3, 92, 9, 92,127, 92, 92, 92, 11, 12, 13, 14, 15, $ 16, 17, 18, 19, 92, 92, 8, 92, 24, 25, 92, 92, 28, 29, 30, 31, $ 92, 92, 92, 92, 92, 10, 23, 27, 92, 92, 92, 92, 92, 5, 6, 7, $ 92, 92, 22, 92, 92, 92, 92, 4, 92, 92, 92, 92, 20, 21, 92, 26, $ 32, 92, 92, 92, 92, 92, 92, 92, 92, 92, 91, 46, 60, 40, 43, 33] ref = [ref, $ 38, 92, 92, 92, 92, 92, 92, 92, 92, 92, 93, 36, 42, 41, 59, 94, $ 45, 47, 92, 92, 92, 92, 92, 92, 92, 92,124, 44, 37, 95, 62, 63, $ 92, 92, 92, 92, 92, 92, 92, 92, 92, 96, 58, 35, 64, 39, 61, 34] ref = [ref, $ 92, 97, 98, 99,100,101,102,103,104,105, 92, 92, 92, 92, 92, 92, $ 92,106,107,108,109,110,111,112,113,114, 92, 92, 92, 92, 92, 92, $ 92,126,115,116,117,118,119,120,121,122, 92, 92, 92, 92, 92, 92, $ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, $ 123, 65, 66, 67, 68, 69, 70, 71, 72, 73, 92, 92, 92, 92, 92, 92] ref = [ref, $ 125, 74, 75, 76, 77, 78, 79, 80, 81, 82, 92, 92, 92, 92, 92, 92, $ 92, 92, 83, 84, 85, 86, 87, 88, 89, 90, 92, 92, 92, 92, 92, 92, $ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 92, 92, 92, 92, 92,255] ref2 = [0, 1, 2, 3, 55, 45, 46, 47, 22, 5, 37, 11, 12, 13, 14, 15, $ 16, 17, 18, 19, 60, 61, 50, 38, 24, 25, 63, 39, 28, 29, 30, 31, $ 64, 79,127,123, 91,108, 80,125, 77, 93, 92, 78,107, 96, 75, 97, $ 240,241,242,243,244,245,246,247,248,249,122, 94, 76,126,110,111, $ 124,193,194,195,196,197,198,199,200,201,209,210,211,212,213,214] ref2 = [ref2, $ 215,216,217,226,227,228,229,230,231,232,233, 74,224, 90, 95,109, $ 121,129,130,131,132,133,134,135,136,137,145,146,147,148,149,150, $ 151,152,153,162,163,164,165,166,167,168,169,192,106,208,161, 7] ref2 = [ref2, $ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, $ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, $ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, $ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, $ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63] ref2 = [ref2, $ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, $ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, $ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,255] ; b = byte(in) ;make sure converted to byte type out = ref(b) out = byte(out) if (keyword_set(str)) then out = string(out) ; if (keyword_set(qstop)) then stop return, out end