On Thu, 31 Jan 2002 21:02:28 -0600, Craig L Solomon <[log in to unmask]>
wrote:
>Speedware Question…
>
>A friend of mine is working on a project using an older version of
>Speedware 5.x (reactor) and needs to pull name information out of a
>database on the e3000.
>
>The name is stored in a single field as follows
>
>Public/John Q
>
>However the customer wants it to be reported back to them as: John Q.
>Public, but here is the twist, they want fixed fields
>
>1 2 3 4 5 6 7 8 9 10 |11 12 13 14 15 16 17 18 19 20 21 22 |23
>
>Locations 1-10 = 1st Name
>Locations 11-22 = Last Name
>Location 23 = Middle Initial.
>
>Any help would be appreciated!
>
>Please email me at [log in to unmask] or post back to the forum!
>
>Cordially,
>
>Craig S.
Craig,
The code I posted Saturday was taken from one of my first Reactor programs.
It works, but in the cool florescent light of Monday morning, I realize that
it doesn't need to be so complicated. Have your customer try something like
this:
COMPUTE-PARSE-NAME: ;
(* *************************************************************** *)
(* This subroutine parses the Spectrum format name contained *)
(* in #NAME into separate first name, middle initial and last *)
(* name fields in #FNAM, #MI and #LNAM. It uses the temporary *)
(* variables #I, #XNAM, and #STR. *)
(* *************************************************************** *)
BEGIN
CALCUL #NAME CLE = #XNAM, " " = #FNAM = #MI = #LNAM;
IF #XNAM[1-1] = " " THEN CALCUL
#XNAM[2-30] + " " = #XNAM;
(* Extract the last name - *)
(* Take everything left of the '/' (up to 20 characters max) *)
CALCUL 1 = #I, " " = #STR;
WHILE #I <= 30 AND #XNAM[1-1] <> "/" DO
BEGIN
CALCUL #STR[2-30] + #XNAM[1-1] = #STR;
CALCUL #XNAM[2-30] + " " = #XNAM;
CALCUL #I + 1 = #I;
END;
CALCUL #STR CLE = #STR;
IF #STR[1-1] = " " THEN CALCUL
#STR[2-30] + " " = #STR;
CALCUL #STR = #LNAM;
(* Blank the first '/' (if any) and get the MI & FNAM *)
IF #XNAM[1-1] = "/" THEN
BEGIN
CALCUL " " = #XNAM[1-1];
CALCUL #XNAM RJU = #STR;
IF #STR[29-1] = " " THEN CALCUL
#STR[30-1] = #MI, " " = #STR[30-1];
CALCUL #STR CLN = #XNAM;
CALCUL #XNAM[2-30] = #FNAM;
END;
END;
EXIT;
If you need any clarification, contact me at work.
Tom Root
Desert Schools Federal Credit Union
Phoenix, AZ
602-433-7152
[log in to unmask]
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|