Re: Why you shouldn't be afraid to use VARCHAR in RPGLE

Daniel Gross <[email protected]>
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <[email protected]>
Hi Doug,

I had some more time, and tried some code.

In fact - it is absolutely no problem, to have a LIKE(...) definition even if the original field is defined "later" in the code.

But if the original fields are defined with EXTNAME(...) or LIKEREC(...) this definition must be defined and the LIKE(...) definition has to follow it.

I don't know why this is the case - and I cannot find something about this in the Info Center. Maybe someone with deeper knowledge of the RPG compiler can help here - Barbara? Jon?

HTH
Daniel


> Am 09.12.2025 um 01:48 schrieb Marco Facchinetti <[email protected]>:
> 
> Hi Douglas, just move the Ds declaration before the varchar one:
> 
> dcl-ds  frf_control  extname('CONTROL');
> 
> dcl-s  p_folder             varchar(%len(actclon1));
> 
> HTH
> --
> Marco Facchinetti
> 
> Mr S.r.l.
> 
> Tel. 035 962885
> Cel. 393 9620498
> 
> Skype: facchinettimarco
> 
> 
>> Il giorno lun 8 dic 2025 alle ore 15:56 DEnglander--- via RPG400-L <
>> [email protected]> ha scritto:
>> 
>> Marco,
>> 
>> I tried what you listed, and it won't compile. I am running V7R4, with TR
>> 10. What version are you running?
>> 
>> 
>> This is the line in my program:
>> 
>> dcl-s  p_folder             varchar(%len(actclon1));
>> 
>> ACTLON1 is a field in file CONTROL.
>> 
>> I also have this a little further down in the source:
>> 
>> dcl-ds  frf_control  extname('CONTROL');
>> 
>> I get the RNF3320. What is even more strange in this program, is that I
>> also have the CONTROL file opened for input in an F spec, and the compiler
>> still is complaining. But the message appears to show its complaining
>> about the varchar(%len()), not the actual field definition itself. That is
>> why I'm thinking I need to maybe have TR 11 installed first.
>> 
>> Thank you,
>> 
>> Douglas Englander
>> Senior Programmer/Analyst
>> The C. D. Hartnett Company – Corporate Offices
>> 1-817-594-3813  ext. 1636
>> 
>> "CONFIDENTIALITY NOTICE:  This e-mail transmission (and/or the attachments
>> accompanying it) contain confidential information belonging to the sender.
>> The information is intended only for the use of the intended recipient.  If
>> you are not the intended recipient, you are hereby notified that any
>> disclosure, copying, distribution or the taking of any action in reliance
>> on the contents of the information is strictly prohibited.  Any
>> unauthorized interception of this transmission is illegal under the law.
>> If you have received this transmission in error, please promptly notify the
>> sender by reply e-mail, and then destroy all copies of the transmission."
>> --
>> This is the RPG programming on IBM i (RPG400-L) mailing list
>> To post a message email: [email protected]
>> To subscribe, unsubscribe, or change list options,
>> visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
>> or email: [email protected]
>> Before posting, please take a moment to review the archives
>> at https://archive.midrange.com/rpg400-l.
>> 
>> Please contact [email protected] for any subscription related
>> questions.
>> 
>> 
> --
> This is the RPG programming on IBM i (RPG400-L) mailing list
> To post a message email: [email protected]
> To subscribe, unsubscribe, or change list options,
> visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: [email protected]
> Before posting, please take a moment to review the archives
> at https://archive.midrange.com/rpg400-l.
> 
> Please contact [email protected] for any subscription related questions.
> 
-- 
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact [email protected] for any subscription related questions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.