SE53451 - OSP-CL-CMPL-PERFM ADD SUPPORT FOR %TRIM BUILT-IN FUNCTION

 APAR (Authorized Program Analysis Report)

Abstract

OSP-CL-CMPL-PERFM ADD SUPPORT FOR %TRIM BUILT-IN FUNCTION

Error Description

Add support for %TRIM built-in function                        

Problem Summary

The limitation of one string operation built-in function,      
%SUBSTRING, in CL forces application developers to spend time  
and effort on workarounds when manipulating character strings in
CL programs and CL procedures.                                  

Problem Conclusion

The original CL compiler and the ILE CL compiler will provide  
support for the following additional string operation built-in  
functions:                                                      
                                                               
%TRIM - Trim Characters at Edges                                
%TRIML - Trim Leading Characters                                
%TRIMR - Trim Trailing Characters                              
                                                               
All of these CL built-in functions will have almost the same    
behavior as the RPG built-in functions by the same name.        
The CL function names were chosen to be the same as RPG to make
the CL built-in functions as easy and intuitive for RPG        
application developers to use as possible.                      
                                                               
After this PTF is applied, you can run the CRTCLPGM, CRTCLMOD,  
or CRTBNDCL command to compile CL source code that contains the
new built-in functions.                                        
                                                               
You can specify any valid TGTRLS parameter value; the generated
code is capable of being run on V5R4 or 6.1 or 7.1 releases of  
IBM i.                                                          
                                                               
The format of the %TRIM built-in function is:                  
%TRIM(character-variable-name {characters-to-trim})            
                                                               
The %TRIM built-in function with one parameter produces a      
character string with any leading and trailing blanks removed.  
The %TRIM built-in function with two parameters produces a      
character string with any leading and trailing characters that  
are in the characters-to-trim parameter removed. This function  
can only be used within a CL program or procedure.              
                                                               
The %TRIM built-in function can be used anywhere that CL        
supports a character expression. %TRIM can be used alone or as  
part of a more complex character expression. For example, %TRIM
could be used to compare to a character CL variable in the COND
parameter of an IF or WHEN command. %TRIM can also be used to  
set the value of a CL command parameter, if the associated      
command object defines the parameter with EXPR(*YES) and TYPE of
*CHAR, *NAME, *SNAME, *CNAME, *PNAME, *GENERIC, *DATE, *TIME, or
*X.                                                            
                                                               
The %TRIM function produces a substring from the contents of the
specified CL character variable. If the characters-to-trim      
parameter is specified, it must be either a CL character        
variable or a character literal. If after trimming, no          
characters are left, the %TRIM function produces a string of    
blanks.                                                        
                                                               
The format of the %TRIML built-in function is:                  
%TRIML(character-variable-name {characters-to-trim})            
                                                               
The %TRIML built-in function built-in function with one        
parameter produces a character string with any leading blanks  
removed. The %TRIML built-in function with two parameters      
produces a character string with any leading characters that are
in the characters-to-trim parameter removed.  This function can
only be used within a CL program or procedure.                  
                                                               
The %TRIML built-in function can be used anywhere that CL      
supports a character expression. %TRIML can be used alone or as
part of a more complex character expression. For example,      
%TRIML could be used to compare to a character CL variable in  
the COND parameter of an IF or WHEN command. %TRIML can also be
used to set the value of CL command parameter, if the associated
command object defines the parameter with EXPR(*YES) and TYPE of
*CHAR, *NAME, *SNAME, *CNAME, *PNAME, *GENERIC, *DATE, *TIME, or
*X.                                                            
                                                               
The %TRIML function produces a substring from the contents of  
the specified CL character variable. If the characters-to-trim  
parameter is specified, it must be either a CL character        
variable or a character literal. If after trimming, no          
characters are left, the %TRIML function produces a string of  
blanks.                                                        
                                                               
The format of the %TRIMR built-in function is:                  
%TRIMR(character-variable-name {characters-to-trim})            
                                                               
The %TRIMR built-in function with one parameter produces a      
character string with any trailing blanks removed. The %TRIMR  
built-in function with two parameters produces a character      
string with any trailing characters that are in the            
characters-to-trim parameter removed. This function can only be
used within a CL program or procedure.                          
                                                               
The %TRIMR built-in function can be used anywhere that CL      
supports a character expression.                                
%TRIMR can be used alone or as part of a more complex character
expression. For example, %TRIMR could be used to compare to a  
character CL variable in the COND parameter of an IF or WHEN    
command.                                                        
                                                               
%TRIMR can also be used to set the value of CL command          
parameter, if the associated command object defines the        
parameter with EXPR(*YES) and TYPE of *CHAR, *NAME, *SNAME,    
*CNAME, *PNAME, *GENERIC, *DATE, *TIME, or *X.                  
                                                               
The %TRIMR function produces a substring from the contents of  
the specified CL character variable. If the characters-to-trim  
parameter is specified, it must be either a CL character        
variable or a character literal. If after trimming, no          
characters are left, the trim right function produces a string  
of blanks.                                                      

Temporary Fix

Comments

Circumvention


PTFs Available

R710 SI48166 PTF Cover Letter   3037

Affected Modules

         
         

Affected Publications

Summary Information

Status............................................ CLOSED PER
HIPER........................................... No
Component.................................. 5770SS1CL
Failing Module.......................... RCHMGR
Reported Release................... R710
Duplicate Of..............................




System i Support

    IBM disclaims all warranties, whether express or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. By furnishing this document, IBM grants no licenses to any related patents or copyrights. Copyright © 1996,1997,1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 IBM Corporation. Any trademarks and product or brand names referenced in this document are the property of their respective owners. Consult the Terms of use link for trademark information.

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

i family

Software version:

V7R1M0

Operating system(s):

OS/400

Reference #:

SE53451

Modified date:

2013-02-14

Translate my page

Machine Translation

Content navigation