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



I think what Jon was referring to (Jon correct me if I'm wrong) but if you
use DDL to create the file (as I did in the example) you can specifiy
RCDFMT(<recordformat>) on the CREATE TABLE statement. If this parameter
is omitted the file is created with the same record format name as the
file. Therefore in the RPG you need to rename the record format.
It was an oversight on my part not to include the parameter but in my
haste to create the example I omitted the RCDFMT parameter. When I
compiled the program and saw the error it was easier to just rename the
format....my bad, lazy me....

Robert Rogerson
On 2013-07-05 8:15 AM, Briggs, Trevor (TBriggs2) wrote:

Jon, you say:
"By the way - you don't need to rename formats in RPG you can give it
the name you want in SQL..."

In my (fuzzy) recollection, an RPG program wouldn't compile if the file
and format names were the same. Is this only true if you are using
native I/O on the file and therefore not necessary if you are only using
it for field definitions?

Trevor Briggs
Analyst/Programmer
Lincare, Inc.
(727) 431-1246
[1]TBriggs2@xxxxxxxxxxx
-----Original Message-----
From: [2]rpg400-l-bounces@xxxxxxxxxxxx
[[3]mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Wednesday, July 03, 2013 7:59 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Template DS subfield types not as expected...

You've already had the answer. i.e. this is what RPG has always done -
nothing to do with Template or ...

But you _could_ use a different approach which is to make the file a
template and then use LikeRec to define the DS.

Haven't time to test but this should work.


Ftestfile1 if e disk Template
d pi

d t_ds ds template

LikeRec(testfile1)

By the way - you don't need to rename formats in RPG you can give it the
name you want in SQL off the top of my head the keyword is RCDFMT I
think.


On 2013-07-03, at 4:03 PM, Robert Rogerson [4]<rrogerson@xxxxxxxxxxx>
wrote:


Hi all,
I created a short program which shows my problem. I am coding a

template

DS but the subfields defined (using like the file fields which are

zoned)

are showing as packed. I don't know why this is happening. Can

anyone

explain it?
Also, if I comment out the file and uncomment the external DS

pointing to

the file all the fields are zoned as expected.

To create the test table:
CREATE TABLE MYLIB/TESTFILE1 (
"ITEM" NUMERIC(6,0) NOT NULL,
"STORE" NUMERIC(3,0) NOT NULL
)

The test program:
Hoption(*nodebugio:*srcstmt)
Ftestfile1 if e disk Rename(testfile1:

testfile1r)

d pi
d*testfile1Ds e ds extname(testfile1)
d t_ds ds template
d field1 like(item)
d field2 like(store)
d myDs ds likeds(t_ds)
d
/free
*inlr = *on ;
Return;
/end-free

And a few lines from the compile listing which compiles with no

errors.

Also, I am on V7R1:

000001=ITESTFILE1R
000002=I S 1 6 0ITEM
000003=I S 7 9 0STORE

Global Field References:
Field Attributes References (D=Defined
M=Modified)
*RNF7031 FIELD1 P(6,0) 000600D
TEMPLATE
*RNF7031 FIELD2 P(3,0) 000700D
TEMPLATE
*RNF7031 ITEM P(6,0) 000600

1000002D

*RNF7031 MYDS DS(6) 000800D
*RNF7031 STORE P(3,0) 000700

1000003D

*RNF7031 T_DS DS(6) 000500D 000800
TEMPLATE

I'm really stumped on this one and figured if anyone would know

they'd be

here.

Thanks,

Robert Rogerson
--
This is the RPG programming on the IBM i (AS/400 and iSeries)

(RPG400-L) mailing list

To post a message email: [5]RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: [6]http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: [7]RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [8]http://archive.midrange.com/rpg400-l.


Jon Paris

[9]www.partner400.com
[10]www.SystemiDeveloper.com

References

Visible links
1. mailto:TBriggs2@xxxxxxxxxxx
2. mailto:rpg400-l-bounces@xxxxxxxxxxxx
3. mailto:rpg400-l-bounces@xxxxxxxxxxxx
4. mailto:rrogerson@xxxxxxxxxxx
5. mailto:RPG400-L@xxxxxxxxxxxx
6. http://lists.midrange.com/mailman/listinfo/rpg400-l
7. mailto:RPG400-L-request@xxxxxxxxxxxx
8. http://archive.midrange.com/rpg400-l
9. http://www.partner400.com/
10. http://www.systemideveloper.com/

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.