The process of CICS HTTP send Chinese characters

Source: Internet
Author: User
Tags character set command line http request numeric value

In China, many customers exist VSAM or DB2 information is represented by Chinese characters. How should CICS write code when it needs to exchange these Chinese messages with the outside world with the HTTP protocol? This article is presented separately from CICS as an HTTP server and two aspects of the client.

First, explain a few important concepts:

Codepage (code page)-a character set (character set) is a numeric value for a different language. For example, 037 is IBM EBCDIC encoding for American English codepage, while 1388 is EBCDIC for Chinese codepage. If you want to manipulate or display Chinese with 037 of codepage, it is not possible. The choice of codepage means which language we are using to operate. For more information, refer to the following links:

Http://en.wikipedia.org/wiki/Code_page

Character encoding (character encoding)-binary code that encodes letters and symbols in the computer. Common coding methods are Ascii,ebcdic and Unicode. For more information, refer to the following links:

Http://en.wikipedia.org/wiki/Charset

MediaType (media type)-Internet media type, which is also known as a MIME type, is called "Content-type" in the message header of the HTTP protocol. By mediatype, you can tell whether an HTTP packet is a normal format or a SOAP packet, or JSON, and so on.

1. Configure Pcomm input Chinese:

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/soft/tools/

CICS itself supports double-byte encoding, and the BMS program wants to display Chinese characters in a map or COBOL code, which requires the following simple configuration:

A. When using Pcomm for remote connections, the session parameter is set to "1388 China expansion Code". Note: Only the Chinese pcomm will have 1388 Chinese extension codes.

B. Modify map source file member, at the command line in front of member to Knock "E" (Edit), under Prompt "/"

Enter edit Entry Panel and select Edit Mixed Mode. You can enter Chinese in the source file.

C. When writing a map assembler source file, note that specifying SOSI,MAP in DFHMSD properties supports Double-byte encoding. For example, setting: Mapatts= (Color,hilight,outline,sosi).

After the above settings, you can enter and display Chinese.

2. CICS sends Chinese as HTTP server

The Web send (server) API in CICS can send Chinese information back to the client when responding to the client HTTP request.

When sending an HTTP package containing Chinese with web send, you must be aware of the following configuration:

Hostcodepage and mediatype option must be specified.

The Hostcodepage parameter value must declare a string of length 8, and the value must be "1388" (refer to the sample code below)

The parameter value of the mediatype must be a string of length 56, which is assigned the value of "text/html;" Charset=utf-8 ", which means that this is an HTTP package.

If you specify CharacterSet, the parameter value must be a string of length 40 and you need to specify "UTF-8". The UTF-8 is used here because the host and other platforms support this encoding in broad terms.

Sample programs:

*---------------------------------------------------------------*

* IBM CSDL TEST Chinese INFO *

*---------------------------------------------------------------*

Identification Division.

Program-id. TESTSC.

Environment Division.

DATA Division.

Working-storage section.

*

Work-areas.

File-info PIC X (30).

Ws-response-code.

Ws-resp PIC S9 (a) COMP-3 VALUE +0.

WS-RESP2 PIC S9 (a) COMP-3 VALUE +0.

Clnt-codepage PIC X ' UTF-8 '.

Host-codepage PIC X (8) VALUE ' 1388 '.

Ws-mediatype PIC X ' text/html; Charset=utf-8 '.

*

Linkage section.

*

Dfhcommarea.

Error-msg PIC X (50).

*

PROCEDURE Division.

Move Low-values to File-info

Move Low-values to Dfhcommarea

* Below content can be viewed in 1388 codepage

Move ' Chinese ' to File-info

EXEC CICS WEB SEND

From (File-info)

Fromlength (LENGTH of File-info)

CHARACTERSET (Clnt-codepage)

Hostcodepage (Host-codepage)

MediaType (Ws-mediatype)

RESP (WS-RESP)

RESP2 (WS-RESP2)

End-exec.

EVALUATE Ws-resp

When Dfhresp (NORMAL)

CONTINUE

When the other

Move ' SEND INFO ERROR. ' To Error-msg

Perform Normal-return

End-evaluate

*

EXIT.

*

Normal-return.

EXEC CICS return end-exec.

GOBACK.

*--------------------------------------------------------------*

In the open end, receive HTTP package, remove the content body, with utf-8,gb2312 and other character sets can be parsed out of Chinese.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.