Previous Thread
Next Thread
Print Thread
Need a global Replace String1 to String2 #26407 17 Dec 11 12:28 PM
Joined: Nov 2001
Posts: 154
G
Gary Guilbert Offline OP
Member
OP Offline
Member
G
Joined: Nov 2001
Posts: 154
In moving off of my AM I am trying to compil
some accounting software. I got a big error,
in that ERRMSG is predefined. In my system includes of mapped variables I have used ERRMSG. Basic + also uses it.

I could ask Jack to change his
software but the cost of cerveza that I would be
billed, would break me.

So does someone have a utility program that
I can run on 250 programs where I can replace
ERRMSG with ERR'NOTJACKS'MSG or a similar named
variable?

thank you in advance,
Gary in the Heart of Texas

Re: Need a global Replace String1 to String2 #26408 17 Dec 11 01:42 PM
Joined: Jul 2001
Posts: 453
J
Joe Leibel Offline
Member
Offline
Member
J
Joined: Jul 2001
Posts: 453
I might not be fully understanding but I think there my be a simpler solution. Add a line like this to the MIAME.INI then go out and back into Ashell..

;Subroutine aliases (alias-name:ashell-name)
ALIAS=ERRMSG:MYMESS

From then on any xcall to ERRMSG would call MYMESS instead.

Re: Need a global Replace String1 to String2 #26409 17 Dec 11 02:21 PM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
The problem is that the compiler treats ERRMSG as a reserved word when in /X:1+ mode, because of the function ERRMSG(x) which displays the message associated with error x.

While this is consistent with BasicPLUS, I suppose you could make an argument that the compiler ought to allow ERRMSG as a scalar variable, since in general, the variables A and A() are distinct.

On the other hand, if you are only using it in an include file, then shouldn't it be easy to change? Assuming you compile with /M, any stragglers would be picked up as compile errors and thus easily fixed individually. But I'll admit that wouldn't be so convenient if you have thousands of them scattered all over.

As for a global search/replace mechanism, that would be handy, and there are various ways to do with with UNIX shell scripts, but given that you were the one who wrote the SBCSCH (global search) utility, wouldn't it be easy enough to modify it to replace?

Re: Need a global Replace String1 to String2 #26410 17 Dec 11 03:14 PM
Joined: Nov 2001
Posts: 154
G
Gary Guilbert Offline OP
Member
OP Offline
Member
G
Joined: Nov 2001
Posts: 154
Joe and Jack,
The problem is that Basic+ uses ERRMSG()
and my old code has: MAP1 ERRMSG,S,50
In my code I fill ERRMSG=str....literal or tbl(i)
then I CALL SHOW'ERRMSG to log the error and
display on the screen. So yes the variable I use
is scattered over 250+ progs. not just include stuff.

I was hoping that by now some hot shot would
have taken SBCSCH and added boolean for the search strings and optional folding for case.

I'll wait a few days and hope someone sends me
a Christmas gift. If not I can look at SBCSCH to
see what it need for search with replacement.

Re: Need a global Replace String1 to String2 #26411 19 Dec 11 10:44 AM
A
Anonymous
Unregistered
Anonymous
Unregistered
A
Gary, let me know if you still need a program for this. I have an old one that will make a directory of .bas's in an account, then read the .bas's find a match and replace it.

I have some standard include's that I could probably yank into the program and get it to compile standalone.

Send me an email addres if so. Or send me an email at kenb@kilands.com and I will send the program.

Ken

Re: Need a global Replace String1 to String2 #26412 19 Dec 11 11:31 AM
Joined: Nov 2001
Posts: 154
G
Gary Guilbert Offline OP
Member
OP Offline
Member
G
Joined: Nov 2001
Posts: 154
Ken,

I just got a program from Steven Shatz in NY.
His, I believe does the same thing. I'll look at
his and if it will require too much then I'll get
back on your offer.


Gary

Re: Need a global Replace String1 to String2 #26413 19 Dec 11 01:08 PM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
I know this comes too late to help most of the people affected by this problem, but after running into this issue twice in the last week, I decided to squeeze in another patch so as to remove another known stumbling block to upgrading to 6.0 and taking full advantage of all the new compiler features. 6.0.1241.7 (compiler edit 499) now allows the following previously-reserved words as scalar (non-array) variable names:

EDIT, EDIT$
ERRMSG
FILL, FILL$
PAD, PAD$
STRIP, STRIP$
XFUNC, XFUNC$

(Apologies to those who have had to create work-arounds.)

Unfortunately this fix doesn't remove all the issues with reserved words. Those that are not functions (e.g. CASE, SWITCH, REPEAT, EXIT, etc.) cannot so easily be distinguished from variables and thus remain off limits.

Re: Need a global Replace String1 to String2 #26414 19 Dec 11 05:06 PM
Joined: Nov 2001
Posts: 154
G
Gary Guilbert Offline OP
Member
OP Offline
Member
G
Joined: Nov 2001
Posts: 154
Hah,

For once FINALLY Jack owes me the beer and I can
make marks on my wall of the cases owed.

Wahoo, yippee, huzzah.

Gary

ps I'll think up another problem for tomorrow.

Re: Need a global Replace String1 to String2 #26415 10 Jan 12 03:45 PM
A
Anonymous
Unregistered
Anonymous
Unregistered
A
In AIX, UNIX or LINUX I use the 'tr' commaand.
First BACK-UP your programs but of coarse you have done that. smile


The tr utility copies the given input to produced the output with substitution or deletion of selected characters. tr abbreviated as translate or transliterate. It takes as parameters two sets of characters, and replaces occurrences of the characters in the first set with the corresponding elements from the other set i.e. it is used to translate characters.

It is commonly used in shell scripts and other application.

man tr ---- for help or google.

Google is my friend.

Re: Need a global Replace String1 to String2 #26416 10 Jan 12 04:07 PM
A
Anonymous
Unregistered
Anonymous
Unregistered
A
I know this is a month later.
But I wondered why 'tr' wasn't mentioned.

In AIX, UNIX or LINUX I use the 'tr' commaand.
First BACK-UP your programs but of coarse you have done that. smile
TR changes the files in place.
Also I write a shell script that loops and feeds multiple file names to 'tr'.
I usually hard code the replacement "before" & "after" for simplicity.

=================

The tr utility copies the given input to produced the output with substitution or deletion of selected characters. tr abbreviated as translate or transliterate. It takes as parameters two sets of characters, and replaces occurrences of the characters in the first set with the corresponding elements from the other set i.e. it is used to translate characters.

It is commonly used in shell scripts and other application.

Re: Need a global Replace String1 to String2 #26417 11 Jan 12 03:43 PM
Joined: Nov 2001
Posts: 154
G
Gary Guilbert Offline OP
Member
OP Offline
Member
G
Joined: Nov 2001
Posts: 154
Good idea. I'm on a Windoze network. I would need to set up a Linux system.


Moderated by  Jack McGregor, Ty Griffin 

Powered by UBB.threads™ PHP Forum Software 7.7.3