Initialize Decimal data error field with zero
Page 1 of 1
Initialize Decimal data error field with zero
If you have DDS-described files that contain invalid numeric data, you know all about decimal data errors. This problem often surfaces when you receive data from an outside source and copy it to your system. Here’s an easy way to set invalid numeric data to the value 0 and avoid decimal data errors.
Say you have a file called OLDFILE that contains invalid numeric data. Just follow these steps:
Copy the DDS for file OLDFILE to a source member — we’ll call it NEWFILE.
Add a dummy numeric field to the end of the DDS in NEWFILE; a one-byte, zeroÐdecimal-position field will do fine.
Compile the DDS source for file NEWFILE.
Execute the CPYF (Copy File) command, specifying *MAP *DROP for the command’s FMTOPT parameter, to copy the data from OLDFILE to NEWFILE.
Execute the CPYF command again, specifying *REPLACE for the command’s MBROPT parameter and using the same FMTOPT parameter values as above, to copy the data back from NEWFILE to OLDFILE.
When you’ve completed these steps, all numeric fields in file OLDFILE will contain valid numeric data. If you have no further use for file NEWFILE, you can delete it.
Say you have a file called OLDFILE that contains invalid numeric data. Just follow these steps:
Copy the DDS for file OLDFILE to a source member — we’ll call it NEWFILE.
Add a dummy numeric field to the end of the DDS in NEWFILE; a one-byte, zeroÐdecimal-position field will do fine.
Compile the DDS source for file NEWFILE.
Execute the CPYF (Copy File) command, specifying *MAP *DROP for the command’s FMTOPT parameter, to copy the data from OLDFILE to NEWFILE.
Execute the CPYF command again, specifying *REPLACE for the command’s MBROPT parameter and using the same FMTOPT parameter values as above, to copy the data back from NEWFILE to OLDFILE.
When you’ve completed these steps, all numeric fields in file OLDFILE will contain valid numeric data. If you have no further use for file NEWFILE, you can delete it.
Similar topics
» Decimal data error – Scenario 1
» File Zoned Decimal has been changed to Packed Decimal in RPG
» What is a field type? List the 3 field types
» Initialize PFM - INZPFM
» Compilation error
» File Zoned Decimal has been changed to Packed Decimal in RPG
» What is a field type? List the 3 field types
» Initialize PFM - INZPFM
» Compilation error
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|