SYSCA.XMLSLICE is a table procedure used to retrieve character or binary slices of equal length from the serialization of an XML value. It is a CA IDMS extension that has been made available to allow any client program to process large serialized XML values. It is used when neither XMLSERIALIZE (limited to 30,000 characters) nor XMLPOINTER (requires client to run in same address space as CA IDMS) can be used.
SELECT ── CAST── (── SLICE ──┬─── AS BIN (slice-size) ───┬─ ) ───────► └─── AS CHAR (slice-size) ──┘ ►──┬────────────────┬─┬─────────────────┬────────────────────────────► └─,─ TOTLENGTH ──┘ └─,─ RESTLENGTH ──┘ ►── FROM SYSCA.XMLSLICE ─┬────────────────────────────────────┬──────► └─ (slice-size) ─┬────────────────┬─)┘ └─ , X'pad-hex' ─┘ ►── WHERE ───────────────────────────────────────────────────────────► ►──┬───────────────────────────────────────────────────────────────┬─► └─ SLICESIZE = slice-size ─┬────────────────────────────┬───────┘ └─ AND PADDING = X'pad-hex' ─┘ ►── XMLVALUE = XML-value-expression ─────────────────────────────────►◄
Specifies the total length of the serialized XML value, without padding characters.
Specifies the XML data length, without padding characters, that have not been returned yet.
Specifies a table procedure that slices XML-value-expression, after serialization, into slices of equal size, specified by slice-size. Each row returned by SYSCA.XMLSLICE represents a slice.
Specifies an integer value-expression, with a positive value <= 8192. A slice-size must always be present, either as the first positional parameter of the table procedure or as the right operand in the equal predicate for SLICESIZE.
Specifies an optional two-byte hexadecimal literal that is used to pad the last slice of the serialized XML value. The default depends on the XML ENCODING parameter of the SQL SET SESSION statement. Two spaces are used for EBCDIC (X'4040') and UTF8 (X'2020'); one space is used for UTF16LE (X'2000') and UTF16BE (X'0020').
If XML-value-expression is specified as a subquery, it must be enclosed in parentheses.
The content of the slice is available in the SLICE column of the table procedure. Optionally, you can specify additional columns in the SELECT statement.
Example 1
In the following SELECT statement, all the employees in DEMOEMP.EMPLOYEE are aggregated in one XML value. This XML value is serialized, and each row returned is a 40-character slice of the serialized XML value.
select cast(slice as char(40)) from SYSCA.XMLSLICE
where slicesize = 40
and xmlvalue =
(
select xmlelement(name "employee",
xmlagg(xmlelement(name "Name",
E.EMP_LNAME)))
from DEMOEMPL.EMPLOYEE e
)
The result is similar to the following:
*+ (EXPR) *+ ------ *+ <employee><Name>Albertini </Na *+ me><Name>Alexander </Name><Nam *+ e>Anderson </Name><Name>Baldw *+ in </Name><Name>Bennett *+ </Name><Name>Bradley *+ </Name><Name>Brooks </Name *+ ><Name>Carlson </Name><Name> *+ Catlin </Name><Name>Clark *+ </Name><Name>Courtney *+ </Name><Name>Crane < *+ /Name><Name>Cromwell </Name>< *+ Name>Dexter </Name><Name>Do *+ nelson </Name><Name>Ferguson *+ </Name><Name>Ferndale *+ </Name><Name>Fordman </N *+ ame><Name>Gallway </Name><Na *+ me>Griffin </Name><Name>Hall
Example 2
This example shows the z/OS JCL for the batch command facility IDMSBCF and the SQL statements to create the z/OS dataset "CAIDMS.SAMPLE.XML" holding an XML document encoded in Unicode UTF-16 Little Endian.
The XML document contains the id and name of all employees as present in the DEMOEMPL.EMPLOYEE table.
With a binary file transfer, the dataset can be copied to other platforms for further processing. The use of the XMLSLICE table procedure allows for creating XML documents up to 2 GB.
//BCFLOCAL EXEC PGM=IDMSBCF,REGION=7500K
//STEPLIB DD DSN=CAIDMS.R160.LOADLIB,DISP=SHR
&invellip.
//SYSLST DD SYSOUT=A
//SYSOUT DD SYSOUT=A
//OUTPUT DD DSN=CAIDMS.SAMPLE.XML,DISP=(NEW,CATLG),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=16000),
// UNIT=SYSDA,SPACE=(TRK,(10,10))
//SYSIPT DD *
set options OUTPUT to OUTPUT; -- redirects output of BCF
set session XML Encoding utf16LE;-- requests UTF-16 LE encoding
select cast(slice as char(80))
from sysca.xmlslice(80, X'2000')-- defines slices of 80 bytes
-- padding with space in UTF-16 LE
where xmlvalue =
(select xmlroot(xmlelement(name "AllEmployees"
, xmlagg(xmlelement(name "Emp"
, xmlattributes(EMP_ID as "Id")
, EMP_FNAME ||EMP_LNAME)))
, version '1.0')
from DEMOEMPL.EMPLOYEE
)
|
Copyright © 2014 CA.
All rights reserved.
|
|