Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Solved migration issues: from PB9 to PB10.5

368 views
Skip to first unread message

Shridhar Kumar

unread,
May 10, 2006, 10:00:12 PM5/10/06
to
(This was earlier posted in April '06 via Google Groups. Thanks to Bruce
Armstrong for pointing out that my postings were not reaching Sybase
servers. I believe this posting could still be relevant to many users and am
reposting it.)

I migrated our PB 9 code to 10.5 recently. For the benefit of those who will
likewise be migrating to PB 10.5, I recount here my experiences during the
process (Since some of the workarounds I found are not explicitly mentioned
in the Sybase help files, it should save some of your time and
frustrations).

Our application source code was rebuilt successfully with no errors or
warnings in PB 10.5. It was only thereafter that my challenges came up.


1. Failing Database Queries: On running the newly rebuilt application,
nothing happened. On checking, I found that no rows were being returned from
the query to Oracle 8i database. In fact, no data could be
retrieved even in the PB 10.5 database painter. Instead, there was an error
message popping up: "Select Error: Decimal conversion error. Powerbuilder
supports only 18 decimal digits."


Solution: I checked the database profile settings and found a new option:
"Disable Unicode Support" which is unchecked by default. On checking this
option, and doing likewise in our application connection source code,
everything started running normal.


2. Failing External Function Calls: Our application was misbehaving since it
was failing some DLL API function calls.


Solution: During my investigation, I found that the PB 10.5 migration had
modified some global external functional declarations with an "Alias for
'APIFunctionName;ansi'" added at the end of the function declarations. The
PB 10.5 help file mentions this requirement whenever there are strings being
passed as parameters.


However, the PB 10.5 migration had only altered the global declarations but
not any local external function declarations. I took the safe approach and
added this "Alias for 'xxx;ansi'" to all external functional declarations
whether they contained string parameters or not. Problem solved.


3. DropDownDatawindows for numeric columns in some crosstab datawindows
failing: Our application has numerous crosstab reports. A particular column
with a numeric insurance_company_code set to display the
insurance_company_name via a dropdown datawindow was failing and instead
displayed number values in exponential base format.


Solution: I reconstructed a report afresh in PB 10.5 and compared its source
text with the migrated version. I found that the numeric column shows up as
"decimal(0)" type in the fresh 10.5 version but as "number"
type in the migrated version. So I edited the source text of all the problem
report insurance code fields to "decimal(0)" and the problem was solved.
(Note that there were other columns in these reports with
"number" type that I did not change since they did not pose any problems.)


4. More API function calls failing: I am using the windows native
GetOpenFileNameA() and GetSaveFileNameA() API calls which in the PB 10.5
version started displaying with just a single character in the File Name and
File Type fields in the runtime dialog. The calls were subsequently failing
with a single character file name being returned.


Solution: While trying to solve this problem, I stumbled upon the new
parameter "EncodingANSI!" in the PB 10.5 help for the functions: Blob(),
BlobEdit(), String(), etc. I used this new parameter and the API function
calls started working correctly.

5. Mysterious crashes in the generic report preview window on some reports:
Our application has a generic report preview window used to display all the
reports. This window was crashing on two reports mysteriously. But the
reports themselves displayed and retrieved data just fine in the dw painter
IDE.


Solution: This one turned out to be a serious PB 10.5 bug that will need to
be fixed by Sybase. While displaying the two reports in question, the title
text of the generic preview window was being set to a string of more than 95
characters and this caused the crash. I shortened the sheet window title
text and the problem was solved.


I narrowed this bug to a barebones application with just a frame window and
the frame menu set to ContemporaryStyle!. The frame menu needs to have at
least 3 items like File, Windows, Help; and a submenu item on each of these.
You need to have a statement: This.Title = Fill ('a', 100) in the Open event
of the MDI sheet window that is opened in the frame window to get this
crash. The crash does not occur if the menu is
set to Traditional style or if the window being opened is of response type.


6. Datawindow Compute Columns - Change in the undocumented feature: In the
Datawindow painter, when you paste a computed column for 'Page n of nnn' the
expression that you will get is: "'Page ' + page() + ' of ' +
pageCount()" even in PB 10.5. Notice how the string is seamlessly added to
the long returns of page() and pagecount() without a String() cast around
the two. Well, I had used this undocumented feature in other
computed columns. With PB10.5 some of these computed columns started failing
(without any error if you clicked the Verify button in their expression
dialog). In the runtime, on many of our reports, we started having blank
space in the summary area where, for example, we had a computed column with
expression:
'Total Patients: ' + Count (patient_num for all)


