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



You are correct, but I don't think that is the point of Jon's comment. I believe he meant to point out that you can add the RCDFMT clause to your create table statement to name the record format whatever you want, and then you don't have to rename the record format in the RPG even if you are using native I/O.

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


-----"Briggs, Trevor (TBriggs2)" <TBriggs2@xxxxxxxxxxx> wrote: -----
To: "RPG programming on the IBM i (AS/400 and iSeries)" <rpg400-l@xxxxxxxxxxxx>
From: "Briggs, Trevor (TBriggs2)" <TBriggs2@xxxxxxxxxxx>
Date: 07/05/2013 08:16AM
Subject: RE: Template DS subfield types not as expected...

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
TBriggs2@xxxxxxxxxxx
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[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 <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: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com





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.