Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
Hi
We have one CL where a PF is copied to a flat file to be FTPed later.
The PF has some amounts which can be negative. After CPYF to flat file, last digit from these negative values gets replaced by a char as follows:
o --> }
1 to 9 --> J through R
Example: 51.88- becomes 518Q and 130.30- becoems 1303}
Is there any way to avoid this? I know, I can write one small RPG program & do this. Just wondering if I can avoid that.
TIA
Deepak
What do you want to do instead? Swallow the negative value? Insert a - before/after the number?
There's no built-in method to do that in CPYF, but there are tools and programming techniques. So you're going to have to write something.
The only way I would know short of writing something would be that you copy to an import file (like a csv or tab) in the ifs and with the field definitions it would put out -14.55 for you but obviously the file format would be different than it is now.
Bob,
Yes, I want to retain the -ve sign in the flat file. And I guessed there is no direct way using CPYF.
clbirk,
Yes, with the limitation of Input & Output file format, best way to achieve this is to write a small RPG and that's what I did.
Thanks to both of you for your reponses.
Deepak