Comments (4)
Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).
This is an exception case. The much greater majority (95%) will use standard ASCII<>EBCDIC. We will not penalize others for the exception.
from xmlservice.
Original comment by chaks_gr (Bitbucket: chaks_gr, GitHub: Unknown).
FYI, displaying multi-lingual data on green screen is now possible with IBMi Access Client Solution.
from xmlservice.
Original comment by chaks_gr (Bitbucket: chaks_gr, GitHub: Unknown).
In my example below client RPGLE program is one of the tiers in n-tier application architecture, catering the webservice request, HTTP request...
With IBMi support for unicode (UTF8, UTF16 encoding), processing multi-lingual data is no more a barrier. (Of course displaying multi-lingual data on green screen is still a distant dream).
Following are the changes recommended to overcome the job CCSID issue to process multi-lingual data. Goal is to provide unicode (UTF8/UTF16-encoding) support for communication between client and server.
Step1- SQL Stored Procedures: ## Create new SQL stored procedures IPLUGxxY_UTF8 (for UTF8 as transport medium) and iPluGxx_UTF16 (for UTF16 as transport medium).
i.e. myXmlInp and myXmlOut should be created with CLOB(xx) CCSID(1208) for UTF8 and myXmlInp and myXmlOut should be created with DBCLOB(xx) for UTF16.
CREATE PROCEDURE QXMLSERV/IPLUG65K_UTF8 (
IN IPC CHAR(1024) ,
IN CTL CHAR(1024) ,
IN CI CLOB(66560) CCSID 1208,
OUT CO CLOB(66560) CCSID 1208)
LANGUAGE RPGLE
SPECIFIC QXMLSERV/IPLUG65K_UTF8
NOT DETERMINISTIC
MODIFIES SQL DATA
CALLED ON NULL INPUT
EXTERNAL NAME 'QXMLSERV/XMLSTOREDP(iPLUG65K_UTF8)'
PARAMETER STYLE GENERAL ;
CREATE PROCEDURE QXMLSERV/IPLUG65K_UTF16 (
IN IPC CHAR(1024) ,
IN CTL CHAR(1024) ,
IN CI DBCLOB(66560) ,
OUT CO DBCLOB(66560) )
LANGUAGE RPGLE
SPECIFIC QXMLSERV/IPLUG65K_UTF16
NOT DETERMINISTIC
MODIFIES SQL DATA
CALLED ON NULL INPUT
EXTERNAL NAME 'QXMLSERV/XMLSTOREDP(iPLUG65K_UTF16)'
PARAMETER STYLE GENERAL ;
Step2 - Client side:
• Declare xmyXmlInp and myXmlOut as CCSID(1208) for UTF8 and CCSID(1200) for UTF16
Note: ### V7R2 support CCSID(1208) as RPGLE variable, for earlier versions can try iconv api or SQL CAST at parm level
• Build xmyXmlInp string with encoding UTF8/UTF16 as required.
• Invoke the iPluGxx_UTF8 / iPluGxx_UTF16 procedure
• Process xmyXmlOut string with encoding UTF8/UTF16 as appropriate
Step3 - Server side:
• Allow support for new data types (C-UCS2 and G-Graphic) with CCSID(xxx)
• XMLSERVICE reads the myXmlInp and builds the string to invoke the program (RPGLE,...).
Note: ### While preparing the string based on the data type and CCSID (convert UTF8/UTF16 string to appropriate CCSID(xxx))
• XMLSERVICE Process the requested program (RPGLE...)
• XMLSERVICE build the output string in (UTF8 / UTF16) encoding and return it to client
Note: ### SQL can used for converting any data in CCSID(xxx) to UTF8/UTF16 encoding and viceversa. Are any other api/utility like iconv….
from xmlservice.
Original comment by Tony Cairns (Bitbucket: rangercairns, GitHub: rangercairns).
Thanks for the input.
Summary ... Use case is client RPG (your program) to server RPG (my program xmlservice), using XML, and desire for Unicode (USC2).
Protocol ... XMLSERVICE protocol is XML (possibly JSON future), so communication between client/server is a big string.
Factors ...
We must face IBM i does not allow Unicode CCSID for job description. Therefore, end-2-end coverage 'pure Unicode' is simply NOT possible. In short, always conversion in any practical application (including green screen).
I am no expert in NLS, but based on my Unix background, i believe UTF-8 is 'best' fit a increasingly Linux focused world (IBM powerpc Linux among many). UTF-8 appears even more popular in any web context (web site, mobile, etc.).
My usual answer is 'forced' conversion at connection level ctl="*pase(x) *before(x/x) *after(x/x)", NOT at the level. The idea is to convert entire XML document before XMLSERVICE starts passing to other called xmlservice services DB2, PASE, *PGM, etc. Have you tried this 'global or control' sort of solution below (variation for RPG-2-RPG)??
#!shell
Example French:
ctl = "*pase(1208) *before(297/37) *after(37/297)"
However a bug was found in *before, so you will have to use a new version of xmlservice (1.9.5+ latest).
Also, there is the idea of using xmlservice 'private' jobs. Idea is you send language match to the correct match xmlservice private job. Have you tried this 'pre-start private job' sort of solution below??
#!shell
=========
server -- pre-started XTOOLKIT jobs
=========
pre-started Japan XTOOLKIT jobs ...
SBMJOB CMD(CALL PGM(XMLSERVICE/XMLSERVICE) PARM('/tmp/JP5035-1')) JOBD(MYLIB/MY5035) ... Japan 1 (works Japan)
SBMJOB CMD(CALL PGM(XMLSERVICE/XMLSERVICE) PARM('/tmp/JP5035-2')) JOBD(MYLIB/MY5035) ... Japan 2 (works Japan)
:
SBMJOB CMD(CALL PGM(XMLSERVICE/XMLSERVICE) PARM('/tmp/JP5035-n')) JOBD(MYLIB/MY5035) ... Japan n (works Japan)
pre-started China xTOOLKIT jobs
SBMJOB CMD(CALL PGM(XMLSERVICE/XMLSERVICE) PARM('/tmp/CN1388-1')) JOBD(MYLIB/MY1388) ... China 1 (works China)
SBMJOB CMD(CALL PGM(XMLSERVICE/XMLSERVICE) PARM('/tmp/CN1388-2')) JOBD(MYLIB/MY1388) ... China 2 (works China)
:
SBMJOB CMD(CALL PGM(XMLSERVICE/XMLSERVICE) PARM('/tmp/CN1388-n')) JOBD(MYLIB/MY1388) ... China n (works China)
Add languages pre-started xTOOLKIT jobs with any matching JOBD(s) /tmp/Russia, /tmp/German, /tmp/klingon ...
=====
client -- simply pick correct XTOOLKIT jobs to match language, based on input, yes???
=====
// use XMLSERVICE to match correct language
if myinput = 5035:
myIPC = '/tmp/JP5035-' + randomNumber();
else:
myIPC = '/tmp/CN1388-' + randomNumber();
// --or-- SBJJOB for both PHP and this module
myCtl = '*sbmjob';
// call XMLSERVICE/ZZCALL(...) using XML only
myXmlIn =
'<?xml version="1.0" encoding="ISO-8859-1"?>' + x'0D'
+ '<script>' + x'0D'
+ '<pgm name="ZZCALL" lib="XMLSERVICE">' + x'0D'
:
+ '</script>' + x'00';
// XML will be returned
myXmlOut = *BLANKS;
// make call to XMLSERVICE provided stored procedure(s
// sizes from iPLUG4k to iPLUG15M (see crtsql xmlservice package)
Exec Sql call XMLSERVICE/iPLUG15M(:myIPC,:myCtl,:myXmlIn,:myXmlOut);
Again, i am no expert in NLS. If you can describe a better solution, this is the correct place.
from xmlservice.
Related Issues (20)
- Is there any example to show how to call stored procedures? HOT 18
- XMLSTOREDP service program not exporting RUNASCII HOT 1
- xmlcgi only supports password length less/equal to 10 HOT 1
- Multiple result sets HOT 2
- Add support for Free Format parameter declaration HOT 3
- Changing 'commit' option in XML SQL statement does NOT work HOT 7
- Itoolkit's iPgm - Library setup HOT 17
- How to deal with DBCS chars at IBMi db2 HOT 1
- How to fix IPLUG15M in QXMLSERV type *N not found. error HOT 2
- Stored procedures truncate result HOT 3
- How to use pure xml to call PGM/CMDwith Chinese Chars (937)? HOT 5
- Drop calling /usr/lib/start32 to bring PASE up
- spawn call overwrites instead of ORs flags HOT 1
- [feature] job name will always be XMLSERVICE HOT 2
- Qp0sDisableSignals ??? HOT 5
- Call to service program functions don't have %PARMS() set properly - ie with *NOPASS parameters and <pgm mode="ile"> HOT 3
- Calls to programs or service program functions with mode="opm" do not handle *OMIT parameters properly HOT 1
- Fix copyright headers on source files
- Properly escape content in built CDATA blobs HOT 1
- Connection to XMLSERVICE via OAuth credentials HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xmlservice.