midrange.com code scratchpad
Name:
RPG of Sample XMLi Template using nested SQL and parameter markers
Scriptlanguage:
Plain Text
Tabwidth:
4
Date:
01/19/2011 12:33:41 am
IP:
Logged
Description:
RPG for http://code.midrange.com/63241fb4e9.html
Code:
  1.      H OPTION(*NODEBUGIO:*NOEXPDDS:*SRCSTMT)                                                        
  2.      H DFTACTGRP(*NO)                                                                               
  3.                                                                                                     
  4.       **************************************************************************                    
  5.       * This example uses XMLi to write XML in the IFS using a template.                            
  6.       *                                                                                             
  7.       * To run a template you do the following:                                                     
  8.       * 1) Tell XMLi which template to use, providing a name and IFS location.                      
  9.       * 2) Set any parameters the template will need.                                               
  10.       * 3) Run the template.                                                                        
  11.       *                                                                                             
  12.       * You only need to load once, you can set parms and run as many times as needed.              
  13.       **************************************************************************                    
  14.                                                                                                     
  15.       // BNDDIR for XMLI2...                                                                        
  16.      H BNDDIR('XMLILIB/XMLI2')                                                                      
  17.       **********************************************************************                        
  18.       // Copybook for XMLI2...                                                                      
  19.       /include xmlilib/qrpglesrc,xmli2_h                                                            
  20.       *********************************************************************                         
  21.       /free                                                                                         
  22.                                                                                                     
  23.        // Load the template...                                                                      
  24.        xmli_loadTemplate('TEMP5' : '/XMLi/Examples/Templates/Example15.xml');                       
  25.                                                                                                     
  26.        // SQL will retrieve order details for the passed customer...                                
  27.        // This template has a nested SQL statement...                                               
  28.        xmli_setParm(1 : 'CUSTOMER1');                                                               
  29.                                                                                                     
  30.        // Run the template...                                                                       
  31.        xmli_runTemplate();                                                                          
  32.                                                                                                     
  33.        // At this point the xml template has run and the result should be                           
  34.        // written to XML file /XMLi/Examples/Results/Example15.xml                                  
  35.                                                                                                     
  36.        // Unload the template...                                                                    
  37.        xmli_unloadTemplate('TEMP5');                                                                
  38.                                                                                                     
  39.        *INLR = *on;                                                                                 
  40.        return;                                                                                      
  41.                                                                                                     
  42.       /end-free                                                                                      
© 2004-2019 by midrange.com generated in 0.005s valid xhtml & css