Not too difficult.
> can cle
> def d char*30= parm prompt 'String:'
> def dd char*30 = pack(trunc(d))
> def d1 = index(dd,' ')
> def d2 = 1 if d1 < 30 and ' ' <> dd[d1+1:2] else 0
> def d3 char*30 = dd if d2 = 0 else dd[1:d1]
> set rep spa 0 pag len 0
> set pag len 0 wid 256 rep lim 20000
> rep all
> go
String: SACRAMENTO CA
05 DEC 2006 MILAN ABS
DICTIONARY PAGE
1
D DD D1 D2
D3
SACRAMENTO CA SACRAMENTO CA 11
1SACRAMENTO
Records selected: 0
Lines printed: 3
Pages printed: 1
> go
String:SACRAMENTO
05 DEC 2006 MILAN ABS
DICTIONARY PAGE
1
D DD D1 D2
D3
SACRAMENTO SACRAMENTO 11
0SACRAMENTO
Records selected: 0
Lines printed: 3
Pages printed: 1
>
Internet
[log in to unmask]@RAVEN.UTC.EDU - 05/12/2006 05:49
Please respond to [log in to unmask]
Sent by: [log in to unmask]
To: HP3000-L
cc:
Subject: [HP3000-L] quiz - how-to question
Is there a way, in Quiz, given String X, length 30, and String Y, length
2, to
do the following?
1. remove spaces from both left and right side of string X
2. check to see if the last 2 characters of the result from #1 match
String Y
3. check to see if the 3rd to the last character of the result from #1
equals
SPACE
4. if #2 and #3 are true then assign String Z to the portion of the
result from
#1, less 3 characters
In Visual Basic, the code would go something like this:
if right(trim(X),2)=Y and mid(trim(X),len(trim(X))-2,1)=" " then
Z=left(trim
(X),len(trim(X))-3)
The business objective is to split a string which *might* have the state
code
embedded into the city field such that we isolate the string value
representing
the city (e.g., SACRAMENTO CA transforms to SACRAMENTO; or BUFFALO NY
transforms to BUFFALO). So, from the above example, String X contains the
CITY and (maybe) the STATE code. String Y = the STATE code. We wish to
extract String Z (the CITY value).
I've dumped the data to MS ACCESS and achieved the desired results using
MS Access SQL, and am interested in performing the actions on the HP3000.
Any takers? :-)
As always, thanks to the MPE gurus out there.
-Eben Yong
[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 *
This message and any attachments (the "message") is
intended solely for the addressees and is confidential.
If you receive this message in error, please delete it and
immediately notify the sender. Any use not in accord with
its purpose, any dissemination or disclosure, either whole
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message.
BNP PARIBAS (and its subsidiaries) shall (will) not
therefore be liable for the message if modified.
---------------------------------------------
Ce message et toutes les pieces jointes (ci-apres le
"message") sont etablis a l'intention exclusive de ses
destinataires et sont confidentiels. Si vous recevez ce
message par erreur, merci de le detruire et d'en avertir
immediatement l'expediteur. Toute utilisation de ce
message non conforme a sa destination, toute diffusion
ou toute publication, totale ou partielle, est interdite, sauf
autorisation expresse. L'internet ne permettant pas
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce
message, dans l'hypothese ou il aurait ete modifie.
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|