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



Put the Return *on after the last line before On-Error, in the same manner that Chris shows Return *Off within the On-Error block.

-Kurt

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Amanda Paul
Sent: Thursday, July 05, 2012 9:47 AM
To: RPG programming on the IBM i / System i
Subject: Re: data structure question

Thanks Chris.
I use     IF statement so I can issue return *ON to return populated data structures to the caller. How do you use on-no-error  return *ON in monitor block?


________________________________
From: "Hiebert, Chris" <chris.hiebert@xxxxxxxxxxxxxx>
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Sent: Monday, 2 July 2012, 15:28
Subject: RE: data structure question

The %error only returns the error code for the prior operation. Some op-codes must be coded with a "(E)"  like CHAIN(E) for the error to be returned.

I would suggested using Monitor blocks around code that you think could fail.

Monitor;
p_dsCmpabc.wtdbrr = dsRequestIn.Company.brands.brand.branchcode;
p_dsCmpabc.wtdtyr=  dsRequestIn.Company.brands.brand.productcode;
On-error;
  // error occurred in this block.
                  pErrorDS.error = *on ;
                  doError('AGH0005':pErrorDS);
                  return *off ;
Endmon;

Alternatively, you could use a *PSSR subroutine inside the procedure to capture errors for the entire procedure.


Also, as Mark pointed out, the syntax for the ELSE is not correct. You have one extra End If.  I think you meant something like this:

                if %error() ;
                  pErrorDS.error = *on ;
                  doError('AGH0005':pErrorDS);
                  return *off ;
                else;
                  return *on;
                endif;                                   


Chris Hiebert
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Amanda Paul
Sent: Monday, June 25, 2012 9:44 AM
To: RPG programming on the IBM i / System i
Subject: data structure question

                                                     
                                                                     
 Hello
Assuming that p_dsCmpabc,p_dsCmpdef,p_dsCmpghi,p_dsCmpklm,p_dsCmpnop,p_dsCmpqrs and p_dsCmpuvw are empty DS passed in the below call, If the procedure call is successful I want to see that all these datastructures get populated, could you please let me know if I am missing  any thing?
 
Is the error handling procedure need to be repeated for each data structure so each one gets populated if there is no error?
 
 
 
 
 
 
populateGeneralRisks(client:branch:product:Company:p_dsCmpabc:p_dsCmpdef:p_dsCmpghi:p_dsCmpklm:p_dsCmpnop:p_dsCmpqrs:p_dsCmpuvw)
 
 
 
 
 
 
 
 p populateGeneralRisks...
 p                 b                   Export
 d populateGeneralRisks...
 d                 pi              N
 d pClientNo                           like(dsxxxCmpabc_Template.cltkyh)
 d                                     const
 d pBranchCode                         like(dsxxxCmphdr_File.wtdbrh)
 d                                     const
 d pProductCode                        like(dsxxxCmphdr_File.wtdtyh)
 d                                     const
 d pCompanyNo                          like(dsxxxCmphdr_File.Cmpnoh)
 d                                     const
 d p_dsCmpabc                          likeds(dsCmpabc_Template)
 d p_dsCmpdef                          likeds(dsCmpdef_Template)
 d p_dsCmpghi                          likeds(dsCmpghi_Template)
 d p_dsCmpklm                          likeds(dsCmpklm_Template)
 d p_dsCmpnop                          likeds(dsCmpnop_Template)
 d p_dsCmpqrs                         likeds(dsCmpqrs_Template)
 d p_dsCmpuvw                          likeds(dsCmpuvw_Template)
 d dsRequestIn                         likeds(Company_Template)
 d p_errorDS                           LikeDS(dsAGHErrorInfo_Template)
  *;
 
 /Free
     clear p_dsCmpabc;
     clear p_dsCmpdef;
     clear p_dsCmpghi;
     clear p_dsCmpklm;
     clear p_dsCmpnop;
     clear p_dsCmpqrs;
     clear p_dsCmpuvw;                   
                  
                  
         
 
p_dsCmpabc.wtdbrr = dsRequestIn.Company.brands.brand.
                   branchcode; p_dsCmpabc.wtdtyr=  dsRequestIn.Company.brands.brand.
                   productcode;                             
 
        
 
p_dsCmpdef.wtdbrk  = dsRequestIn.Company.brands.brand.
                    branchcode;                         
                                                       
p_dsCmpdef.wtdtyk  = dsRequestIn.Company.brands.brand.
                    productcode;                       
                                                       
p_dsCmpdef.whobrk  = dsRequestIn.Company.CompanyRisk.
                    bankruptcy.whobankrupt; p_dsCmpdef.fstnmk  = dsRequestIn.Company.CompanyRisk.
                    bankruptcy.firstname;              
 
p_dsCmpghi.wtdbrb  = dsRequestIn.Company.brands.brand.
                    branchcode;                          
                                                         
p_dsCmpghi.wtdtyb  = dsRequestIn.Company.brands.brand.
                    productcode; p_dsCmpghi.scontb  = dsRequestIn.Company.CompanyRisk.
                    ghiinessuse.selfcontainedoffice;     
 
 
  for i = 1 to %elem(brands_Template.brand);
 p_dsCmpklm(i).wtdbre  = dsRequestIn(i).Company.brands.brand.
                     branchcode;
 p_dsCmpklm(i).wtdtye  = dsRequestIn(i).Company.brands.brand.
                     productcode;
 p_dsCmpklm(i).fielde  = dsRequestIn(i).Company.CompanyRisk.
                     additionaldata.data.name;
 p_dsCmpklm(i).valuee  = dsRequestIn(i).Company.CompanyRisk.
                     additionaldata.data.value;                  
                                                                
 endfor;  
 
p_dsCmpnop.wtdbrl  = dsRequestIn.Company.brands.brand.
                    branchcode;

p_dsCmpnop.wtdtyl  = dsRequestIn.Company.brands.brand.
                    productcode;

p_dsCmpnop.prvmsl  = dsRequestIn.Company.CompanyRisk.
                    flooding.floodmeasurestaken;             
                                                             
                                                             
                                                             
p_dsCmpqrs.wtdbrf  = dsRequestIn.Company.brands.brand.
                    branchcode;

p_dsCmpqrs.wtdtyf  = dsRequestIn.Company.brands.brand.
                    productcode;

p_dsCmpuvw.wtdbrp  = dsRequestIn.Company.brands.
                    brand.branchcode;

p_dsCmpuvw.wtdtyp  = dsRequestIn.Company.brands.
                    brand.productcode;

p_dsCmpuvw.uvwyrp  = dsRequestIn.Company.CompanyRisk.
                    underuvwned.date;

p_dsCmpuvw.propfp  = dsRequestIn.Company.CompanyRisk.
                    underuvwned.proportionunderuvwned; 
                                                       
 
 
                if %error() ;
                   pErrorDS.error = *on ;
                   doError('AGH0005':pErrorDS);
                   return *off ;
                endif ;
                else;
                return *on;
                endif;                                    
                                                          
                                                           
 /End-Free p                 e  
 
========================
d Company_Template... d                 ds                  qualified  based(dummy_ptr) d brands                              likeds(brands_Template) d Companysource                         likeds(Companysource_Template) d contact                             likeds(contact_Template) d CompanyRisk                       likeds(CompanyRisk_Template)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.