Focal Point
Converting from P7 to A7 in FOCUS.

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6671058331

May 06, 2005, 06:33 PM
newtofocus
Converting from P7 to A7 in FOCUS.
Hi,

I have field that is defined as P7 in the metadata.

FIELDNAME=CPDK_INV_NUMBER, USAGE=P7, ACTUAL=P4, $
I am trying to convert it into an alphanumeric field of length A7 and I am using the following defined field.

DEFINE CPDK_INV_NUM_ALPHA/A7 = FTOA(CPDK_INV_NUMBER,'P7',CPDK_INV_NUM_ALPHA);,$

It gives me blank in the field any ideas?.

Thanks.
May 06, 2005, 07:04 PM
dwf
Try this:

DEFINE
CPDK_INV_NUM_INT/I7 = CPDK_INV_NUMBER;
CPDK_INV_NUM_ALPHA/A7 = EDIT(CPDK_INV_NUM_INT);
May 06, 2005, 08:00 PM
jimster06
Take a look at PTOA . It is a legitimate function and the arguments are analogous to FTOA.
May 06, 2005, 08:06 PM
<Joseph Coule>
EDIT should work directly on a packed number. Try this:

DEFINE CPDK_INV_NUM_ALPHA/A7 = EDIT(CPDK_INV_NUMBER);,$

JC
May 06, 2005, 08:08 PM
jimster06
Here's the syntax from IB

DEFINE FILE EMPDATA
P_SAL/P12=SALARY;
END
TABLE FILE EMPDATA
PRINT P_SAL SALARY
COMPUTE A_SAL/A14=PTOA(P_SAL,'(P12L)',A_SAL);
END

Note: the L in P12L will produce leading zeros, remove if not desired
May 06, 2005, 08:35 PM
newtofocus
Thanks all. All of your suggesstions worked. But I liked Joseph's better as it is simple.
May 07, 2005, 02:39 PM
susannah
Dear New2,
as jimster says, PTOA is the correct way and the only way if your field is really packed decimal. However there are times, especially in legacy systems, where a field says its packed, but its not really. (due to the tool that makes the mfd) EDIT works then, but only then. When, for instance, UPC's change to really long numbers,(coming soon), PTOA is gonna be the ONLY way to handle them. Just fyi.