Mixed DBCS/EBCDIC fields

The Double Byte Character Set (DBCS) is a graphic character set in which each character is represented by 2 bytes. It is a subset of the Extended Graphic Character Set (EGCS). DBCS is used to represent some Asian languages, such as Chinese, Japanese, and Korean; because each of these written languages consists of more than 256 characters that can be represented by one byte. As with EGCS, this representation is accomplished by an extension of the programmed symbol feature.

Because DBCS is a subset of EGCS, DBCS fields are specified using EGCS keywords and parameters and are treated by MFS in much the same way as EGCS data. However, DBCS data can be used in two field types, a DBCS field and a DBCS/EBCDIC mixed field. The DBCS field accepts only DBCS data and no special control characters are needed with this type of field. (The valid code range of DBCS data is X'4040', or X'41' through X'FE' for both bytes.) But, in a mixed field, where DBCS data is mixed with EBCDIC data, the DBCS data must be enclosed by SO (shift out) and SI (shift in) control characters.

Using DBCS requires display and printer devices capable of handling DBCS data. One such group of devices is the 5550 Family (as 3270); however, other 3270 DBCS devices are available.

Mixed DBCS and EBCDIC fields

When DBCS data is enclosed by SO/SI characters, a mixed field on a 3270 DBCS device accepts both EBCDIC and DBCS data. Such a mixed field can contain multiple DBCS data entries enclosed by SO/SI control characters.

The DBCS data should always be enclosed by SO/SI control characters for both inbound and outbound data to a 3270 display. However, if the data is inbound, the control characters are automatically created by the terminal. To explicitly specify DBCS/EBCDIC mixed fields, use the keywords MIX and MIXS on the EATTR= parameter of the DFLD statement.

For example, the following figure shows the case of a DBCS/EBCDIC mixed field.

The DBCS/EBCDIC mixed data shown in the following figure consists of the following 16 characters:

  • EBCDIC data 'ABCD' and 'EF' (6 bytes)
  • DBCS data 'GGGG' and 'GG' (6 bytes)
  • Two sets of SO/SI control characters (4 bytes)

The SO control character is represented by X'0E' and the SI control character is represented by X'0F'.

Figure 1. DBCS/EBCDIC mixed data
begin figure description - This figure is described in the surrounding text. end figure description

When DBCS is used, MFS sends the data directly to the 3270 display but performs SO/SI blank print processing before sending it to the SCS1 printer. The SO/SI control characters for 3270 displays and SCS1 printers are treated as follows:

  • On 3270 displays, an SO or SI control character takes up one position on the display and appears as a blank.
  • On SCS1 printers:
    • If EATTR=MIXS is specified, an SO or SI control character does not take up a position on the listing. To prevent insertion of blanks, specify EATTR=MIXS (SO/SI blank print suppress option).
    • If EATTR=MIX is specified, the SO/SI blank print option inserts a blank before an SI control character and after an SI control character in a mixed data field. Specifying MIX results in identical 3270 display output and SCS1 printer output.

The length of the mixed data containing SO/SI in the application program is different from the length of the same data on the printed output.

The length of the DBCS/EBCDIC mixed data shown in the previous figure is 16 bytes in the application program. If the string is sent to a field specified with DFLD EATTR=MIX, the data is printed as a 16-byte string. However, if sent to a field specified as DFLD EATTR=MIXS, the data is printed as a 12-byte string (4 bytes of SO/SI control characters are suppressed). The length attributes of the DFLDs are LTH=16 and LTH=12, respectively.

SO/SI control character processing

For 3270 displays, DBCS data enclosed by SO/SI control characters can be included as part of an existing EBCDIC field. When DBCS data is mixed in an existing EBCDIC field, the IMS application program must check that correct DBCS data is placed in the 3270 display field. DBCS data within an EBCDIC field is correct when the following conditions are met:

  • The length of DBCS characters is an even number of bytes.
  • There are no unpaired SO or SI control characters.

When MIX or MIXS is specified on the DFLD statement, MFS checks these conditions, aligns the DBCS data enclosed by SO/SI control characters, and corrects invalid SO/SI control characters.

