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



In your module you've defined it to return an indicator...



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

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.