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



Well now it seems we were both right. Although I think that %Len not working for fixed length fields is a bug. It should only be %Len on a varchar that doesn't work since it cannot be determined at compile time.

%Size does work and should be fine in this context.

For example this complies (7.4) just fine.

dcl-ds myDs_T Template;
charFld char(5);
numFld zoned(7);
End-Ds;

dcl-s x int(5);

x = %Size(charFld);



On May 23, 2020, at 11:20 AM, Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx> wrote:

Jon,
sure?!

IMHO %LEN and %SIZE can only be used against TEMPLATE fields for defining constant values.
But in either way: Something that can is only used at compile time and is not included in the program, cannot be used at runtime! Or am I wrong?

Documentation for the TEMPLATE keyword from the current RPG Reference:
The TEMPLATE keyword indicates that this file definition is to be used only at compile time.
Files defined with the TEMPLATE keyword are not included in the program.
The template file can only be used as a basis for defining other files later in the program using the LIKEFILE keyword.

Mit freundlichen Grüßen / Best regards

Birgitta Hauser


"Shoot for the moon, even if you miss, you'll land among the stars." (Les Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them and keeping them!"
„Train people well enough so they can leave, treat them well enough so they don't want to.“ (Richard Branson)


-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jon Paris
Sent: Samstag, 23. Mai 2020 15:40
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Any changes to the RPG compiler lately ?

Both %len and %Size should be able to be used against template fields. %Len should be blocked on varchar but otherwise they are supposed to work.



On May 23, 2020, at 6:01 AM, Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx> wrote:

Hi Francois,

These are 2 different statements:
d SYDDSREF E DS Based(Null)
DCL-DS SYDDSREF Ext Template END-DS;

The equivalent for
d SYDDSREF E DS Based(Null)
is
DCL-DS SYSDSREF Ext Based(NULL) End-DS;

A template can only be used for defining other data-structures or
variables, but the reference fields cannot be accessed at runtime.
When defining a data structure based on a pointer the data structure
sub-fields and the data structure can be used at runtime

Mit freundlichen Grüßen / Best regards

Birgitta Hauser


"Shoot for the moon, even if you miss, you'll land among the stars."
(Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training
them and keeping them!"
„Train people well enough so they can leave, treat them well enough so
they don't want to.“ (Richard Branson)


-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Francois Lavoie
Sent: Freitag, 22. Mai 2020 22:16
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Any changes to the RPG compiler lately ?

Hi there,

I had to recompile a module from a service program and the compiler
issued
RNF0655:
"Item MSGID was defined with TEMPLATE and cannot be used in this context."

The code compiled before and would appreciate any idea why it's not
compiling anymore Was there a PTF in the latest CUME that changed the
way referencing a field in a Template DS ?

Here's the code
// DDS Reference Fields Definitions (MSGID defined as a 7A) DCL-DS
SYDDSREF Ext Template END-DS; ...
// @MsgID is a parm that I compare with the length of the defined
reference field MsgID If %Len(@MsgID)>%Len(MsgID);


If I define SYDDSREF the old fashion way, it compiles fine.
And, again the definition with Template above was working before then
did not for unknow reason
d SYDDSREF E DS Based(Null)

Thanks


Confidentiality Warning/Avertissement de confidentialit?:

This message is intended only for the named recipients. This message
may contain information that is privileged or confidential. If you are
not the named recipient, its employee or its agent, please notify us
immediately and permanently destroy this message and any copies you
may have. Ce message est destin? uniquement aux destinataires d?ment
nomm?s. Il peut contenir de l'information privil?gi?e ou
confidentielle. Si vous n'?tes pas le destinataire d?ment nomm?, son
employ? ou son mandataire, veuillez nous aviser sans tarder et
supprimer ce message ainsi que toute copie qui peut en avoir ?t? faite.
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.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.