15 characters is an awfully big field. Really big. Just a thought
here... If you were to reserve the first few columns to specify some
large common split, that would still leave you with a humongous number.
For instance, if you said the first 2 characters is reserved for the
country code then you still have 13 character field, which holds
9,999,999,999,999 (10 trillion - 1) PO numbers. If you allow characters
the number jumps by at least 26 times 26 times.
The issue doesn't seem to me to be the limitation of 15, but how best to
use them. Those first few columns could be country codes, Julian date
of order, source of order (phone, mail, web, sales staff), first 3
letters of customer name, initials of order taker, or any other useful
scheme you like.
If the issue is the customer might have a greater than 15 Character PO
number, that is different and suggests different cures.
On 4/26/2014 7:44 AM, Steve Richter 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 problem?
Ideal would be something where code written using RPG SQL would
function without any code changes.
d vPonum s 30a
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.