Decimal data error on RPG write
Last Post 22 Jan 2013 03:53 PM by Lynne Noll. 6 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Mike Pantzopoulos
New Member
New Member
Posts:4

--
16 Jan 2013 04:24 AM
I was under th impression hat the difference between a file created with SQL DDL and a File created with DDS was that the one created with DDL would be checked for decimal data errors on the write, and the DDS defined one would be checked for decimal data errors on the Read.
I now have a DDS defined file that is throwing a decimal data error on a Write due to a packed decimal field not being initialised.

Have I misunderstood the concept? If so, could someone flesh out the subtleties please?

Thanks for your consideration.
Tommy Holden
Senior Member
Senior Member
Posts:2833
Avatar

--
16 Jan 2013 05:33 AM
that is correct about the differences between the DDL write & DDS write. DDS tables are checked on read, not write. can you post some code? it seems that there is something else going on.
Jim Suiter
Veteran Member
Veteran Member
Posts:1567
Avatar

--
16 Jan 2013 05:33 AM
I've always accepted the fact that if try to write data that is incompatible with field data type, an error will be generated, regardless of whether that field is a program variable or field defined in DDS physical file.
Vincent Taquin
Basic Member
Basic Member
Posts:205

--
16 Jan 2013 06:07 AM
This kind of problem can happen when the variable is included in a datastructure.

You should initialize your DS or the subfield.
Crispin
Veteran Member
Veteran Member
Posts:1501

--
16 Jan 2013 06:58 AM

DDL will protect a file from having bad data written to it, DDS will not. What you are describing though is not the same thing though. The decimal data error is (likely) being generated when the program moves data to the write buffer before the data is written to the database.

Some examples of how to write bad data.

CPYF FMTOPT(*NOCHK) with wrong data format. DDL will stop this if it will cause bad numeric data etc., DDS will not.

Write an RPG Program and use a Program Described file and write blanks to a numeric field. DDL will stop this, DDS will not.

You would get a different error message from the database if you attempted to write bad data to a DDL defined file (perhaps CPF5035).

Crispin.

Barbara Morris
Senior Member
Senior Member
Posts:5201

--
16 Jan 2013 02:49 PM
Posted By Crispin on 16 Jan 2013 07:58 AM

DDL will protect a file from having bad data written to it, DDS will not. What you are describing though is not the same thing though. The decimal data error is (likely) being generated when the program moves data to the write buffer before the data is written to the database.



Mike, if you're getting an RPG error (RNQ0907 or RPG0907), then what Crispin is suggesting is true. The error is happening in your RPG program, and is independent of how the file was created.
Lynne Noll
Senior Member
Senior Member
Posts:6567

--
22 Jan 2013 03:53 PM
There are often implied moves from program fields to data base fields with a DDS defined file operated through F specs; the write causes a move under the covers. If the RPG field with the same name as the file field does not have good numeric data, the implied move will get an error within RPG. It is not DDS getting the error, it is RPG.
You are not authorized to post a reply.

Acceptable Use Policy