Solution: I had to comb through all of our reports and put a String () cast
around number value functions. For example, the expression for the above
computed column was changed to: 'Total Patients: ' + String (Count
(patient_num for all))


The frustrating thing is the page computed column pasted in the dw painter
still works without a string cast. There is something wrong in how the
PB10.5 has been coded to yield this erratic behavior.


7. Computed Column again: On one of our data entry datawindows, I had a
computed column indicating the total of two user changeable amount fields:
remit_initial and remit_final. In the <=PB9 versions, whenever
the user changed either of the two entry fields, the computed column would
instantly change on itemfocuschange. In the PB10.5 version, the computed
column changed only after a rowfocuschange, which the users
didn't like.


Solution: I had to change the compute column expression from the more
straightforward:
"remit_initial + remit_final" to "if (remit_final = 0, remit_initial,
remit_initial + remit_final)".


After this, the computed column started refreshing normally. I do not know
how many of these computed columns I may have to change in our application.
With these kind of bugs, a little lateral approach helps.


8. Contemporary Menu custom icon bug: In the current PB10.5 release,
ContemporaryStyle! menus will not display your custom icon (stock icons work
ok) in the deployed application. But other custom images like
.bmp, .gif files work OK. The strange thing is the same .ico file specified
for the toolbar button displays fine but the menu item picture stays blank.
And of course, the custom icon files were specified in the resource file
included during the application build.


Solution: You will need to include the .ico files as independent files in
your runtime package. But this is not the recommended solution if Sybase
deems it necessary to fix this bug soon.


Libor Prusa

unread,
May 11, 2006, 6:06:53 AM5/11/06
to
Thank you, Shridhar, for this post. I find it very useful, since I will soon
undertake the same migration on my current project and I believe your hints
may help us to avoid a lot of problems and investigations!


Timothy Madsen

unread,
May 11, 2006, 8:22:18 AM5/11/06
to
Nice list. Problems and workarounds - very useful. Some notes of mine to
add....

Item #1 Failing Database Queries
The DBParm DisableUnicodeSupport was added in PB 10.2. You can see
information about it in the release bulletin. Whenever upgrading - I would
highly suggest reading (at a minimum) all of the release bulletins between
the version you are on and the version you are going to (including of course
the version you are going to). Anybody using the Oracle 8 client with
PowerBuilder 10+ should seriously consider at least looking at this option.

Item #6 Datawindow Compute Columns
This has been reported to Sybase. This was a regression issue in PB 10.5
GA. A fix is expected to be in the second publicly available EBF for PB
10.5. You clearly have the workaround - explicitly cast the numeric column
using string(). This is a consistent bug however it only impacts columns
with DECIMAL type - not NUMBER, LONG, ULONG or REAL. Many functions return
a LONG - which is why you see this working with the page of page construct.
However as you point out - many (perhaps most or all) Oracle numeric columns
get built in PB 10.5 datawindows as DECIMAL - which causes the problem when
you try to use the same technique with these.

Tim.

"Shridhar Kumar gmail com>" <shriprem<ATdot> wrote in message
news:44629aac@forums-1-dub...

Mike Shumway

unread,
May 12, 2006, 2:50:29 PM5/12/06
to
Excellent post.

I've shared a number of those that you've mentioned. I'm still working on
migration issues with external functions. I submitted a case to Sybase, but
haven't heard back, yet.

My issue is a Local External function in PB10.2.1 (this seems to work okay
in 10.5). The function, although defined with the '...Ansi' alias(mine
migrated the locals as well as the globals) still won't work : ( I'll post
back if/when I get a resolution. In the meantime, if anyone has any
suggestions.... : ) Before you say, "just go to 10.5...," the issue he
mentioned with the datawindow computes (strings and nulls) is a PAIN
(several hundred - thousands of changes) for us.... I'll wait to see if
they fix that one with the next release.

Mike


"Shridhar Kumar gmail com>" <shriprem<ATdot> wrote in message
news:44629aac@forums-1-dub...

Bruce Armstrong [TeamSybase]

unread,
May 13, 2006, 12:15:03 AM5/13/06
to
Are there any char datatypes in the function calls that aren't
working. Remember that a PB 10+ char is now twice the size of char in
earlier versions of PB.

