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



Hi gurus,

I have an RPG procedure which I've been using successfully for a long time in 
an RPG call scenario. The procedure interfaces to a generic code table 
function, and rather than using requet codes like the older function, I've 
tried to make it use the parameter list to work out what it needs to do.
 
I've found a need to use the same procedure via a CL program and have 
successfully compiled the CL as a module and created a program from it, but it 
keeps failing when it executes. 
I created a simple test harness to help me keep it simple while I got to grips 
with using CALLPRC. 

Here are the components:

Prototype:

 DgetTblCde        PI             1N   opdesc 
 D  TblNme                        8A   const                                    
 D  TblCde                       20A   varying const                            
 D  TblDte                        8S 0 options(*omit) const                     
 D  TblCdeVlu                   256    options(*omit :*nopass :*varsize)        
 D  TblCdeDes                    30    options(*nopass)                         
 D  TblStrDte                     8S 0 options(*nopass)                         
 D  TblEndDte                     8S 0 options(*nopass)  

Usage in an RPGLE program (this works!):

     C                   IF        NOT getTblCde( 'STATUSGP' 
     C                                              : 'N'    
     C                                              : *OMIT  
     C                                              : rwlsts 
     C                                              )                           
   

Snippet of code from th procedure:

 D ODParmID        S             10I 0                                 
 D nDescType       S             10I 0                                 
 D nDataType       S             10I 0                                 
 D nDescInf1       S             10I 0                                 
 D nDescInf2       S             10I 0                                 
 D nBufLen         S             10I 0                                 
  *                                                                    
  * Get the exact size of the parameter passed in. Should normally be a
  * a DS overlay, but it doesn't matter.                               
  * We will have to ensure that we only return 'nBufLen' characters    
  * out of the CTLXX field.                                            
  * We only do this if the request is for 4 or more parameters,        
  * indicating that the user wants the value returned.                 
  * -------------------------------------------------------------------
 C                   IF        %PARMS > 3 and %addr(TblCdeVlu) <> *null
 C                   CALLB(D)  'CEEDOD'                                
 C                   PARM      4             ODParmID                  
 C                   PARM                    nDescType 
 C                   PARM                    nDataType
 C                   PARM                    nDescInf1
 C                   PARM                    nDescInf2
 C                   PARM                    nBufLen  
 C                   PARM                    *OMIT    
 C                   ENDIF                            
  *                                                   
  * Which request code is used depends on whether a da
  * --------------------------------------------------
 C                   EVAL      CtlId= TblNme          
 C                   EVAL      CtlCd= TblCde  

The procedure crashes at the last statement                       


The CL code I'm using to invoke the procedure:

           PGM        /* declare */                             
           DCL        VAR(&PATH) TYPE(*CHAR) LEN(256)           
           DCL        VAR(&RETURN) TYPE(*CHAR) LEN(1)           
           DCL        VAR(&TBLCD) TYPE(*CHAR) LEN(20) +         
                        VALUE('EDITRNSFER          ')           
           CALLPRC    PRC(GETTBLCDE) PARM(('STATUSGP' *BYREF) + 
                      ('N' *BYref) (*OMIT) (&PATH)) +         
                      RTNVAL(&RETURN)                         
           ENDPGM                                               

Error at execution:

 Job 793744/PANTZOM/QPADEV003T started on 03/03/06 at 12:03:31 in subsystem Q
 RNX0115 received by procedure MXP002CL. (C D I R) 
 

Message . . . . :   RNX0115 received by procedure MXP002CL. (C D I R)         
Cause . . . . . :   ILE Control language (CL) procedure MXP002CL in module    
  MXP002CL in program MXP002CL in library ANVMXP detected an error at         
  statement number 0000000600.  Message text for RNX0115 is: Length of varying
  length variable is out of range.  Use F10 (if available) or the Display Job 
  Log (DSPJOBLOG) command to see the messages in the job log for a more       
  complete description of what caused the error.  If you still are unable to  
  solve the problem, please contact your technical support person.            
Recovery  . . . :   This inquiry message can be avoided by changing the       
  procedure. Monitor for the error (MONMSG command) and perform error recovery
  within the procedure.  To continue, choose a reply value.                   
Possible choices for replying to message . . . . . . . . . . . . . . 
. :                                 
When I debug the code in the procedure it fails at the last line above and look 
at the value for ctlcd, it contains -

TBLCDE = 'ITRNSFER          '

Notice that it is 22 bytes long. I presume this is because the prototype 
declares it as varying. It need to be varying because different table entries 
have different code look-up values. At this point the debugger has stopped at 
the statement and when i press F10 I get:

Length of varying length variable is out of range:

 Message ID . . . . . . :   RNX0115       Severity . . . . . . . :   50       
 Message type . . . . . :   Diagnostic                                        
 Date sent  . . . . . . :   03/03/06      Time sent  . . . . . . :   12:26:50 
                                                                              
 Message . . . . :   Length of varying length variable is out of range.       
 Cause . . . . . :   The length of a varying length character or DBCS variable
   is less than 0 or greater than its declared maximum length in RPG procedure
   GETTBLCDE in program ANVMXP/MXP002CL.                                      
 Recovery  . . . :   Contact the person responsible for program maintenance to
   determine the cause of the problem.    

Unfortunately, I'm the person responsible!

The declared length is 20. It's varying so I presume it's really 22. The passed 
in parameter is actually defined as 20.
 
I'm presuming it's something I've done with the way I've written the CALLPRC 
command in the CL.
Or have I just done something stupid?

Any clues would be gratefully accepted.                                    .


Mike Pantzopoulos

EIG-Ansvar Limited


*********************************************************************************************************
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you are not the intended recipient, any use, disclosure or copying of this 
message is unauthorised. If you have received this message in error, please 
reply using the sender's email address. 

This footnote confirms that this email message has been scanned for computer 
viruses. EIG-Ansvar Limited does not accept liability for any loss or damage, 
whether caused by our own negligence or not, that results from a computer virus 
or defect in the transmission of this email or any attached file. 

EIG-Ansvar Limited - Australia (A.B.N. 21 007 216 506)
Email : insure@xxxxxxxxxxxxxxxx

Eig-Ansvar Limited - New Zealand
Email : insure@xxxxxxxxxxxxxxxx

*********************************************************************************************************


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.