v
If the first argument is UCS2 graphic data and the result is mixed data, the result length is (2.5*(n-1)) +
4.
The third argument, if specified, must be a valid SBCS or mixed CCSID. If it is a SBCS CCSID, the first
argument cannot be a DBCS-either or DBCS-only string.
The result of the function is the character string that would result if the character string expression was
assigned to a varying-length host variable with a length attribute of
n
, where
n
is the length attribute of the
result. If the length attribute of the argument is greater than the length attribute of the result, truncation is
performed and no warning is returned.
The result data type is VARCHAR.
If the
ccsid
(third argument) is not specified:
v
If the first argument is SBCS character, then the result is SBCS character. The CCSID of the result is
the same as the CCSID of the first argument.
v
If the first argument is mixed (DBCS-open), DBCS-only, or DBCS-either then the result is mixed. The
CCSID of the result is the same as the CCSID of the first argument.
v
If the first argument is non-UCS2 graphic, then the result is mixed. The CCSID of the result is the
associated mixed CCSID of the DBCS CCSID.
v
If the first argument is UCS2 then the CCSID of the result is the job CCSID. If the job CCSID is mixed,
then the result type is mixed. If the job CCSID is SBCS, then the result is SBCS character.
If the
ccsid
is specified:
v
The result is dependent on the specified CCSID. If
ccsid
is a SBCS CCSID, then the result type is
SBCS character. If
ccsid
is a mixed CCSID, then the result type is mixed character.
v
The CCSID of the result is the
ccsid
.
If the first argument can be null, the result can be null; if the first argument is null, the result is the null
value.
Following are examples of using VARCHAR to convert from CHARACTER to VARCHAR and UCS-2
GRAPHIC to VARCHAR:
RESCHAR
varchar(char1,10,37)
where char1 is a character field to be converted
10 is the length of the output variable
37 is the ccsid of the output variable
RESUCS2
varchar(ucs2,8,37)
where ucs2 is a UCS-2 graphic field to be converted
8 is the length of the output variable
37 is the ccsid of the output variable
Following are examples of using VARCHAR to convert from CHARACTER to VARCHAR and UCS-2
GRAPHIC to VARCHAR:
RESCHAR
varchar(char1,10,37)
where char1 is a character field to be
converted, 10 is the length of the
output variable, and 37 is the CCSID
of the output variable
RESUCS2
varchar(ucs2,8,37)
where ucs2 is a UCS-2 graphic field
to be converted, 8 is the length of the
output variable, and 37 is the ccsid of
the output variable
64
Query for iSeries Use V5R2
|
|
||||
|
|
|
|||
|
|
|
Summary of Contents for ISERIES SC41-5210-04
Page 1: ...iSeries Query for iSeries Use Version 5 SC41 5210 04 ERserver ...
Page 2: ......
Page 3: ...iSeries Query for iSeries Use Version 5 SC41 5210 04 ERserver ...
Page 12: ...x Query for iSeries Use V5R2 ...
Page 14: ...2 Query for iSeries Use V5R2 ...
Page 32: ...20 Query for iSeries Use V5R2 ...
Page 38: ...26 Query for iSeries Use V5R2 ...
Page 44: ...32 Query for iSeries Use V5R2 ...
Page 116: ...104 Query for iSeries Use V5R2 ...
Page 122: ...110 Query for iSeries Use V5R2 ...
Page 146: ...134 Query for iSeries Use V5R2 ...
Page 150: ...138 Query for iSeries Use V5R2 ...
Page 174: ...162 Query for iSeries Use V5R2 ...
Page 178: ...166 Query for iSeries Use V5R2 ...
Page 196: ...184 Query for iSeries Use V5R2 ...
Page 198: ...186 Query for iSeries Use V5R2 ...
Page 204: ...192 Query for iSeries Use V5R2 ...
Page 205: ...Part 4 Appendixes Copyright IBM Corp 2000 2002 193 ...
Page 206: ...194 Query for iSeries Use V5R2 ...
Page 210: ...198 Query for iSeries Use V5R2 ...
Page 242: ...230 Query for iSeries Use V5R2 ...
Page 256: ...244 Query for iSeries Use V5R2 ...
Page 270: ...258 Query for iSeries Use V5R2 ...
Page 272: ...260 Query for iSeries Use V5R2 ...
Page 292: ...280 Query for iSeries Use V5R2 ...
Page 293: ......
Page 294: ... Printed in U S A SC41 5210 04 ...