PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).

Join the forum, it's quick and easy

PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).
PMS Information Systems
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Initialize Decimal data error field with zero

Go down

data - Initialize Decimal data error field with zero Empty Initialize Decimal data error field with zero

Post  maran Thu May 30, 2013 5:07 pm

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.
maran
maran
Admin

Posts : 442
Join date : 2009-07-24

https://pmsinformationsystem.forumotion.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum