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



This is one of those API that are already correctly prototyped for you in
the RPGiv.com download sight.
www.rpgiv.com/downloads then click on "API Prototypes" (the QCPYSRC file).
-Bob


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Jonathan Mason
Sent: Thursday, April 28, 2005 1:29 AM
To: 'RPG programming on the AS400 / iSeries'
Subject: Convert Case (QLGCNVCS) gives error CPF3BEB

I'm putting together what should be a simple procedure to convert the
case of a text string to Upper, Lower or Title (mixed) case depending on
the parameters.
 
However, every time I call the procedure I'm getting message ID CPF3BEB
(Type of request not valid) in the Error Code structure.  I've been
through the code over and over again, and everything looks as I'd expect
- which means I'm missing something fairly obvious.
 
The prototypes I'm using and the error code data structure are:
 
D CvtCase         Pr         32767a   Varying           
D  String                    32767a   Const Varying     
D  Mode                         10a   Const             
                                                        
D CnvValue        Pr             1a                     
D  String                      255a   Const Varying     
                                                        
D QlgConvertCase  Pr                  ExtPgm('QLGCNVCS')
D  RqsCtlBlock               32767a   Const Varying     
D  InpData                   32767a   Const Varying     
D  OutData                   32767a   Varying           
D  LenData                      10i 0 Const             
D  ApiErrCode                         Like(ApiError)    
 
D ApiError        DS                                      
D   ApiBytes                    10I 0 Inz(%Size(ApiError))
D   ApiBytesOut                 10I 0                     
D   ApiErrID                     7A                       
D   ApiReserved                  1A                       
D   ApiErInDta                 256A                       
                                          
The procedure code is:
 
P CvtCase         b                   Export       
                                                   
D CvtCase         pi         32767a   Varying      
D  String                    32767a   Const Varying
D  Mode                         10a   Const        
                                                   
D Pos             s              5p 0              
D RtnString       s          32767a   Varying      
D Char            s              1a   Varying      
                                                   
D wStringLen      s              5p 0              
D wString         s          32767a   Varying      
                                                   
D ApiRqsCtl       Ds                               
D  RqsType                      10i 0 Inz(1)       
D  RqsCCSID                     10i 0 Inz(0)       
D  RqsCase                      10i 0                       
D  RqsReserved                  10a                         
                                                            
 * Set up API parameters...                                 
C                   If        Mode = '*UPPER'               
C                   Eval      RqsCase = 0                   
C                   Else                                    
C                   Eval      RqsCase = 1                   
C                   EndIf                                   
                                                            
C                   Eval      RqsReserved = *Allx'00'       
                                                            
 * Call the API to convert the case...                      
C                   CallP     QlgConvertCase(ApiRqsCtl     :
C                                            %Trim(String) :
C                                            RtnString     :
C                                            %Len(%Trim(String)) :  
C                                            ApiErroR)              
                                                                    
 * If any errors were detected then return the unconverted string...
C                   If        ApiBytes <> 0                         
C                   Return    %Trim(String)                         
C                   EndIf                                           
                                                                    
 * If *TITLE mode was not selected then return the result to        
 * the calling routine...                                           
C                   If        Mode <> '*TITLE'                      
C                   Return    RtnString                             
C                   EndIf                                           
                                                                    
 * As *TITLE mode was selected, we need to read through the         
 * complete (trimmed) string and convert the first character        
* of each word to upper case...                                
C                   Eval      pos = 2                           
                                                                
 * Change the mode to *UPPER...                                 
C                   Eval      RqsCase = 1                       
                                                                
C                   DoU       pos = 0 or                        
C                             pos > %Len(%Trim(RtnString))      
                                                                
 * Find the first space (if one exists)...                      
C                   Eval      pos = %Scan(' ' : RtnString : pos)
C                   If        pos <> 0 and                      
C                             pos <  %Len(%Trim(RtnString))     
C                   Eval      pos = pos + 1                     
C                   Eval      Char = %Subst(RtnString : pos)    
                                                                
C                   Eval      %Subst(RtnString : pos) = CvtCase(Char :
C                               '*UPPER')                             
C                   EndIf                                             
C                   EndDo                                             
                                                                      
C                   Eval      Char = %Subst(RtnString : 1)            
                                                                      
 * Call the API to convert the case (first character of string)...    
                                                                      
C                   Eval      %Subst(RtnString : 1) = CvtCase(Char :  
C                               '*UPPER')                             
                                                                      
 * Return the string in *TITLE mode...                                
C                   Return    RtnString                               
                                                                      
P CvtCase         e                                                   
 
Looking at the API documentation, the values in the control block all
look like they're correct.  Has anybody got any ideas on what I'm
missing here.
 
Thanks in advance
 
Jonathan                
 
-- 
This is the RPG programming on the AS400 / iSeries (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.

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.