× 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.



Jerry,
Create two files.

One with DDS
R PFTEST1R
MYDEC 15P 0

One with DDL
CREATE TABLE ROB.PFTEST2 (MYDEC DEC (15 , 0) NOT NULL WITH DEFAULT)
RCDFMT PFTEST2R

DSPFD shows them both with
Maximum record length . . . . . . . . . . . : 8

So create a third file
CRTPF FILE(ROB/PFTEST3) RCDLEN(8)
Put some data into it
INSERT INTO ROB.PFTEST3 VALUES('AAAAAAAA')

Now copy that over PFTEST1
CPYF FROMFILE(ROB/PFTEST3) TOFILE(ROB/PFTEST1)
MBROPT(*REPLACE) FMTOPT(*NOCHK)
CPC2955 - 1 records copied from member PFTEST3.

Check for invalid data
RUNQRY QRYFILE((ROB/PFTEST1))
QRY1161 - Data mapping error 1 running query.

Try to corrupt the DDL file
CPYF FROMFILE(ROB/PFTEST3) TOFILE(ROB/PFTEST2)
MBROPT(*REPLACE) FMTOPT(*NOCHK)
It won't do it. Hard stop.

Why? Because DDS check the data at read, not write. The benefit to that is if you have an application with a column for Turkistan currency conversion factor and you do not do business with Turkistan you can overlay that numeric field with a data structure in RPG and store character data in it. Thus repurposing that column for something else you want without having to recompile all your programs. Ancient technique which used to be used.
You cannot do that with a DDL file.


Rob Berendt

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.