Rick
Actually I had a typo, my stirng will ALWAYS be
Cleveland, OH 44041. (space between comma and state)
And when I use the code above it tells me that;
Entry 2 is out of Range and OHIO is acutally where the zip should be and state is blank. Is it because of the space before the sate?
Now each piece of information is separated by a space so you can do:
assign City = entry(1,vstring," ")
State = entry(2,vstring," ")
Zip = entry(3,vstring," ").
The other would be to use the spaces for State and Zip like this:
assign City = entry(1,vstring,",")
State = entry(1,ENTRY(2,vstring," ")," ")
zip = entry(3,vstring," ").
For State I changed vstring,"," to vstring," " and for Zip I told it to use the 3rd entry, not the 2nd.
Both ways work equally well. Which one to use? Personal preference. I would validate vstring before doing the assign to make sure the data is where I expect it. If it isn't (like there isn't a space after the comma), then I would output that string to an error log along with what the error was. Hopefully there would be very few errors, I could manually fix them, and reload them.
Depends on what you are trying to do. MATCHES will tell you if that character/string is in the string - returns true or false. INDEX will find the first occurance of that character in the string and tell you what position it is.
Say you have a string that's "Fred&Barney" and you want to find the "&".
disp vString MATCHES("*&*") will return a TRUE.
disp INDEX(vString,"&") will return 5, meaning the "&" is the 5th character in that string.
If you have more than one "&" in the file, you'll have to do some more processing. Something like this should work:
DEF VAR vString AS CHAR NO-UNDO INIT "Fred&Barney&Wilma&Betty".
DEF VAR i AS INT NO-UNDO.
DO i = 1 TO 100:
IF INDEX(vString,"&",i) EQ 0 THEN LEAVE.
DISP INDEX(vString,"&",i)
SUBSTR(vString,INDEX(vString,"&",i),30) FORMAT "x(30)"
WITH DOWN STREAM-IO.
DOWN.
i = INDEX(vString,"&",i).
END.
There are many other ways to do this too, like a do loop checking each character. Just depends on what you want to do.
Actually I want to replace it with a space. One of our Java programs is brining in text with html codes. Like AB&C Company comes in like "AB& C Company".
Rich
can I ask you a question off this subject line?
We have 2 db's; one is for trainging and the other is the live db. I am running a progress procedure through the Windows task manager (so it is unknown to the users that it is running). My problem is that I dont know how to tell it to run for a certain db. Right now the target for my task is:
C:\dlc91ddb\bin\prowin32.exe -p run listener.p -pf L:\ts53\takestok.pf -pf L:\ts53\connect.pf -T L:\ts53\Temp -ininame "Software\Software Solutions, Inc.\TakeStock\5.3\Progress91d" -param Version=5.3
What I would like to do is have two of them; one for the training db (for testing purposes) and one for the live db.
Are your database connection parameters in L:\ts53\connect.pf ? If so, you could make a copy of this file (let's call it connecttest.pf), change the db params in there and set up a separate task.
If you're connecting to the database using a CONNECT statement in listener.p, then you could extend the -param parameter to something like -param Version=5.3,db=test and again set up a separate task. Of course, you'd have to tweak listener.p to parse the param but that's pretty straightforward with a bit of list processing.
We have many different databases (training, test, live, long term testing) and have a .pf for each database. As Mike said, just copy your .pf to a new name, change the database connection in there and use that one for your other connection.
Everything seems to be working, except for my pathing. I dont think my propath is being set anywhere, so my calls are failing (ie.. run custom/xmlquery.p). How can I get my propath set???
I am using the L:\ts53\connect.pf to connect to the db:
connect.pf
# This is the database connection parameter file.
-db domdata -H ts1 -S domdb -N TCP
takestock.pf
The L:\ts53\takestock.pf contains my other params:
# This is the parameter file under Progress 9.1.
-inp 8192
-h 6
-rand 2
-yy 1940
-mmax 16000
-D 100
-k "\\ts1\L_Drive\ts53\kwforget.lst"
-stsh 5
-dictexps
-tok 1600
-s 128
-cpstream ibm850
-nb 255
-pls
You may want to make a copy of your .ini file, rename it, and edit the propath in there. Then just adjust your call to suit.
Also, if you're running in a Windoze environment you'll want to prefix the -ininame parameter with -basekey INI to ensure that environment info is collected from the .ini file rather than from the registry.
Returning to the original question and replies: the elimination of the comma and reliance on the space alone as a delimiter is a mistake. Many city names comprise more than one word: any of these will break your scheme.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.