On 12 May 2006 11:50:29 -0700, "Mike Shumway"
<shummer_mc<at>@yahoo.com> wrote:

Bruce Armstrong [TeamSybase]
http://www.teamsybase.com

In Defense of Top Posting
http://alpage.ath.cx/toppost/toppost.htm

Preach the gospel at all times. If necessary, use words. - Francis of Assisi
http://www.needhim.org

Mike Shumway

unread,
May 15, 2006, 1:30:06 PM5/15/06
to
Bruce,

The function (and DLL) encode data in a 2D barcode using an old Symbol
encoder (for which I don't have-- and can't get-- documentation) and output
it to a bmp, which we then pickup in a datawindow for printing. The struct
is just a bunch of pointers to memory locations (and a flag, or two). I
can't really do much with them, as I am unsure how Windows is allocating the
memory. So, I can't do the math and decide whether the lengths, etc. are
accurate. The data within it seems right (as far as I can tell).

Here is the definition (as it was migrated in PB10.2):
Function Integer MakeMemoryObject ( REF str_pdfobj PdfObj , Integer
ioDirection ,REF String lpBase ) LIBRARY "PDFENC32.DLL" alias for
"MakeMemoryObject;Ansi"
Function Integer PDFEncode ( REF str_pdfobj PdfObj , Long nInputLen )
LIBRARY "PDFENC32.DLL" alias for "PDFEncode;Ansi"
Function Integer PDFMakeImage ( REF str_pdfobj PdfObj , Long
lpnBytesWritten ) LIBRARY "PDFENC32.DLL" alias for "PDFMakeImage;Ansi"
Function Integer PDFOutputAsDIBFile( ULong lDpiScale , Integer
ImageOpts ) LIBRARY "PDFENC32.DLL"
Function Boolean MakeFilenameObject( ref str_pdfobj lDpiScale , Integer
ioDirection , REF String lpcszFilename ) LIBRARY "PDFENC32.DLL" alias for
"MakeFilenameObject;Ansi"
SUBROUTINE PDFSetDefaults () LIBRARY "PDFENC32.DLL" alias for
"PDFSetDefaults;Ansi"

Then, in a function (removed error checking), we use it as follows:

PDFSetDefaults ()

// I checked the asv_data... nothing's changed, and it's returning the same
len
li_rc = MakeMemoryObject (lstr_pdfobj , 1, asv_data)

//received an error in PDFEncode with PB10. (returned -11)

li_rc = PDFEncode (lstr_pdfobj, len(asv_data))

li_rc = PDFOutputAsDIBFile( ( 100 * 65536 ) +4 , 0 )

// output file
lb_rc = MakeFilenameObject (lstr_pdfobj, 2, ls_fileout)

// received an error (returned -12) here with PB10.
li_rc = PDFMakeImage ( lstr_pdfobj , ll_pnBytesWritten )

I really appreciate you help. I still haven't heard from Sybase. If you
need the DLL, I can attach it, or send it to you offline. Again, thanks!

Mike S


"Bruce Armstrong [TeamSybase]" <NOCANSPAM_br...@teamsybase.com>
wrote in message news:q7na621ptrta5ub9k...@4ax.com...

Bruce Armstrong [TeamSybase]

unread,
May 15, 2006, 10:13:37 PM5/15/06
to
If it's any help, here's an old example of using it:

http://72.14.207.104/search?q=cache:U7-XkuiZHmsJ:www.dcjs.virginia.gov/ijp/resources/2DBarCodes.pdf+PDFEncode+MakeMemoryObject+&hl=en&gl=us&ct=clnk&cd=1&client=firefox-a

That's VB syntax though.

On 15 May 2006 10:30:06 -0700, "Mike Shumway"

Mike Shumway

unread,
May 16, 2006, 10:55:48 AM5/16/06
to
I've got it. Thanks. I think it's the only example left on the web!

I get return codes (noted inline in the code below) which I can't diagnose
because I don't have doc. I even emailed Symbol-- got in touch with the
current program manager, but the software/doc isn't available (or they
didn't try too hard). I figure that it works, usually, with PB. So, it's
not a difference that I should have to solve. It's an issue that Sybase
needs to fix. Unfortunately, if it goes too much longer (deadlines are
looming) I'm going to have to fall back to PB9 (revert my code base???) and
wait for PB 11 or a stable fix on 10.5 or 10.2. Do you know whether it's
possible to migrate code backward?

As noted, I'll post back when I get a response from Sybase (which has been
oddly slow...).

