× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hari wrote:
I am using CPYF to copy the contents of a Physical file to a flat file (of 132 bytes in length).
Here the decimal, float and negative data values are not copied properly in the destination (flat file) . Ex 12.34 is copied as 1234 and -5 as 5. Could anyonw help me in solving this?

Hari -

You're obviously new to this platform. This is documented, expected behavior.

I'm assuming you are using CPYF with FMTOPT(*NOCHK).

From the help text for CPYF:

<Help>

*NOCHK If the record formats of the database files are different, the copy operation continues despite the differences. Record data is copied directly (left to right) from one file to the other. *NOCHK is required when copying all record formats from a logical file with more than one format to a physical file that is of the same type (source or data) as the from-file. If this value is specified, null values are ignored and no conversion of
date/time data occurs.


</Help>

In DB2/400 files, decimal points are assumed and
signs are stored in the low-order half-byte.


If you understand the statement above from the help text,
neither of them get converted when copied to a flat file.

CPYTOIMPF will put signs and decimal points into the flat file.
However, the values in the signed fields in the in flat file will not be aligned.


Example (CUSMST is a "regular" file, TESTFILE is a "flat" file):

CPYTOIMPF FROMFILE(CUSMST) TOFILE(QTEMP/TESTFILE) DTAFMT(*FIXED)

Here is what a signed field looks like in the output file:

-100.10 999.99 888.88 111.22 888.88 12345.67 00

If this is not what you want in your "flat" file, you may need to write an HLL (HLL = High Level Language) program
to create the flat file in the form you desire.


Good luck,
Steve Landess
Austin, Texas
(512) 423-0935

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.