At a COMMON session I learned I could do:

CREATE TABLE workfile LIKE referencefile WITH DATA

I thought this was great for a project I'm working on.  No joy though.
First off I can't say 'WITH DATA' because SQL balks at it.  I can leave off
the WITH DATA, but then it's an empty file.  So I did it with a subselect,
like this:

CREATE TABLE workfile as (Select * from referencefile) WITH DATA

Which worked, and brought the data over, but still no joy.  The file level
ID is totally different.

If I use the first method, creating an empty file and try CPYF, it tells me
I must use FMTOPT(*MAP) because 3 fields have a different definition.  I
assume this is because 'referencefile' was created with DDS and 'workfile'
is being created with SQL.  'referencefile' has some fields with EDTCDE and
itself was created using a field reference file.

My ultimate goal was to do the CREATE TABLE embedded in RPG instead of a
CRTDUPOBJ in CL, because this seemed clearer to me: all the 'logic' is then
in the RPG.  I ended up using CRTDUPOBJ in the RPG.

I suppose as long as one of the files was created with DDS and the other
with SQL, it's never going to work because of the file level issue, right?

Thanks.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.