Control characters
Posted in 1995
>I've posted before one article similar to this, but as no answer came
>by (except one sugestion concerning escapes, which didn't work) I'm
>reposting it with another 'look':
>Anyone know what datatype should have a column that is intended to
>store non-printable characters ?
>CHAR column's do not do it !
>I want to store characters like ^M (control-M or carriage return) and
>^J (control-J or linefeed) in a memo-type field like 'observations'.
>I want to use this in ESQL.
Will this do it for you?
main
define
cntrl_a,
cntrl_b,
# .
# .
# .
cntrl_y,
cntrl_z char(1),
type_char char(8),
input_tst char(1)
database regep
let cntrl_a = ascii(1)
let cntrl_b = ascii(2)
# .
# .
# .
let cntrl_y = ascii(25)
let cntrl_z = ascii(26)
insert into foo
values (cntrl_y)
select bar #foo.bar is defined as char(1)
into input_txt
from foo
case
when (input_txt = cntrl_a)
let type_char = "cntrl-a"
when (input_txt = cntrl_b)
let type_char = "cntrl-b"
# .
# .
# .
when (input_txt = cntrl_y)
let type_char = "cntrl-y"
when (input_txt = cntrl_z)
let type_char = "cntrl-z"
otherwise
let type_char = "not cntrl"
end case
display "Type of Char is: ", type_char
end main
|| ======= **** **T* ======= ||John Regep
|| **** **** ||Store Systems Developement
|| **** *R** ||Kmart Corporation
|| =========== ********* =========== ||3100 West Big Beaver
|| ***A* **** ||Troy, MI 48084
|| **** **** ||(810) 643-5078
||=============== *M** **** ===============||uunet!kmart!jregep