IBM SC41-5210-04 Server User Manual


 
VARGRAPHIC Query for iSeries function
The VARGRAPHIC scalar function provides a way to convert:
v character data (SBCS and Mixed) to DBCS graphic.
v character data (SBCS and Mixed) to UCS2 graphic.
v UCS2 graphic to UCS2 graphic.
v DBCS graphic to UCS2 graphic.
The VARGRAPHIC function returns a graphic string representation of a string expression.
The first argument must be a string expression and must not be bit data.
The second argument, if specified as length, is the length attribute of the result and must be an integer
constant between 1 and 16370 if the first argument is not nullable or between 1 and 16369 if the first
argument is nullable.
If the second argument is not specified or DEFAULT is specified, the length attribute of the result is the
same as the length attribute of the first argument.
In the following rules, S denotes one of the following:
v If the string expression is a host variable containing data in a foreign encoding scheme, S is the result
of the expression after converting the data to a CCSID in a native encoding scheme.
v If the string expression is data in a native encoding scheme, S is that string expression.
If the third argument is specified, the CCSID of the result is the third argument. It must be a DBCS or
UCS2 CCSID. The CCSID cannot be 65535.
If the third argument is not specified, the CCSID of the result is determined by a mixed CCSID, let M
denote that mixed CCSID. M is determined as follows:
v If the CCSID of S is a mixed CCSID, M is that CCSID.
v If the CCSID of S is an SBCS CCSID:
If the CCSID of S has an associated mixed CCSID, M is that CCSID.
Otherwise the operation is not allowed.
M Result CCSID Description
DBCS Substitution
Character
930 300 Japanese EBCDIC XFEFE
933 834 Korean EBCDIC XFEFE
935 837 S-Chinese EBCDIC XFEFE
937 835 T-Chinese EBCDIC XFEFE
939 300 Japanese EBCDIC XFEFE
5026 4396 Japanese EBCDIC XFEFE
5035 4396 Japanese EBCDIC XFEFE
The result of the function is a varying-length graphic string. If the expression can be null, the result can be
null. If the expression is null, the result is the null value. If the expression is an empty string or the
EBCDIC string X0E0F, the result is an empty string.
 VARGRAPHIC ( expression
,
length DEFAULT ,ccsid
) 
Chapter 5. Defining result fields in Query for iSeries 65