Conversion to ADS ideas
Conversion to ADS ideas
I am helping a customer convert an application to Advantage Server. I have been through many of these conversion projects over the years but this one is giving me some difficulties that I have not encountered before.
In particular, the application uses databases of very long names (longer than 10 characters).
DBFCDX allowed aliases to be longer than 10 characters, but ADSDBE does not.
Obviously, I can open the database and assign an alias of 10 or less characters, but then a lot of code needs to be changed.
Example:
USE INSPECTIONAGGREGATE VIA (AdsSession()) ALIAS 'INSPECTION'
INSPECTIONAGGREGATE->(dbGoTop()) // this will now fail and must be changed.
This can affect hundreds of lines of code.
I'm trying to think of a strategy that would not require all those code changes.
The more that code is changed, the more likely of runtime errors.
Any ideas?
In particular, the application uses databases of very long names (longer than 10 characters).
DBFCDX allowed aliases to be longer than 10 characters, but ADSDBE does not.
Obviously, I can open the database and assign an alias of 10 or less characters, but then a lot of code needs to be changed.
Example:
USE INSPECTIONAGGREGATE VIA (AdsSession()) ALIAS 'INSPECTION'
INSPECTIONAGGREGATE->(dbGoTop()) // this will now fail and must be changed.
This can affect hundreds of lines of code.
I'm trying to think of a strategy that would not require all those code changes.
The more that code is changed, the more likely of runtime errors.
Any ideas?
The eXpress train is coming - and it has more cars.
Re: Conversion to ADS ideas
hi,
what about
what about
Code: Select all
#xtranslate LongName => ShortName
isn't itCode: Select all
USE INSPECTIONAGGREGATE VIA (AdsSession()) ALIAS 'INSPECTION' INSPECTIONAGGREGATE->(dbGoTop())
Code: Select all
INSPECTION->(dbGoTop())
greetings by OHR
Jimmy
Jimmy
Re: Conversion to ADS ideas
I thought about that, but looking at their code, it would be difficult.
The problem is that they are not consistent in the case of the alias. Some are upper case, some are lower case, some are possibly even mixed case. Some are in quotes and passed to other functions.
The problem is that they are not consistent in the case of the alias. Some are upper case, some are lower case, some are possibly even mixed case. Some are in quotes and passed to other functions.
The eXpress train is coming - and it has more cars.
Re: Conversion to ADS ideas
next try ... it is the line with USE
now
should work like before ... if it is not Empty()
Code: Select all
LOCAL INSPECTIONAGGREGATE := NetUse("INSPECTIONAGGREGATE",AdsSession(),"INSPECTION")
FUNCTION NetUse(cDBF,cVIA,cAlias)
BEGIN SEQUENCE
USE (cDBF) VIA (cVIA) ALIAS (cAlias)
IF NetErr()
...
cAlias := ""
ENDIF
RECOVER
cAlias := ""
END SEQUENCE
RETURN cAlias
Code: Select all
INSPECTIONAGGREGATE->(dbGoTop())
greetings by OHR
Jimmy
Jimmy
Re: Conversion to ADS ideas
Code: Select all
INSPECTIONAGGREGATE->(dbGoTop())
Code: Select all
(INSPECTIONAGGREGATE)->(dbGoTop())
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: Conversion to ADS ideas
Roger,
here is an idea:
make three arrays:
- first with original names of databases
- second with temporary names
- third with new short names
Then make an program, which read all source (PRG). With every PRG first automatically change words from first array with words from second (temporary names) array, and than change word from second array with words (new names) from third array.
Regards,
Piotr
here is an idea:
make three arrays:
- first with original names of databases
- second with temporary names
- third with new short names
Then make an program, which read all source (PRG). With every PRG first automatically change words from first array with words from second (temporary names) array, and than change word from second array with words (new names) from third array.
Regards,
Piotr
Re: Conversion to ADS ideas
you are right it must be a Macro.Tom wrote:This fails if INSPECTIONAGGREGATE is a var. It must be:Code: Select all
(INSPECTIONAGGREGATE)->(dbGoTop())
never-less it is easy to load all Files into Editor and Search/Replace those ALIAS with &
Code: Select all
&cLongAliasName->( DbGotop() )
greetings by OHR
Jimmy
Jimmy
Re: Conversion to ADS ideas
Piotr -
I think your idea is the best idea.
I have actually done this on projects in the past.
I wrote an Xbase++ program that rewrote the source code to change function names.
I sent an email to Alaska Software to ask if it was possible to trap any alias errors with the error handler and then recover them. They said that it is probably not possible.
I think your idea is the best idea.
I have actually done this on projects in the past.
I wrote an Xbase++ program that rewrote the source code to change function names.
I sent an email to Alaska Software to ask if it was possible to trap any alias errors with the error handler and then recover them. They said that it is probably not possible.
The eXpress train is coming - and it has more cars.