1. Yakov Werde
  2. PowerBuilder
  3. Thursday, 27 April 2017 17:34 PM UTC

Hello All,

We are about to expand and alter a frequently referenced column's size from char(2) to varchar(10)  This column appears in multiple tables, is part of data integrity FKs and is referenced in 100's of DWOs.  The impact on the application is wide ranging.

Datawindow syntax from go from (something like)

 column=(type=char(2) updatewhereclause=yes name=state_province_code dbname="s1_feed_tax.state_province_code" )

To

 column=(type=char(10) updatewhereclause=yes name=state_province_code dbname="s1_feed_tax.state_province_code" )

Since the PB IDE doesn't have a refactoring tool, I anticipate the need to edit source every occurance.

Aside from UI display issues, what are the ramifications of leaving the column type defined as char(2)?  Will retrieving more than char(2) overflow the buffer ?

Assuming refactoring is required Is there a better way to refactor the DW syntax?

TIA

Yakov

Bruce Armstrong Accepted Answer Pending Moderation
  1. Friday, 28 April 2017 16:23 PM UTC
  2. PowerBuilder
  3. # 1

FWIW, I wrote a utility quite a ways back that allows you to walk through your DataWindows, and examine them to make sure that the column widths in them match the underlying tables.  If memory serves it looks at the PowerBuilder extended attributes tables, so those would need to be populated.  It highlights those where there isn't a match and a double click updates the DataWindow syntax to match them back up.  You then save the modified DataWindow syntax from the tool and export it.  It still means reviewing each DataWindow manually though.  It just makes it a lot simpler that doing it from the PB IDE.

https://wiki.scn.sap.com/wiki/display/SYBPB/Column+Width+Checker

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 27 April 2017 20:19 PM UTC
  2. PowerBuilder
  3. # 2

I'm not sure about PBSearch's ability to check-out the objects before changing them. I don't remember if the 'live' version (4.9.x) does that and I know for sure the 'beta' version (5.0) does not have Global Search & Replace finished.

Comment
  1. Olan Knight
  2. Friday, 28 April 2017 13:20 PM UTC
It seems to me that manually checking out the objects, THEN using the PBSearech GLOBAL REPLACE function would be enormously better, easier, faster, and safer than trying to update the code manually!  :)



 

  1. Helpful
  1. Yakov Werde
  2. Monday, 1 May 2017 18:18 PM UTC
I'm not concerned about the checkout piece. I can do checkout from the command line. PB will detect the status and set it on the PBL code object accordingly,



I can batch export the changed DWOs and check them in from the command line.  



One more thing I'm looking at is using a regular expression search and replace to handle the bulk of them.  I just work with the .SRD file set outside the IDE NotePad++ has that feature built in.  That category of DW include those that confirm to a standard pattern.  It's the outliers  that will require hand processing and take the most time

  1. Helpful
There are no comments made yet.
Chris Pollach Accepted Answer Pending Moderation
  1. Thursday, 27 April 2017 20:17 PM UTC
  2. PowerBuilder
  3. # 3

Hi Yakov;

     Personally I would look at the LibrayExport & LibraryImport methods built into PB. Using these, I would write a utility to scan through alll your Apps DWO source and replace the targeted column sizes accordingly. Then, import & save the updated DWO source back into your Apps respective PBL's. I have written lots of these utilities for such that purpose. They are a little bit of work to code - but will save you hours, days, weeks, etc of hand refactoring.

    Just my $0.02 ..... Food for thought.

Regards ... Chris

Comment
There are no comments made yet.
Jim Reese Accepted Answer Pending Moderation
  1. Thursday, 27 April 2017 18:55 PM UTC
  2. PowerBuilder
  3. # 4

PBSearch has Global Replace capability. From the Help:

Global Replace

The Global Replace window is opened by clicking Replace on the toolbar or choosing Global Replace from the Actions menu within the Search for a String window. You must also have chosen Show Line Where Found when performing the search.

The first step in a Global Replace is to perform the search. When the Global Replace window opens, it will give a warning message if you did not choose Match on whole words. This is because partial word changes can lead to unintended changes.

The global search replace window displays the search string at the top of the window just over the input field where you enter the replacement string.

Two lines are shown for each hit. The top lines is the current value. As you type in the Replace With field, you will see what the code will look like in the second line (the one with the »). You can scroll through all the objects to verify that the change you will be making will give you the desired result.

The Delete button allows you to remove any hits that you do not want changed. Multi-row selection is enabled to make this task easier.

It is highly recommended that you leave the Make backups checkbox checked. This option copies all the libraries that make up the application to your system temporary directory. That way if you accidentally change something you didn't want to change or the change results in compile errors, you can restore the files and try again.

Clicking the Replace button will start the change process.

The Print button allows you to print the proposed changes and review the hard copy.

 

Comment
There are no comments made yet.
Yakov Werde Accepted Answer Pending Moderation
  1. Thursday, 27 April 2017 18:29 PM UTC
  2. PowerBuilder
  3. # 5

I just confirmed that having a datawindow column definition smaller than the table column size will truncate the buffer column contents 

Table char 50

Column char(5)

Louisiana --> in buffer as Louis

So type=char(xxx) must match column defined size for all chars to be retained.  Refactoring dw syntax will be required

Comment
  1. Chris Pollach
  2. Thursday, 27 April 2017 20:13 PM UTC
Correct ... truncation would occur on data input!

  1. Helpful
  1. Mike S
  2. Thursday, 27 April 2017 22:01 PM UTC
only for updates.  any non-updatable dws such as reports will be ok.



 

  1. Helpful
  1. Bruce Armstrong
  2. Friday, 28 April 2017 16:04 PM UTC
If you're using Oracle, depending on the version of PowerBuilder and Oracle in use, it will actually stop the retrieve at the record that contains the longer than expected text.  

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.