Inverse of CHAR function

Bob Comeau bcomeau@crossley.ca
Fri, 28 Jan 2000 11:30:36 -0400


A workaround for an HP3000 system (QUIZ):

> define input-ltr char*1 = parm prompt "Enter letter to convert:"
> define conv-ltr char*11 = "![ord('"+input-ltr+"')]"
> define do-function = 1 IF setsystemval("ordnum",conv-ltr)
> define ord-value = nconvert(getsystemval("ordnum"))
> report all
> go

Enter letter to convert:d

28 JAN 2000                CROSSLEY CARPET MILLS LTD.                  PAGE
1

  INPUT-LTR  CONV-LTR     DO-FUNCTION  ORD-VALUE

      d      ![ord('d')]          1         100


Records selected:  0
Lines printed:     3
Pages printed:     1

> go

Enter letter to convert:A

28 JAN 2000                CROSSLEY CARPET MILLS LTD.                  PAGE
1

  INPUT-LTR  CONV-LTR     DO-FUNCTION  ORD-VALUE

      A      ![ord('A')]          1          65

The main obstacle I can see in finding a inverse for the characters function
is that the characters function does not necessarilty operate on a single
byte.
I'm not sure what purpose the inverse would serve on a multi byte value.

Bob



-----Original Message-----
From: owner-powerh-l@sphere.swau.edu
[mailto:owner-powerh-l@sphere.swau.edu]On Behalf Of Deskin, Bob
Sent: Friday, January 28, 2000 7:33 AM
To: powerh-l@lists.swau.edu
Subject: RE: Inverse of CHAR function


I tell you, everyone asks for examples and when you provide them, people
want them to work and make sense too :-)

Actually this is a good point Chris. I'll forward this to the documentation
people for the next upgrade.

As for the reverse of CHARACTERS, I've been asking for this since the early
days, but it never seems to make the cut. It's still on the list.

Bob Deskin
PowerHouse Web Product Manager and Senior Product Advisor
Application Development Tools, Cognos Inc.
bob.deskin@cognos.com
(613) 738-1338 ext 4205  FAX: (613) 228-3149
3755 Riverside Drive P.O. Box 9707 Stn. T, Ottawa ON K1G 4K9 CANADA


-----Original Message-----
From: Chris Sharman [mailto:Chris.Sharman@ccagroup.co.uk]
Sent: January 28, 2000 3:51 AM
To: jlkeepers@mmm.com
Cc: Chris.Sharman@ccagroup.co.uk; powerh-l@lists.swau.edu
Subject: RE: Inverse of CHAR function



>Last question of the day:
>
>Does anyone know what function is the inverse of the CHAR function?  IE.
>function x("A")=65.

A fine question.
Don't use the CHARACTERS function as per the example in the docs:

define itemx char*20 = encrypt(characters(phone),"INDEX")

They carefully leave the recovery of 'phone' as an exercise for the reader,
and
a very challenging exercise it is too, since there is no inverse CHAR
function
available ...

Techniques available (all with limitations) are:

3GL call (from Quick).
INDEX function (ie INDEX("ABCDEFGHIJKLMNOPQRSTUVWXYZ",ch)+64 )
Redefinition in the dictionary.

Good luck,
Chris
_______________________________________________________________________
Chris.Sharman@CCAgroup.co.uk		http://www.ccastat.demon.co.uk/
CCA Stationery Ltd, Eastway, Fulwood, Preston, Lancashire, PR2 9WS.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.