International Components for Unicode APIs

The International Components for Unicode (ICU), IBM® i option 39, is a C and C++ library that provides Unicode services for writing global applications in ILE programming languages. ICU offers flexibility to extend and customize the supplied services, which include:

ICU is an open source development project sponsored, supported, and used by IBM. ICU provides over 200 APIs that you can use to process Unicode data in your ILE application. For examples that call an ICU API, see Example of RPG program calling an ICU API and Example of COBOL program calling an ICU API.

Additional information about ICU can be found at International Components for UnicodeLink outside information center.


Example of rpg program calling an icu api

This ILE RPG program example calls the u_isdigit ICU API to check whether the Unicode character is a digit.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

 H DftActGrp(*NO) BndDir('QICU/QXICUAPIBD')                                  
 DIsDigit          pr            10i 0 extproc('u_isdigit')                  
 D                               10u 0 value                                 
 DMapping          ds                                                        
 D ch                            10u 0 inz(0)                                
 D UCSChar                 3      4c                                         
 DRtnCode          s             10i 0                                       
 DTrue             c                   1                                     
 C                   eval      UCSChar = %UCS2('A')                          
 C                   eval      RtnCode = IsDigit(ch)                         
 C                   exsr      Check                                         
 C                   eval      UCSChar = %UCS2('1')                          
 C                   eval      RtnCode = IsDigit(ch)                         
 C                   exsr      Check                                         
 C                   eval      *inlr = '1'                                   
 C                   return                                                  
 C     Check         begsr                                                   
 C     UCSChar       dsply                                                   
 C                   if        RtnCode = True                                
 C     'Is digit'    dsply                                                   
 C                   else                                                    
 C     'Not digit'   dsply                                                   
 C                   endif   
 C                   endsr 
 

Example of cobol program calling an icu api

This ILE COBOL program example calls the u_isdigit ICU API to check whether the Unicode character is a digit.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

       PROCESS NOMONOPRC NATIONAL.
       IDENTIFICATION DIVISION.
       PROGRAM-ID. ISDIGIT.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  char.
           05 filler           PIC S9(04) BINARY VALUE 0.
           05 UCSChar          PIC  N(01).
       01  Rtn                 PIC S9(09) BINARY.
       PROCEDURE DIVISION.
       MAIN-LINE.
           MOVE "A" to UCSChar.
           CALL LINKAGE PRC "u_isdigit" USING BY VALUE char GIVING Rtn.
           PERFORM CHECK.
           MOVE "1" to UCSChar.
           CALL LINKAGE PRC "u_isdigit" USING BY VALUE char GIVING Rtn.
           PERFORM CHECK.
           STOP RUN.
       CHECK.
           DISPLAY UCSChar.
           IF Rtn = 1
              DISPLAY "Is digit"
           ELSE
              DISPLAY "Not digit"


[ Back to top | APIs by category ]