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

Jon Paris <[email protected]>
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <[email protected]>
Not sure what term Barbara might use. I believe that the compiler, while still primarily single-pass, utilizes a fixup phase that resolves some data references.

 
Jon Paris
[email protected]



> On Dec 10, 2025, at 7:06 AM, Infodorado InfoDorado via RPG400-L <[email protected]> wrote:
> 
> The RPG compiler is a single-pass compiler, meaning at each line, the compiler says "sti cks, stacks, No take-backs". I've done refused to compile until I changed the order of the lines. I think it is an artifact from the days of compiling RPG from the card decks.
> 
> That would explain the order of the specs. F-specs first, D-specs second, I-specs next, then D-specs. With advances in hardware the compiler team could do procedures as part of a program. But they're still one-take compiling. 
> 
> I think I'm right on this. Maybe Barbara or Jon will tune in and confirm me on this or not.
> 
> --Alan
> 
> 
>> On 12/09/2025 4:21 PM EST Vern Hamberg via RPG400-L <[email protected]> wrote:
>> 
>> 
>> Hi Daniel
>> 
>> At first blush, I think of the differences - LIKE(...) is an internal 
>> reference, EXTNAME(....) and LIKEREC(....) are external references - 
>> certainly the former is. I think I heard something several years ago 
>> about that.
>> 
>> *Regards*
>> 
>> *Vern Hamberg*
>> 
>> IBM Champion 2025 <cid:[email protected]> CAAC 
>> (COMMON Americas Advisory Council) IBM Influencer 2023
>> 
>> 
>> On 12/9/2025 2:06 PM, Daniel Gross wrote:
>>> 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
>>>>> athttps://archive.midrange.com/rpg400-l.
>>>>> 
>>>>> Please [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
>>>> athttps://archive.midrange.com/rpg400-l.
>>>> 
>>>> Please [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.
> 

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