PxPlus User Forum
Main Board => Discussions => Language => Topic started by: Jeffrey Ferreira on August 03, 2023, 12:07:07 PM
-
Hi List,
i was about to embark on a project for a client and i figured i better confirm the following before i begin.
we have an index -> The Customer's PO Number
sometimes it comes in Mixed Case .......
my question is -> are Keys always case sensitive...
i'm pretty sure the answer is yes but i dont want to start this workaround unless i'm 100% sure....i just want to make sure there is no cool feature in pxplus that i'm unaware of
thanks
jeff
-
Never mind. I just realized something. Even if there was a feature that forced the key to uppercase (while data remained mixed), I would still have to change all my code to force what i'm reading with to uppercase. Please disregard...sorry
-
You could probably use I/O logic on the data file to read using uppercase. Then, you wouldn't need to change all of the reads in various programs.
-
When you define keys for a file, you can define options for individual segments, such as case sensitivity. So if you define a key segment as uppercase, the key value will be uppercase but the field within the data would still be mixed when you read the data in the record. You could get the uppercase value using KEC(chan,kno), or by using UCS() on the field.
-
I forgot to mention, if a key segment is defined as uppercase, for example, you can use a mixed case key value when reading by key and it will still find it,
-
Hi Jane,
That is really interesting:
"if a key segment is defined as uppercase, for example, you can use a mixed case key value when reading by key and it will still find it"
Thank you. I will chat with some folks at our office.
jeff
-
As a follow up --- When we store records on a keyed file the system builds a table of keys with pointers to the actual record. The key table consists of the key field(s) extracted from the record data, so when you declare that a key is Uppercase (or Lowercase / Accented) the actual key value stored in the table is converted but not value in the record itself.
This holds true for numeric fields where we extract the numeric value from the record and convert it into an internal representation such that the lowest negative numbers occur first followed by zero and then the positive numbers.