DBCS/EBCDIC mixed literals

DBCS/EBCDIC mixed literals can be specified as DFLD/MFLD literals, as shown in the following code example.

    literal format:' .......SO____SI..SO__SI'
 
 DFLD
  'literal'
 
 MFLD
  ,'literal'
  ,(dlfdname,'literal')
 

The DBCS data in a DBCS/EBCDIC mixed literal is expressed as a series of Gs in the device image map in the MFS listing.

When the MFS Language utility specifies a DFLD/MFLD literal containing DBCS/EBCDIC mixed data within an EBCDIC field without specifying EATTR=, a check for mixed field is performed for both 3270 display and SCS1 printer output. A DBCS/EBCDIC mixed field attribute with EATTR=MIX is assigned for SCS1 only. The LTH parameter is ignored even if specified. As a result, the field length is the same as the length of the literal.

The following table shows the processing performed by the IMS MFS Language utility for SO/SI control characters within a DBCS/EBCDIC mixed field. The Device and Field are listed, followed by the DFLD/MFLD output literal, and the MFLD input literal.

Table 1. SO/SI processing performed by IMS MFS language utility
Device, Field DFLD/MFLD Output Literal MFLD Input Literal
3270 display, DBCS/EBCDIC mixed field
  • Check SO/SI pairing.
  • Check even length.
  • Adjust boundary alignment (with warning message).
SO/SI checking not done
SCS1 printer, DBCS/EBCDIC mixed field
  • Check SO/SI pairing.
  • Check even length.
  • Perform SO/SI correction and boundary adjustment according to SO/SI blank print option.
Not applicable

The following table shows the processing performed by the MFS message editor on SO/SI control characters within a DBCS/EBCDIC field. The Device and Field are listed, followed by the outbound data fields and the inbound data fields.

Table 2. SO/SI processing performed by MFS message editor
Device, Field Outbound Data Fields Inbound Data Fields
3270 display, DBCS/EBCDIC mixed field
  • Check SO/SI pairing.
  • Check even length.
  • Adjust boundary alignment.
SO/SI checking not done
SCS1 printer, DBCS/EBCDIC mixed field
  • Check SO/SI pairing.
  • Check even length.
  • Perform SO/SI correction and boundary alignment according to SO/SI blank print option.
Not applicable

Continuation rules for DBCS/EBCDIC mixed literals

The continuation rules for mixed literals are the same as the continuation rules for EGCS literals. The continuation rules are as follows:

  • An EGCS literal can be continued on the next line.
  • An SI character can be coded in column 70, 71, or 72 to terminate EGCS data and is not included in the literal. If an SI is in column 70, the data in column 71 is ignored, except when the character is a single quotation mark.
  • On continuation lines for literals, an SO character is not required, but can be used in column 15. (This indicates the beginning of EGCS data and is not included in the literal.)

Because mixed literals have the DBCS character string, there are some considerations for their continuation:

  • When data is mixed EBCDIC and DBCS, the DBCS data must be enclosed by SO and SI control characters. The SI characters can be located from column 70 to 72 in an EGCS literal; in a mixed literal, SO and SI are part of the user data. Therefore, you must fill the data up to column 71, put a non-blank character in column 72, and start the next line from column 15 (if SO) or from column 16. Examples of continuations in mixed literals are shown in the following code sample.
  • When the first byte of the DBCS character is in column 71, you can put a non-blank character in column 72 and put the second byte of the DBCS character in column 16 of the next line to continue the literal. Another solution is to start the first line from column 17.

Continuation in a mixed literal

Mixed Literal
'abc{K1K2K3}'def where
                  abc & def  = EBCDIC characters
                  K1K2K3     = DBCS characters
                  {          = shift out X'0E'
                  }          = shift in X'0F'
Examples of Continuations in Mixed Literals
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7...
                'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzabc{K1}
              {K2K3}def'
 
 
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7...
                'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzabc{K1K2K3}
              {}def'

SO/SI pair verification and SO/SI correction

