Sorry, spoke too soon.  Too early in the morning here.  You are, as usual,
correct.  
Jerry C. Adams
IBM i Programmer/Analyst
Give me a smart idiot over a stupid genius any day. - Samual Goldwyn
--
A&K Wholesale
Murfreesboro, TN
615-867-5070
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Jerry C. Adams
Sent: Monday, April 02, 2012 8:47 AM
To: 'RPG programming on the IBM i / System i'
Subject: RE: procedure question
Tommy,
I'll defer to your expertise any day, but that's not what I see.  What I see
is newAgentNumber returning a signed (i.e., unpacked) value.  But eAgentNo
is defined as 11 0, which makes it packed.
Jerry C. Adams
IBM i Programmer/Analyst
Any man who goes to a psychiatrist ought to have his head examined. - Samuel
Goldwyn
--
A&K Wholesale
Murfreesboro, TN
615-867-5070
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Tommy.Holden@xxxxxxxxxxxxxxxxxxxxx
Sent: Monday, April 02, 2012 8:35 AM
To: RPG programming on the IBM i / System i
Subject: Re: procedure question
Sent too soon...but your call is setup to receive a agent number. 
Indicator <> agent number...
From:   murali dhar <hydchap1@xxxxxxxxx>
To:     RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>, 
Date:   04/02/2012 08:30 AM
Subject:        procedure question
Sent by:        rpg400-l-bounces@xxxxxxxxxxxx
I am trying to replace subroutine &local procedure in my RPGLE program to
create a module. In my RPGLE I have a subroutine and use a local procedure
to return the value  of AgentNmber(AGENOQ). I wrote a module  to combine
both subroutine and local procedure into one and trying to return same agent
no. I get the error "the type of factor 2 is not the same as as the type of
return value of procedure"" in the code  (return AgentNOQ ; ) . Please help
to correct the 
error.                                                        
                                                                   
  
 My RPGLE:
                                                                 begsr 
@NewAgentNo;                                          
                                                            
 // local procedure newAgentNumber allocates the next Agent 
 eAgentNo = newAgentNumber(eBrandCode:eProductCode) ;   
endsr;
    
 p newAgentNumber...                                        
 p                 b                                        
                                                            
 d                 pi            11s 0                      
 d brand                          2a   value                
 d product                        3a   value                
                                                            
  /free                                                     
                           
   if not %open(CVSFile) ;                                   
      open CVSFile ;                                         
   endif ;                                                  
   
   chain(e) (brand:product) CVSFile ;                        
   dow %status(CVSFile) = 1218 ;                                    
       chain(e) (brand:product) CVSFile ;                           
   enddo ;                                                         
                                                                   
   
   if %found(CVSFile) ;                                             
      AGENOQ += 1 ;                                                
      update RCVSFile ;                                             
   endif;                                                          
                                                                   
   return AGENOQ ;                                                 
                                                                   
  /end-free                                                        
                                                                   
 p newAgentNumber...                                               
 p                 e  
========================
=======================================================================
      
My module:
------------
p getnewAgentNumber...                                   
p                 b                   Export                       
                                                                   
d getnewAgentNumber...                                   
d                 pi                  Like(*inLR)                  
d eClientNo                     11  0                              
d eBrandCode                    2a                                
d eProductCode                   3a                                
d eAgentNo                      11  0                              
d x_errorDS                           LikeDS(dsErrorInfo_Template)
 *;                                                                
                                                                   
 /Free                                                             
/free                                                     
                           
   if not %open(CVSFile) ;                                   
      open CVSFile ;                                         
   endif ;                                                  
   
   chain(e) (brand:product) CVSFile ;                        
   dow %status(CVSFile) = 1218 ;                                    
       chain(e) (brand:product) CVSFile ;                           
   enddo ;                                                         
                                                                   
   
   if %found(CVSFile) ;                                             
      AGENOQ += 1 ;                                                
      update RCVSFile ;                                             
   endif;
   eval eAgentNo = 
AGENOQ;                                                         
                                                                   
   return AgentNOQ ;                                                 
                                                                   
                                          
            if %error;                                               
            x_errorDS.error = *on;                                   
             doError('AAA0001':x_errorDS);                           
             return *off;                                            
                      
             Else;                                             
             return *on;                                       
             Endif;                                            
             close CVSFile;                                     
    /End-Free                                                  
   p                 e 
--
This is the RPG programming on the IBM i / System i (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.
--
This is the RPG programming on the IBM i / System i (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.
--
This is the RPG programming on the IBM i / System i (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.
 
As an Amazon Associate we earn from qualifying purchases.