How do I convert a numeric field to another storage type?.

Since version 3.8, Suprtool's EXTRACT command has been able to convert numeric data between different data types.

The general syntax is:

     >extract field-name = expression

The "field-name" can be any field from a database, a self-describing file, or a Define command. An "expression" is any numeric value, or field name, or an arithmetic combination of the two. For example,

     >define DoubleField,1,4,double    {define a new field with required storage format}
     >extract DoubleField = PackedField + 10  {assign it values from existing fields}

     >define DisplayField,1,6,display   {define human-readable target}
     >extract DisplayField = I2Field     {convert binary field to Display}

If you want to update a field with the value of another field in the same dataset, use the Update command before the Extract command.

     >update                                       {MPE only}
     >extract TotalCost = UnitCost * SalesQty

This is particularly handy for Suprlink users when two files store the key field in different formats. For example, a Z6 display field to store CustomerNumber in one file, and a J2 integer field to store CustNo in another file.

See also "How to Convert Positive Signed Fields", "How to Control the Format of Numeric Fields", and "How to Change Field Storage Attributes".

....Back to the Suprtool Q&A Page