MFS corrects unpaired SO and SI control characters found during SO/SI pair verification as follows:

  • Within a 3270 display field or SCS1 printer field with EATRR=MIX specified, all SO control characters (except the last unpaired SO control character in the field) and all duplicate SI control characters are replaced with blanks.

    For the last unpaired SO control character in the field, an SI control character is placed in either the last, or second from the last, byte so that the length of the DBCS field is even. If an SI control character is placed in the second from the last byte, the last byte is replaced by a fill character. If an SO control character is in the last byte of a field, it is replaced with a blank.

  • Within an SCS1 printer field with EATRR=MIXS specified, all SO control characters (except the last unpaired SO control character in the field) and all duplicate SI control characters are removed.

    For the last unpaired SO control character in the field, an SI control character is placed in the last, or second from the last, byte so that the length of the DBCS field is even. If the SI control character is placed in the second from the last byte, the last byte is replaced by a fill character. If an SO control character is in the last byte of a field, it is replaced with a fill character.

For SCS1 printers, all paired and unpaired SO/SI control characters exceeding the number of SO/SI pairs defined for the field are:

  • Replaced with blanks, if EATTR=MIX is specified
  • Removed, if EATTR=MIXS is specified

If the length of DBCS data within a DBCS/EBCDIC field is odd, the odd SI position is moved one byte to the left and the rest of the field is padded with blanks.

Input control and DBCS/EBCDIC mixed field (3270 display)

When sending DBCS/EBCDIC data to a DBCS/EBCDIC field, MFS checks for SO/SI pairs and even length and performs SO/SI correction and boundary adjustment if necessary. In this way, the DBCS/EBCDIC field appears correctly on the 3270 display screen or SCS1 printer output.

When receiving DBCS/EBCDIC data from a mixed field, MFS passes the data as is. This is because SO/SI pairing and even length are always ensured when using the 3270 display.

However, when sending DBCS/EBCDIC data to a DBCS/EBCDIC field and receiving user-entered DBCS/EBCDIC data from the same field, the application program must account for changes in the data. When receiving user-entered DBCS data, the 3270 display builds the data and SO/SI control characters and then truncates or realigns the data to assure SO/SI paring and even length. The IMS application program must take this into account when using a part of the send data as receive data.

DBCS/EBCDIC mixed field and horizontal tab (SCS1 printer)

When using an online horizontal tab setting, tabs are not set within a DBCS/EBCDIC field. This is because it is not possible to determine beforehand whether the actual position of the DBCS data within a mixed field is on an odd or even boundary.

Field outlining

This function is used for user-defined 3270 display and SCS1 printer fields.

Field outlines are referred to as OVER, UNDER, LEFT, and RIGHT lines and they can be specified independently or in any combination.

The area at the left and right ends of the field shown in the following figure are:

  • For 3270 displays, 3270 basic attribute bytes. The left attribute byte describes the first field; the right attribute byte describes the following field.
  • For SCS1 printers, left and right blanks, reserved for the user-defined field by MFS.
Figure 2. User field and field outlining
The user defined field is mapped against left line and right line boundaries and over line and under line boundaries.

Connecting field outlines and joining fields

You can outline multiple fields jointly as shown in the following figure.

Figure 3. Field outlining when connecting user fields
Fields A1 through I1 are outlined against fields A2 through I2.

The previous figure consists of nine logical fields. A1, B1, ... I1 are fields defined for the 3270 display and A2, B2, ... I2 are fields defined for the SCS1 printer. Note that for 3270 displays, 3270 basic attribute bytes are placed between fields. For SCS1 printers, the fields are connected without losing any print positions and the field outlines are connected. The outline specification for each field in the previous figure is shown in the following table.

Table 3. Outline specification for each field
Fields  LEFT RIGHT OVER UNDER
A1, A2 X   X  
B1, B2     X  
C1, C2   X X  
D1, D2 X   X  
E1, E2     X  
F1, F2   X X  
G1, G2 X   X X
H1, H2     X X
I1, I2   X X X

You need to define only the message field for 3270 displays in your IMS application program to produce the same output on displays and printers.

When field outlining is specified for an SCS1 printer, the MFS Language utility attempts to reserve 1 byte for the left and right lines, but if adjacent fields cannot be reserved, a warning message is issued.