HP3000-L Archives

December 2006, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Robert Mills <[log in to unmask]>
Reply To:
Robert Mills <[log in to unmask]>
Date:
Tue, 5 Dec 2006 09:33:23 -0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (84 lines)
Eben,

Strings in PowerHouse are fixed length unlike VB where they are as long
(or short) as needed. The following untested code 'should' do what you
require. Choose the block you are most happy with.

----------

Define d-CITY Character *30 &
     = Left Justify(Right Justify(StringX)[1:27]) &
         If (Right Justify(StringX[29:2]) = StringY) And (Right
Justify(StringX[28:1]) = " ") &
  Else Left Justify(StringX)

----------

Define d-StringX Character *30 &
     = Right Justify(StringX)

Define d-CITY Character *30 &
     = Left Justify(d-StringX[1:27]) &
         If (d-StringX[29:2] = StringY) And (d-StringX[28:1] = " ") &
  Else Left Justify(StringX)

----------

If you are going to be doing more with PowerHouse then I suggest you
visit http://lists.sowder.com/mailman/listinfo/powerh-l

regards, 
  
Robert W.Mills 
Systems Development Manager 
Pinnacle Arvato 
(020) 8309 3604 


-----Original Message-----
From: HP-3000 Systems Discussion [mailto:[log in to unmask]] On
Behalf Of Eben Yong
Sent: 05 December 2006 04:50
To: [log in to unmask]
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 *

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2