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


  • Subject: RE: Constant Scope
  • From: Buck Calabro <mcalabro@xxxxxxxxxxxx>
  • Date: Tue, 24 Aug 1999 11:29:36 -0400

I use these all the time on V4R3 and have never experienced a problem.  They
even show up in the cross reference as global.  Here is a snippet that
compiles and runs for me; why don't you try it on your system and see if it
works?

H Debug                                                     
H* dftactgrp(*no) actgrp(QILE) dbgview(*source)             
                                                            
 * Global constant use in a "same source" procedure         
D InputParm       s             32                          
D Answer          s              1                          
D GlobalConst     c                   'Test'                
                                                            
 * Dummy procedure to test input parm vs. global constant   
DTestParm         pr             1a                         
D Parm                                like(InputParm) const 
                                                            
C     *Entry        Plist                                   
C                   Parm                    InputParm       
                                                            
C                   eval      Answer=TestParm(InputParm)    
C     Answer        dsply     'BUCK'                        
                                                            
C                   Eval      *InLR=*On                     
C                   Return                                  
                                                            
 * Dummy procedure to test input parm vs. global constant   
PTestParm         b                                         
DTestParm         pi             1a                        
D Parm                                like(InputParm) const
                                                           
C                   If        Parm = GlobalConst           
C                   return    'Y'                          
C                   else                                   
C                   return    'N'                          
C                   endif                                  
                                                           
PTestParm         e                                        


Buck Calabro
Aptis; Albany, NY
mailto:Buck.Calabro@aptissoftware.com

> -----Original Message-----
> From: SirZetar@AOL.COM 
> Sent: Tuesday, August 24, 1999 10:21 AM
> To:   RPG400-L@midrange.com
> Subject:      Constant Scope
> 
> I searched the RPG manual, but can't find where it defines the scope of 
> global constants.  Did I miss it somewhere?
> 
> I know it defines the scope of global variables, ie, available to the main
> 
> program as well as any procedure defined in the same source member.  But I
> 
> haven't found where it would define the scope of global constants.
> 
> An assumption that global constants would have the same scope as global 
> variables doesn't play out.
> 
> When I try to use a constant, defined in the main program, in D specs in a
> 
> procedure in the same source, the compiler complains the constant is not 
> defined.  To get it to work, I have to duplicate the constant definition
> in 
> the procedure.
> 
> Is this normal, ie, is the scope of a global constant limited to the main 
> program?  Or, is this a compiler bug that needs to be reported?
> 
> OS/400 & RPG: V4R4M0, latest Cum & Hipers applied.
> 
> -Pete
> 
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.