character value
shulbert@littlejohnfrazer.com
shulbert@littlejohnfrazer.com
Thu, 25 Jul 2002 10:02:06 +0100
you have to redefine a character item as an integer.
you can do this in the dictionary (see the pdl documentation: "redefined by") but you can also use subfiles. as long as the length is the same PH doesn't care what record layout you append.
as an example:
first define a one byte subfile record:
cancel clear
def a integer unsigned size 1 = 0
set sub
rep sum a
go
then append to this the character value:
cancel clear
def b cha = "A"
set sub append
rep sum b
go
this should give you the ASCII value on the second record.
this has only been tested on AIX and SCO but i think the logic will work elsewhere.
on systems that have a two byte minimum, both the items should be size 2, and quiz will append a space to the character item. so to remove the value of the space (ASCII 32) you have to either subtract 32 and divide by 256, or subtract 8192 depending on whether the first bit is most or least significant.
regards,
stephen.
-----Original Message-----
From: bcomeau@crossley.ca [mailto:bcomeau@crossley.ca] Sent: Wednesday, July 24, 2002 7:08 PM
To: powerh-l@lists.swau.edu
Subject: character value
Does anyone know of a way in quiz to get the ASCII value of a single character returned as a number?
I know how to get from a displayable character from an integer, I need to go the other way.
For instance if a variable contains the letter "A" I would like to be able to that converted to the number 65.
Bob Comeau
Systems Programmer Analyst
Crossley Carpet Mills Ltd.
(902)895-5491 ex 139
= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l@lists.swau.edu
Subscribe: "subscribe" in message body to powerh-l-request@lists.swau.edu
Unsubscribe: "unsubscribe" in message body to powerh-l-request@lists.swau.edu
http://lists.swau.edu/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.
The information contained in this communication is confidential and may
be legally privileged. It is intended solely for the use of the
individual or entity to whom it is addressed and others authorised to
receive it. If you are not the intended recipient you are hereby
notified that any disclosure, copying, distribution or taking of any
action in reliance on the contents of this information is strictly
prohibited and may be unlawful.
Littlejohn Frazer reserves the right to monitor the content of any
message sent to or from littlejohnfrazer.com and its associate domains,
fmi-litjon.co.uk and litjon.co.uk
A list of partners may be inspected at 1 Park Place, Canary Wharf,
London, E14 4HJ
Registered to carry on audit work by the Institute of Chartered
Accountants in England & Wales, and authorised by the Financial
Services Authority to provide financial services