1. Jon Stoller
  2. PowerBuilder
  3. Sunday, 5 November 2017 21:22 PM UTC

I updated an application from PowerBuilder v7 to PowerBuilder 2017.
There is a statement in a function in a Windows object in one of the PBLs.
    ls_jobno = dw_compproclist.object.jobno[ll_tcur]
It moves information from a column in a datawindow into a local variable. 

The problem is: 
In PBv7 ls_jobno = "20288".  There are no padded spaces on the right
In PB2017 ls_jobno = "20288             ".  It is padded on the right with spaces. 
(In the above example the column "jobno" is 18 characters.  The jobno is "20288".)

Another point, it is not consistent.
Different datawindows give different results.
Here are statements from 2 different datawindows in the same function in the same Window object.   
    ls_jobno = dw_header.object.job[ll_tcur]
        ls_jobno = '20288' - Not Padded
    ls_jobno = dw_sheet.object.job[ll_tcur]
        ls_jobno = '20288             ' - Padded

What can I do?  It is a big problem. 
I know I can manually program around the problem each time it occurs. 
I'm still in the beginning stages of debugging the upgraded application. 
But this issue could easily be strewn throughout my application, which is not a small application. 
Is there anything to do that will make PowerBuilder work like it did in version 7?
- Make it never pad the variable with spaces?  Make it automatically trim the variable?
Is there a setting I can enter to do this?  Is there something like that?

Accepted Answer
Lars Mosegaard Accepted Answer Pending Moderation
  1. Sunday, 5 November 2017 21:56 PM UTC
  2. PowerBuilder
  3. # Permalink

Wondering if you changed databases or database interface at same time?

Comment
  1. Jon Stoller
  2. Tuesday, 7 November 2017 02:01 AM UTC
I tried what you said.  I tried it with both SNC SQL Native Client and OLEDB (with OLEDB I left off the last parameter, PBDateTimeFmt, because, as I wrote you in a previous reply, I get a syntax error when I try to enter it). 



In both cases the application fails to retrieve data if the datawindow has an outer join statement, which is the case in the objects where I was having the "Padding" problem.  I almost always develop datawindows graphically - so PowerBuilder generates the sql syntax with the outer join.  In PowerBuilder v7 the syntax had "*=" in the syntax.  The PB 2017 the syntax says outer join.  Is it a bug in PowerBuilder that the generated syntax fails to retrieve?  



Do you have a suggestrion for what should I do next?

  1. Helpful
  1. Govinda Lopez @Appeon
  2. Tuesday, 7 November 2017 18:36 PM UTC
Hi Jon,



 



Have you tried executing your SQL query in the ISQL Session window from the Database Connection Window within PowerBuilder? 







 



Have you tried that using a different Database browser?



 



Another suggestion I would like to give you is to try it using ODBC instead. First without modifying the parameters. Then, if you're still getting the extra padding, try setting up the "ANSI Padding Enabled" Parameter from SQL Server to FALSE. You can find this on the Microsoft SQL Server Management Studio. If you right click on your database, then select "Properties", then "Options" and then, on the "Miscellaneous" section you should find "ANSI Padding Enabled" option. Set that to "FALSE". (See image).







 



Please do share your results.



 



 



Regards,

  1. Helpful
  1. Govinda Lopez @Appeon
  2. Friday, 10 November 2017 01:09 AM UTC
Hi Jon,



 



Here's a link about details on the padding: https://dba.stackexchange.com/questions/10510/behavior-of-varchar-with-spaces-at-the-end



 



 



Regards,

  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.