Hi Guys,
In Continuation of my previous post.
The ILE RPG precompilers support an XML host variable type:
To exchange XML data between the database server and an embedded SQL application, you need to declare host variables in your application source code.
To declare XML host variables in embedded SQL applications, in the declaration section of the application declare the XML host variables AS LOB data types
Here are some examples of XML host variables in ILE RPG applications.
XML AS CLOB example
The following declaration:
D XMLCLOB S SQLTYPE(XML_CLOB:3000)
Results in the generation of the following structure:
D XMLCLOB DS
D XMLCLOB_LEN 10U
D XMLCLOB_DATA 3000A
XML AS DBCLOB example
The following declaration:
D XMLDBCLOB S SQLTYPE(XML_DBCLOB:400)
Results in the generation of the following structure:
D XMLDBCLOB DS
D XMLDBCLOB_LEN 10U
D XMLDBCLOB_DATA 400G
XML AS BLOB example
The following declaration:
D XMLBLOB S SQLTYPE(XML_BLOB:780)
Results in the generation of the following structure:
D XMLBLOB DS
D XMLBLOB_LEN 10U
D XMLBLOB_DATA 780A
Notes:
1. For XML_BLOB and XML_CLOB, 1 ≤ lob-length ≤ 16 773 100.
2. For XML_DBCLOB, 1≤ lob-length ≤ 8 386 550.
3. XML host variables cannot be initialized.
XML locators
Here is an example of an XML locator.
XML locator example
The following declaration:
D XMLLOC S SQLTYPE(XML_LOCATOR)
Results in the following generation:
D XMLLOC S 10U
Notes:
1. XML locators are allowed to be declared in host structures.
2. SQLTYPE, XML_LOCATOR can be in mixed case.
3. XML locators cannot be initialized.
XML file reference variables
Here is an example of a XML file reference variable in ILE RPG.
XML file reference example
The following declaration:
D XMLFILE S SQLTYPE(XML_CLOB_FILE)
Results in the generation of the following structure:
D XMLFILE DS
D XMLFILE_NL 10U
D XMLFILE_DL 10U
D XMLFILE_FO 10U
D XMLFILE_NAME 255A
XML_BLOB_FILE and XML_DBCLOB_FILE file reference variables have similar syntax.
Notes:
1. XML file reference variables are allowed to be declared in host structures.
2. XML file reference variables cannot be initialized.
Do write me @ iSeriesblogs@gmail.com for any query or you can simply post comments below.
Happy Learning
No comments:
Post a Comment