Here's how I would do it (and have many times)...

Move the data to a new PF with a new larger PO field..

Create a new LF with the same name as the original PF, leaving out the new
larger PO field. Repoint the existing logicals to the new PF in addition
to leaving out the new larger PO field. All logicals will need to have the
fields explicitly listed so they have there own format instead of sharing
the physical's format.

Unless you've made a mistake, all the file format ID's should match the
originals and thus no programs need be recompiled.

Now you can add a new logical or two, also with fields listed, that
includes the new PO field. Any programs that need the larger# will use
these. You can either load the short field in your programs or use a
trigger on the PF to keep the short field in sync.

I usually take the opportunity to move the PF from DDS to SQL DDL.

The only catch I've found that if you've started replacing LF with SQL
indexes for RPG RLA....while you can specify only certain fields the system
puts the keys at the front; If that's not where they were originally, you
format level IDs won't match.


On Sat, Apr 26, 2014 at 8:44 AM, Steve Richter <stephenrichter@xxxxxxxxx>wrote:

We have an order header file that contains a PONUM field. Char(15).
But as the business expands to take on new customers sending in orders
with a PO number the 15 char limit might not be enough. The EDI 850
specs I look at say po number can be 1 - 22 characters.

The programmer who handles the RPG code with traditional F spec files
does not want to increase the field size and recompile all of the

I am thinking of a scheme where I put a special key in the char(15)
ponum field when the po number is longer than 15 characters. That
value being the key to another file that contains the actual value.

Are there any system level, DB2 features that can be used to solve this

Ideal would be something where code written using RPG SQL would
function without any code changes.

d vPonum s 30a

exec sql
select a.ponum, a.shipname
into :vPonum, :vShipName
from dwhpf30c a
where a.ordnum = :inOrdnum ;

In the above code snippet, dwhpf30c is the order header. DWHPF30C is a
CRTPF created file and PONUM is a CHAR(15) field. When the value of
the PONUM field is actually more than 15 characters I need some logic
somewhere that will return the full value from where it is stored into
the char(30) program variable vPonum.

This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives

This thread ...


Return to Archive home page | Return to MIDRANGE.COM home page