Conversion to ADS ideas

Xbase++ 2.0 Build 554 or later
Post Reply
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Conversion to ADS ideas

#1 Post by rdonnay »

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?
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: Conversion to ADS ideas

#2 Post by Auge_Ohr »

hi,

what about

Code: Select all

#xtranslate LongName => ShortName

Code: Select all

USE INSPECTIONAGGREGATE VIA (AdsSession()) ALIAS 'INSPECTION'
INSPECTIONAGGREGATE->(dbGoTop()) 
isn't it

Code: Select all

INSPECTION->(dbGoTop())
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Conversion to ADS ideas

#3 Post by rdonnay »

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 eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: Conversion to ADS ideas

#4 Post by Auge_Ohr »

next try ... it is the line with USE

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
now

Code: Select all

INSPECTIONAGGREGATE->(dbGoTop())
should work like before ... if it is not Empty()
greetings by OHR
Jimmy

User avatar
Tom
Posts: 1165
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Conversion to ADS ideas

#5 Post by Tom »

Code: Select all

INSPECTIONAGGREGATE->(dbGoTop())
This fails if INSPECTIONAGGREGATE is a var. It must be:

Code: Select all

(INSPECTIONAGGREGATE)->(dbGoTop())
I doubt this can be done with an automatism.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Piotr D
Posts: 129
Joined: Mon Jul 28, 2014 1:26 am
Location: Poznań, Poland

Re: Conversion to ADS ideas

#6 Post by Piotr D »

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

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: Conversion to ADS ideas

#7 Post by Auge_Ohr »

Tom wrote:This fails if INSPECTIONAGGREGATE is a var. It must be:

Code: Select all

(INSPECTIONAGGREGATE)->(dbGoTop())
you are right it must be a Macro.

never-less it is easy to load all Files into Editor and Search/Replace those ALIAS with &

Code: Select all

&cLongAliasName->( DbGotop() )
i prefer & so i can see it is a Macro
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Conversion to ADS ideas

#8 Post by rdonnay »

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.
The eXpress train is coming - and it has more cars.

Post Reply