I truly appreciate your help.

Thanks,
Mike

"Bruce Armstrong [TeamSybase]" <NOCANSPAM_br...@teamsybase.com>
wrote in message news:g6di62tttfhmoo2e0...@4ax.com...

ken.h...@googlemail.com

unread,
May 20, 2006, 11:34:33 AM5/20/06
to
> 5. Mysterious crashes in the generic report preview window on some reports:
> Our application has a generic report preview window used to display all the
> reports. This window was crashing on two reports mysteriously. But the
> reports themselves displayed and retrieved data just fine in the dw painter
> IDE.
>
>
> Solution: This one turned out to be a serious PB 10.5 bug that will need to
> be fixed by Sybase. While displaying the two reports in question, the title
> text of the generic preview window was being set to a string of more than 95
> characters and this caused the crash. I shortened the sheet window title
> text and the problem was solved.
>
>
> I narrowed this bug to a barebones application with just a frame window and
> the frame menu set to ContemporaryStyle!. The frame menu needs to have at
> least 3 items like File, Windows, Help; and a submenu item on each of these.
> You need to have a statement: This.Title = Fill ('a', 100) in the Open event
> of the MDI sheet window that is opened in the frame window to get this
> crash. The crash does not occur if the menu is
> set to Traditional style or if the window being opened is of response type.
>

Thanks for posting this, I'd spent a good hour or so trying to find why
PBDelta 5.2 was randomly crashing under PB10.5 before I checked the web
and your post had the solution above.

Cheers
Ken

Bruce Armstrong [TeamSybase]

unread,
May 22, 2006, 9:11:50 PM5/22/06
to
Off the top of my head, what I would suggest doing is removing a lot
of the ;ANSI suffixes from a lot of those function calls. PB has a
nasty habit of being overly zealous about adding them during the
migration. When it migrated the PFC Unicode filemanager and platform
manager services, it added the suffixes to all the calls that were
already Unicode....

I'd try removing the ANSI suffixes off of all the functions except:

MakeMemoryObject
MakeFilenameObject

I don't know how you've defined str_pdfobj, but otherwise those two
functions are the only ones that pass string values (which is the only
time the ANSI suffix comes into play).

On 16 May 2006 07:55:48 -0700, "Mike Shumway"

Mike Shumway

unread,
May 24, 2006, 11:01:38 AM5/24/06
to
Thanks for the response. I tried that, but it didn't solve the problem.
We've elected to reverse migrate our recent changes back into our existing 9
code-base (yuck!). I'm posting so that if anyone needs to know how they can
"undo" a migration.

First, there is no wholesale reversal process that I could find. It's
object by object. So, if you didn't make a backup, you're gonna be awhile.
This is what we did:

1. ID all the objects that have changed. I used PBL Peeper to get a list of
all the objects and their modification dates. I exported that list into a
text file, then imported it into Excel so that I could sort, etc.
2. Export the source code for each of those objects that you need to reverse
migrate. Note that you'll need to "undo" all the alias stuff, and all of
the encodingAnsi! modifications you made, too. So, export those objects as
well. Of course, if you made no other modifications (other than to
accomodate the migration), then you don't need to reverse these objects. My
reversal process required 250 objects. I hooked up the source control
functionality, which exported all objects. I then used Excel (which has the
list of the relevant objects) to create a command line script to 'get' the
250 objects (i.e. ss get $/project/objectname.*). This got me a nice set of
files.
3. In every source code file, you'll need to edit out the first two
characters (HA).
4. For datawindows only, there are two other modifications:
4.1 change the release number back to your release number (i.e. 'release
10;' becomes 'release 9;')
4.2 remove the last 8 lines of code regarding xhtmlgen.... Note that
this is ONLY for datawindows marked release 10. I found a few that didn't
have those last lines and the were marked with a previous release number.
5. PBL by PBL you need to import the new export files into your version 9
PBLs.
6. Solve any errors as the occur : )
7. Re-build
8. enjoy!


"Bruce Armstrong [TeamSybase]" <NOCANSPAM_br...@teamsybase.com>
wrote in message news:drn472heir8hrs6f9...@4ax.com...

Julián Tagarro

unread,
Aug 26, 2006, 11:07:33 AM8/26/06
to
I were away of this forums for some time. Posts like this make me remember
why I must participate every day.

Regards

"Shridhar Kumar gmail com>" <shriprem<ATdot> wrote in message
news:44629aac@forums-1-dub...

0 new messages