ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/icu.htm

148 lines
6.3 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>International Components for Unicode (ICU)</title>
<!-- Begin Header Records ========================================== -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- Change History: -->
<!-- YYMMDD USERID Change description -->
<!-- Created by Pat Glenski for V5R1 -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!-- End Header Records ============================================ -->
<!--Java sync-link ================================================= -->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<h2>International Components for Unicode (ICU)</h2>
<p><img src="delta.gif" alt="Start of change">
The International Components for Unicode (ICU), 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:</p>
<ul>
<li><strong>Text:</strong> Unicode text handling, full character properties and
character set conversions (500+ codepages)</li>
<li><strong>Analysis:</strong> Unicode regular expressions; full Unicode sets;
character, word and line boundaries</li>
<li><strong>Comparison:</strong> Language sensitive collation and
searching</li>
<li><strong>Transformations:</strong> normalization, upper/lowercase, script
transliterations (50+ pairs)</li>
<li><strong>Locales:</strong> Comprehensive locale data (230+) and resource
bundle architecture</li>
<li><strong>Complex Text Layout:</strong> Arabic, Hebrew, Indic and Thai</li>
<li><strong>Time:</strong> Multi-calendar and time zone</li>
<li><strong>Formatting and Parsing:</strong> dates, times, numbers, currencies,
messages, and rule-based</li>
</ul>
<p>ICU is an open source development project sponsored, supported, and used by
IBM<SUP>(R)</SUP>. ICU provides over 200 APIs that you can use to process Unicode data in
your ILE application. See the <a href="#xmp1">RPG example</a> and <a href=
"#xmp2">COBOL example</a> for example code that calls an ICU API.<img src="deltaend.gif" alt="End of change"></p>
<p>Additional information about ICU can be found at <a href=
"http://oss.software.ibm.com/icu/">International Components for Unicode</a><img
src="www.gif" width="18" height="15" alt=
"Link outside Information Center">.</p>
<br>
<h3><img src="delta.gif" alt="Start of change">
<a name="xmp1">Example of RPG program calling an ICU API</a></h3>
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
for information pertaining to code examples.</p>
<p>This ILE RPG program example calls the u_isdigit ICU API to check whether
the Unicode character is a digit.</p>
<pre>
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
</pre>
<br>
<h3><a name="xmp2">Example of COBOL program calling an ICU API</a></h3>
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
for information pertaining to code examples.</p>
<p>This ILE COBOL program example calls the u_isdigit ICU API to check whether
the Unicode character is a digit.</p>
<pre>
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"
</pre>
<img src="deltaend.gif" alt="End of change">
<br>
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="aplist.htm">APIs by
category</a></td>
</tr>
</table>
</center>
</body>
</html>