powerEXT Core
 
 
License: MIT license
 
 
API Name: PXAPICGI
 
Version: 3.0
 
API Desciption: Basic HTTP Connector and Productivity Services
 
 
The API provides basic connectivity to the Apache Server based on the CGIDEV2 API from IBM.

The API has the following main methods groups:
 

  • Basic HTTP I/O support and ILOB management (CGIDEV2 connect and enhance)

    initiate: clearSrvPgm()

    http input: getExtInput(), getExtEnvVar(), getExtVar(), getExtVarNum(), inputAddr(), inputSize()

    build ILOB: setContent(), setExtVar(), echo(), echoAsp(), echoCgi()

    output ILOB: echoToClient(), echoBinToClient(), echoToStmf(), bufAddr(), bufSize()
     

  • Dynamic Memory Stores (the functionality and example program is there, but doc is missing pt., sorry)

    storeNew(), storeInz(), storeAppend(), storeAppendText(), storeAddr(), storeSize(), storeFree()
     

  • Structured node (HTML, XML, JSON, CSV) and encode support

    htmlNode(), htmlEndNode(), xmlNode(), xmlEndNode(), jsonNode(), jsonEndNode(), csvNode(), csvEndNode()

    encodeHTML, encodeXML, encodeJSON, encodeJAVA, encodeCSV
     

  • XML Reader, JSON/CSV to XML converters and decode support

    xmlFromStmf(), xmlToStmf(), xmlAddr(), xmlSize(),

    xmlReaderInz(), xmlReaderCase(), xmlReader()

    xmlGetNodeType(), xmlGetDepth(), xmlGetNode(), xmlGetXPath(), xmlGetXPathJson(), xmlGetAttr(), xmlGetData(), xmlGetDataNum()

    xmlAddrOuter(), xmlSizeOuter(), xmlAddrInner(), xmlSizeInner()

    jsonToXML(), csvToXML()

    decodeXML(), decodeJSON()
     

  • Internal code generation tabulation support

    setGlobalTab(), setGlobalNL(), tab(), tabEnd(), tabClear(), NL()
     

  • Misc.

    timeStamp(), uniqueKey(), isoFromNum(), isoToNum(), numMaxValue() qCmd()
     

  •  
    Public Methods
     
     
    clearSrvPgm()
     
    Clears the General Service API's global variables (Tab counters and default settings and Tag array's for Markup Language Node Support)

    Parameters:

    o None

    Returns:

    o None

     
     
    getExtInput()
     
    Retrieves all input from the browser, this must be done before any variables can be retieved in getExtVar or getExtVarNum

    Parameters:

    o None

    Returns:

    o None

     
     
    inputAddr()
     
    Returns the HTTP Input Buffer memory address pointer.

    Parameters:

    o None

    Returns:

    o Pointer

     
     
    inputSize()
     
    Returns the HTTP Input Buffer length.

    Parameters:

    o None

    Returns:

    o Length

     
     
    getExtEnvVar(variable name:[default value])
     
    Retrieves an Environment variable from the HTTP server

    Parameters:

    o Variable Name - the name of the variable to be retrieved

    o Default Value (optional) - The default value to be returned if the variable name is not defined in the input

    Returns:

    o The content value or the default value

     

    RPGLE Coding example:

    	ipaddr = getExtEnvVar('REMOTE_ADDR':'*unknown*');
    	
    			
     
     
    getExtVar(variable name:[default value])
     
    Retrieves an alphanumeric variable from the input from a browser (GET/POST)

    Parameters:

    o Variable Name - the name of the variable to be retrieved

    o Default Value (optional) - The default value to be returned if the variable name is not defined in the input

    Returns:

    o The content value or the default value

     

    RPGLE Coding example:

    	CSNAME = getExtVar('custname':CSNAME);
    	
    	if 'custname' is defined in the input string from the browser it is passed to CSNAME
    	otherwise the content is preserved (passed to itself)
    			
     
     
    getExtVarNum(variable name:[default value])
     
    Retrieves a numeric variable from the input from a browser (GET/POST)

    Parameters:

    o Variable Name - the name of the variable to be retrieved

    o Default Value (optional) - The default value to be returned if the variable name is not defined in the input

    Returns:

    o The content value or the default value

     

    RPGLE Coding example:

    	CSNBR = getExtVarNum('custnbr':CSNBR);
    	
    	if 'custnbr' is defined in the input string from the browser it is passed to CSNBR
    	otherwise the content is preserved (passed to itself)
    			
     
     
    setContent([type])
     
    Clears the Responce Object (HTTP Output Buffer) and set's the content-type

    Parameters:

    o Type (optional) if not set the content-type defaults to text/html, if type = *none, only the buffer is cleared

    Returns:

    o None

     
     
    setExtVar(variable name:string)
     
    Updates a variable name with content

    Parameters:

    o Variable Name - the name of the variable to be set

    o String - The value to be set

    Returns:

    o None

     

    RPGLE Coding example:

    	setExtVar('custname':%trimr(CSNAME));   // alphanumeric
    	setExtVar('custnbr':%char(CSNBR));      // numeric
    	setExtVar('custdate':%char(CSDATE));    // date
    	
    	alphanumeric is passed in the length they have, if they have to be trimmed this must be done
    	in the call
    	
    	numeric must be passed with either %char, %editc or %editw.
    	
    	date's must be passed with %char
    			
     
     
    echo(string:[tabs boolean]:[NL boolean])
     
    writes the string to the Responce Object (HTTP Output Buffer) encapsulated with a number of tabs and a NL if globalTabs is true and globalNL is true

    Parameters:

    o String - the string to be written

    o tabs boolean (optional) - overrides the globalTabs setting

    o NL boolean (optional) - overrides the globalNL setting

    Returns:

    o None

     

    RPGLE Coding example:

    	echo('Customer Name: ' + encodeHTML(%trimr(CSNAME)));      // alphanumeric HTML encoded 
                                                                    (see the encode methods described later)
    	echo('Customer Number: ' + %char(CSNBR));                  // numeric
    	echo('Customer Date: ' + %char(CSDATE));                   // date
    			
     
     
    echoAsp(stmf:section)
     
    writes a section from a streamfile to the Responce Object (HTTP Output Buffer) with section tags and variable tags coded in ASP syntax. The streamfile dosn't have to reside in the Apache Directives. The variables must have been initialized with setExtVar method before writing.

    section tags are defined as <!--#tag="...."--> (Note: no blanks between "..")

    variable tags are defined as <% .... %> (Note: the blanks between the % .. %)

    Parameters:

    o Stmf - file name to be written from

    o Section - Section to be written

    Returns:

    o None

     

    RPGLE Coding example:

    	echoAsp('/powerExt/STD/alpha.asp':'alphagrid'); 
        
    	Part of input template file:
    	
    	<!--#tag="alphagrid"-->         
    		{header: "<% pxGridHeading %>"
    		,width: <% pxGridWidth %>     
    		,dataIndex: "<% pxField %>"   
    		,align: "<% pxGridAlign %>"   
    		} 
    
    	CGIDEV2 tags and variables are ignored, only ASP tags and variables are updated
    	so the result will look like:
    	
    		{header: "Description"
    		,width: 200
    		,dataIndex: "XAHEAD"
    		,align: "left"
    		}
    		   
     
     
    echoCgi(stmf:section)
     
    writes a section from a streamfile to the Responce Object (HTTP Output Buffer) with section tags and variable tags coded in CGIDEV2 syntax. The streamfile dosn't have to reside in the Apache Directives. The variables must have been initialized with setExtVar method before writing.

    section tags are defined as <powerEXT>..... (Note: must end with a CR and/or LF immediatly after the tag name)

    variable tags are defined as /%....%/ (Note: no blanks between the %..%)

    Parameters:

    o Stmf - file name to be written from

    o Section - Section to be written

    Returns:

    o None

     

    RPGLE Coding example:

    	echoCgi('/powerExt/STD/alpha.asp':'alpha'); 
                      
    	Part of input template file:
    				  
    	<powerEXT>alpha                                                       
    	// ------------------------------------------------------------------ 
    	// Field Name: /%pxField%/  /%pxDescription%/   Template: alpha       
    	// ------------------------------------------------------------------ 
                                                                          
    	<!--#tag="alphagrid"-->         
    		{header: "<% pxGridHeading %>"
    		,width: <% pxGridWidth %>     
    		,dataIndex: "<% pxField %>"   
    		,align: "<% pxGridAlign %>"   
    	}
    
    	ASP tags and variables are ignored only CGIDEV2 tags and variables are updated
    	so the result will look like (with ASP syntax ready to launch from the template
    	with central metadata at any time) :
    	
    	// ------------------------------------------------------------------ 
    	// Field Name: alpha   alphanumeric field    Template: alpha                              
    	// ------------------------------------------------------------------ 
                                                                          
    	<!--#tag="alphagrid"-->                                               
    		{header: "<% pxGridHeading %>"                                      
    		,width: <% pxGridWidth %>                                           
    		,dataIndex: "<% pxField %%gt;"                                         
    		,align: "<% pxGridAlign %>"                                         
    		}                                                                   
    		   
       
     
    echoCgiDev2(stmf:section:[secDelStr]:[secDelEnd]:[varDelStr]:[varDelEnd])
     
    writes a section from a streamfile to the Responce Object (HTTP Output Buffer) with section tags and variable tags coded in CGIDEV2 default syntax. The streamfile dosn't have to reside in the Apache Directives. The variables must have been initialized with setExtVar method before writing.

    section tags are defined as /$..... (Note: must end with a CR and/or LF immediatly after the tag name)

    variable tags are defined as /%....%/ (Note: no blanks between the %..%)

    Parameters:

    o Stmf - file name to be written from

    o Section - Section to be written

    o SecDelStr - Start Section delimiter override (optional)

    o SecDelEnd - End Section delimiter override (optional)

    o VarDelStr - Start Variable delimiter override (optional)

    o VarDelStr - End Variable delimiter override (optional)

    Returns:

    o None

     

    RPGLE Coding example:

    	echoCgi('/powerExt/STD/alpha.asp':'alpha'); 
                      
    	Part of input template file:
    				  
    	/$alpha                                                       
    	// ------------------------------------------------------------------ 
    	// Field Name: /%pxField%/  /%pxDescription%/   Template: alpha       
    	// ------------------------------------------------------------------ 
                                                                          
    	<!--#tag="alphagrid"-->         
    		{header: "<% pxGridHeading %>"
    		,width: <% pxGridWidth %>     
    		,dataIndex: "<% pxField %>"   
    		,align: "<% pxGridAlign %>"   
    	}
                                  
    		   
     
     
    echoToClient()
     
    writes the content of the Responce Object (HTTP Output Buffer) to the browser

    Parameters:

    o None

    Returns:

    o None

     
     
    echoBinToClient(contentType:stmf)
     
    writes the content of a binary stmf to the browser

    if the content type is "text/..." the stmf file is automatically translated by apache, if the content type starts with anyting else it is passed as binary.

    Parameters:

    o Content Type.

    o Stmf - file name to be written to browser

    Returns:

    o Return Code - 0=success

     

    RPGLE Coding example:

    	echoBinToClient('application/pdf':'/powerExt/STD/myfile.pdf'); 
    			
     
     
    echoToStmf(stmf:ccsid)
     
    writes the content of the Responce Object (HTTP Output Buffer) to a stream file

    Parameters:

    o Stmf - file name to be written to

    o Ccsid (optional) - the ccsid the result is encoded in.

    Returns:

    o None

     

    RPGLE Coding example:

    	echoToStmf('/powerExt/STD/CSNAME.asp':'1208'); 
    			
     
     
    bufAddr()
     
    Returns the Responce Object (HTTP Output Buffer) memory address pointer.

    Parameters:

    o None

    Returns:

    o Pointer

     
     
    bufSize()
     
    Returns the Responce Object (HTTP Output Buffer) length.

    Parameters:

    o None

    Returns:

    o Length

     
     
    htmlNode(tag:[attributes]:[string]:[truncate])
     
    writes a HTML Node to the Responce Object (HTTP Output Buffer)

    This is part of the general node support that supports a number of markup languages based on the parent, child and sibling constructers and keeps track of where the system are in the hierarchical tree data structure.

    Se also the following htmlEndNode method that puts it al together

    the htmlNode method evokes the encodeHTML method automatically, so there is no need to use any encoding of data strings.

    Parameters:

    o Tag - the HTML tag to be written

    o Attributes (optional) - the HTML Attributes to be assosiated to the node

    o String (optional) - The string of data in the node, if no data is passed the node becomes a parent otherwise a child.

    o Truncate boolean (optional) - should trailing blanks be truncated in data, defaults to true

    Returns:

    o None

     

    RPGLE Coding example:

    	htmlNode('table':'class="standard"');
    
    	will output an open node:		<table class="standard">
    	
    	htmlNode('tr');
    	
    	will output an open node:		<tr>
    	
    	htmlNode('td':'class="stdcm"':CSNAME);
    	
    	will output a closed node:		<td class="stdcm">Acme Corporation &amp; partners</td>
    
    	htmlNode('td':'class="stdcm"':'');
    	
    	will output a closed node 
    	without content:			<td class="stdcm"></td>			
    			
     
     
    htmlEndNode([tag])
     
    writes the end of the last parent HTML Node to the Responce Object (HTTP Output Buffer)

    Parameters:

    o Tag (optional) - overrides the parent tag end node to be written

    Returns:

    o None

     

    RPGLE Coding example:

    	htmlEndNode();
    	
    	This is how the htmlNode and the htmlEndNode method's works together and
    	builds and terminates the hierarchical tree:
    	
    	htmlNode('table':'class="standard"');
    	  htmlNode('tr');
    	    htmlNode('td':'class="stdcm"':CSNAME);
    	    htmlNode('td':'class="stdcm"':'');
    	  htmlEndNode();
    	htmlEndNode();
    	
    	Results in:
    	
    	<table class="standard">
    		<tr>
    			<td class="stdcm">Acme Corporation &amp; partners</td>
    			<td class="stdcm"></td>
    		</tr>
    	</table>
    			
     
     
    xmlNode(tag:[attributes]:[string]:[cdata]:[truncate])
     
    writes a XML Node to the Responce Object (HTTP Output Buffer)

    This is part of the general node support that supports a number of markup languages based on the parent, child and sibling constructers and keeps track of where the system are in the hierarchical tree data structure.

    Se also the following xmlEndNode method that puts it al together

    the xmlNode method evokes the encodeXML method automatically, so there is no need to use any special encoding of data strings.

    Parameters:

    o Tag - the XML tag to be written

    o Attributes (optional) - the XML Attributes to be assosiated to the node

    o String (optional) - The string of data in the node, if no data is passed the node becomes a parent otherwise a child.

    o Cdata boolean (optional) - pass the string data as is encapsulated in <![CDATA[ ... ]]> , defaults to false

    o Truncate boolean (optional) - should trailing blanks be truncated in data, defaults to true

    Returns:

    o None

     

    RPGLE Coding example:

    	xmlNode('customer':'id="123456"');
    
    	will output an open node:		<customer id="123456">
    	
    	xmlNode('customerName':'':CSNAME);
    	
    	will output a closed node:		<customerName>Acme Corporation &amp; partners</customerName>
    
    	xmlNode('customerAtr':'currency="USD"':'');
    	
    	will output a closed node:		<customerAtr currency="USD" />
    
    	xmlNode('customerName':'':CSNAME:*on);
    	
    	will output a closed node:		<customerName><![CDATA[Acme Corporation & partners]]></customerName>
    			
     
     
    xmlEndNode([tag])
     
    writes the end of the last parent XML Node to the Responce Object (HTTP Output Buffer)

    Parameters:

    o Tag (optional) - overrides the parent tag end node to be written

    Returns:

    o None

     

    RPGLE Coding example:

    	xmlEndNode();
    	
    	This is how the xmlNode and the xmlEndNode method's works together and
    	builds and terminates the hierarchical tree:
    	
    	xmlNode('customer':'id="123456"');
    	    xmlNode('customerName':'':CSNAME);
    	    xmlNode('customerAddress':'':CSADR1);
    	xmlEndNode();
    	
    	Results in:
    	
    	<customer id="123456">
    			<customerName>Acme Corporation &amp; partners</customerName>
    			<customerAddress>IT Street 123456</customerAddress>
    	</customer>
    			
     
     
    jsonNode(type:[attribute]:[value]:[truncate])
     
    writes a JSON Node to the Responce Object (HTTP Output Buffer)

    This is part of the general node support that supports a number of markup languages based on the parent, child and sibling constructers and keeps track of where the system are in the hierarchical tree data structure.

    The special in the JSON structure are that siblings are separated with a , (comma), the JSON methods keeps track and inserts automatically these comma's in the generation.

    Se also the following jsonEndNode method that puts it al together

    the jsonNode method evokes the encodeJSON method automatically, so there is no need to use any special encoding of data strings.

    Parameters:

    o Type - the type of JSON object to be written

        *object

        *array

        *string

        *number

        *boolean

    o Attribute (optional) - the JSON Attribute to be assosiated to the node

    o Value (optional) - The value of data in the node, *object and *array are always parents all other types a childs.

    o Truncate boolean (optional) - should trailing blanks be truncated in data, defaults to true

    Returns:

    o None

     

    RPGLE Coding example:

    	jsonNode('*object');  			
    	
    	  results in: {
    	
    	jsonNode('*array':'rows');
    	
    	  results in: "rows": [
    	
    	jsonNode('*string':'XAXAID':XAXAID);
    
    	  results in: "XAXAID": "PX"
    	
    	jsonNode('*number':'XARCUD':%trim(%editc(XARCUD:'P')));
    	
    	  results in: "XARCUD": 1
    	
    	jsonNode('*boolean':'XAXXID':'true');
    	
    	  results in: "XAXXID": true
    			
     
     
    jsonEndNode([tag])
     
    writes the end of the last parent JSON Node to the Responce Object (HTTP Output Buffer)

    Parameters:

    o Tag (optional) - overrides the parent type end node to be written

    Returns:

    o None

     

    RPGLE Coding example:

    	jsonEndNode();
    	
    	This is how the jsonNode and the jsonEndNode method's works together and
    	builds and terminates the hierarchical tree:
    
    	jsonNode('*array':'rows');	
    		jsonNode('*object');                                          
    			jsonNode('*number':'RRN':%char(RRN));                        
    			jsonNode('*string':'XAXAID':XAXAID);                   
    			jsonNode('*string':'XAHEAD':XAHEAD);                   
    			jsonNode('*string':'XAXJID':XAXJID);                   
    			jsonNode('*string':'XARCST':XARCST);                   
    			jsonNode('*string':'XARCDC':XARCDC);                   
    			jsonNode('*number':'XARCUD':%trim(%editc(XARCUD:'P')));
    		jsonEndNode();                                                
    	jsonEndNode();                                                
    	
    	Results in:
    
    	"rows": [
    		{
    			"RRN": 16
    			,"XAXAID": "PX"
    			,"XAHEAD": "powerExt Application Framework"
    			,"XAXJID": ""
    			,"XARCST": "A"
    			,"XARCDC": "D"
    			,"XARCUD": 1
    		}
    	]
    			
     
     
    csvNode(string)
     
    writes a CSV Node to the Responce Object (HTTP Output Buffer)

    Se also the following csvEndNode method that puts it al together

    the csvNode method evokes the encodeCSV method automatically, so there is no need to use any special encoding of data strings.

    Parameters:

    o String - The string of data in the node.

    Returns:

    o None

     

    RPGLE Coding example:

    	csvNode('abcd');
    	csvNode(FieldAlpha);
    	csvNode(%char(FieldNum));
    			
     
     
    csvEndNode()
     
    writes the end of the last CSV Node to the Responce Object (HTTP Output Buffer)

    Parameters:

    o None

    Returns:

    o None

     

    RPGLE Coding example:

    	csvEndNode();
    	
    	This is how the csvNode and the csvEndNode method's works together and
    	builds and CSV row string:
    	
    	csvNode('abcd');
    	csvNode(FieldAlpha);
    	csvNode(%char(FieldNum));
    	csvEndNode();
    	
    	Results in (if called twice):
    	
    	"abcd","This is a ""alpha"" field",1234567,
    	"abcd","This is a ""alpha"" field",1234567,
    	
    			
     
     
    xmlFromStmf(filename)
     
    Reads a entire textbased XML File (or other) from the IFS into the program memory.

    Parameters:

    o File Name

    Returns:

    o returncode (0 = Successfull)

     

    RPGLE Coding example:

    	xmlFromStmf('/powerEXT/STD/PX/functions/pxwkpxxr.xml');
    
    			
     
     
    xmlToStmf(filename:%addr:%size:CCSid)
     
    Writes a block of data (see also powerEXT stores) from memory into an IFS file.

    Parameters:

    o File Name in the IFS

    o %addr - memory address

    o %size - memory size

    o CCSid - the file name CCSID (automatic conversion will be done)

    Returns:

    o none

     

    RPGLE Coding example:

    	xmlToStmf('/powerEXT/STD/PX/functions/pxwkpxxr.xml':%addr(data):%len(data):1208);
    
    			
     
     
    xmlAddr()
     
    Returns the xmlFromStmf Buffer memory address pointer.

    Parameters:

    o None

    Returns:

    o Pointer

     

    RPGLE Coding example:

    	myAddr = xmlAddr();
    
    			
     
     
    xmlSize()
     
    Returns the xmlFromStmf Buffer length.

    Parameters:

    o None

    Returns:

    o Length

     

    RPGLE Coding example:

    	mySize = xmlSize();
    
    			
     
     
    xmlFree()
     
    Deallocates xmlFromStmf Buffer memory used.

    Parameters:

    o None

    Returns:

    o None

     

    RPGLE Coding example:

    	xmlFree();
    
    			
     
     
    xmlReaderInz(address:length)
     
    initializes the xmlReader with the addres and the length of the XML file to be read.

    Parameters:

    o address - storage address for the XML file

    o length - the length of the file

    Returns:

    o None

     

    RPGLE Coding example:

    	// Internal XML file
    	xmlReaderInz(%addr(postData):%len(postData));
    
    	// External XML file (read by xmlFromStmf)
    	xmlReaderInz(xmlAddr:xmlSize);
    	
    			
     
     
    xmlReaderCase(case)
     
    initializes the xmlReader with a fixed case when returning node and XPath names.

    If not given nodenames and XPath is returned in mixed case.

    Parameters:

    o case - U, returns node names in uppercase, L - returns node names in lover case

    Returns:

    o None

     

    RPGLE Coding example:

    	xmlReaderCase('U');
    	
    			
     
     
    xmlReader, xmlGet...'s()
     
    the xmlReader reads throug the xml files elements and returns either a

    P - parent element

    A - attribute element

    D - data (child) element

    E - end element

    P, A and D elements may first be return several times for each attribute

    P elements are always returned once afterwards without attribute and without data

    D elements are always returned once afterwards without attribute but with element data

    D elements are always returned as closing element directly after the data element

    E elements that closes parent elements are returned when met

    Parameters xmlReader:

    o none

    Returns:

    o Boolean - 0: data is in the buffers, 1: end of file

     

    Parameters xmlGetNodeType, xmlGetDepth, xmlGetNode, xmlGetXPath, xmlGetXPathJson, xmlGetAttr, xmlGetData, xmlGetDataNum:

    o none

    Returns:

    o Element data (Type, Depth, Nodename, XPath, XPathJson, Attribute, Data, Numeric Data)

     

    RPGLE Coding example:

    	xmlFromStmf('/powerEXT/STD/PX/functions/pxwkpxxr.xml');
    	xmlReaderInz(xmlAddr:xmlSize); 			
    	dow xmlReader = 0;                             
    		select;
    			when xmlGetNode = 'AccessRequest' and xmlGetAttr = 'xml:lang';
    				language = xmlGetData;
    			when xmlGetNode = 'AccessLicenseNumber' and xmlGetAttr = '';
    				license = xmlGetData;
    			when xmlGetNode = 'UserId' and xmlGetAttr = '';
    				user = xmlGetData;
    			when xmlGetNode = 'Password' and xmlGetAttr = '';
    				password = xmlGetData;
    			when xmlGetNode = '/AccessRequest';
    				// process the request
    		endsl;				
    	enddo;
    	xmlFree();
    
    	Raw output Example reading an XML file without any selection:
    	loop values of
    	xmlGetNodeType 		xmlGetNode		xmlGetAttr		xmlGetData
    		P  		?xml                    version             	1.0                  
    		P  		?xml                                                             
    		A  		ns:attrNode             thisAttribute       	ABC                  
    		A  		ns:attrNode             atr2                	second               
    		A  		ns:attrNode                                                      
    		P  		AccessRequest           xml:lang            	en-US                
    		P  		AccessRequest                                                    
    		D  		AccessLicenseNumber                         	mylicense            
    		E  		/AccessLicenseNumber                                             
    		D  		UserId                                      	myuser               
    		E  		/UserId                                                          
    		D  		Password                                    	mypassword           
    		E  		/Password                                                        
    		E  		/AccessRequest                                                   
    		P  		?xml                    version             	1.0                  
    		P  		?xml                                                             
    		P  		TrackRequest            xml:lang           	en-US                
    		P  		TrackRequest                                                     
    
    			
     
     
    xmlAddrOuter, xmlSizeOuter, xmlAddrInner, xmlSizeInner()
     
    The methods returns the outer or inner elements addess and size at EndNode

    Parameters:

    o None

    Returns:

    o Pointer/Size

     

    RPGLE Coding example:

    		when xmlGetNode = '/AccessRequest';
    			myAddrOuter = xmlAddrOuter();
    			mySizeOuter = xmlSizeOuter();
    			myAddrInner = xmlAddrInner();
    			mySizeInner = xmlSizeInner();
    
    			
     
     
    jsonToXML(%addr,%size)
     

    The JsonToXML method builds a XML tree of an JSON Object

    Parameters:

    o %addr - The %addr of the string of data to be converted

    o %size - The %size of the string of data to be converted

    Returns:

    o None

     

    RPGLE Coding example:

    		Fixed Length Field:
    		jsonToXML(%addr(xmlString):%len(%trimr(xmlString)); 
    
    		Varying Field:
    		jsonToXML(%addr(xmlString)+2:%len(xmlString); 
    
    		From IFS File:
    		xmlFromStmf('/testfile.json');
    		jsonToXML(xmlAddr:xmlSize); 
    
    		Input:
    		{success:false, "msg": "This is a test"}
    		
    		Result:
    		<object depth="1">         
    			<success>false</success>  
    			<msg>This is a Test</msg> 
    		</object>                  
    		
    			
     
     
    csvToXML(%addr,%size)
     

    The csvToXML method builds a XML tree of CSV rows

    Parameters:

    o %addr - The %addr of the string of data to be converted

    o %size - The %size of the string of data to be converted

    Returns:

    o None

     

    RPGLE Coding example:

    		Fixed Length Field:
    		csvToXML(%addr(csvString):%len(%trimr(csvString)); 
    
    		Varying Field:
    		csvToXML(%addr(csvString)+2:%len(csvString); 
    
    		From IFS File:
    		xmlFromStmf('/testfile.csv');
    		csvToXML(xmlAddr:xmlSize); 
    
    		Input:
    		"abcd","This is a ""alpha"" field",1234567,
    		"abcd","This is a ""alpha"" field",1234567,
    		
    		Result:
    		<row rrn="1">         
    			<column1>abcd</column1>  
    			<column2>This is a &quot;alpha&quot; field</column2> 
    			<column3>1234567</column3>  
    		</row>                  
    		<row rrn="2">         
    			<column1>abcd</column1>  
    			<column2>This is a &quot;alpha&quot; field</column2> 
    			<column3>1234567</column3>  
    		</row>                  
    		
    			
     
     
    encodeHTML(string)
     
    Strings of data has to be encoded according to rules of the markup language, this so they are not misunderstod by the program that reads the markup language.

    The HTML characters are: " & ' < > [ ]

    Parameters:

    o String - The string of data to be encoded

    Returns:

    o Encoded String

     

    RPGLE Coding example:

    	CSNAMEW = encodeHTML(CSNAME); 
    			
     
     
    encodeXML(string)
     
    Strings of data has to be encoded according to rules of the markup language, this so they are not misunderstod by the program that reads the markup language.

    The special XML characters are: " & ' < > [ ]

    Parameters:

    o String - The string of data to be encoded

    Returns:

    o Encoded String

     

    RPGLE Coding example:

    	CSNAMEW = encodeXML(CSNAME); 
    			
     
     
    encodeJSON(string)
     
    Strings of data has to be encoded according to rules of the markup language, this so they are not misunderstod by the program that reads the markup language.

    The special JSON characters are: " \

    Parameters:

    o String - The string of data to be encoded

    Returns:

    o Encoded String

     

    RPGLE Coding example:

    	CSNAMEW = encodeJSON(CSNAME); 
    			
     
     
    encodeJAVA(string)
     
    Strings of data has to be encoded according to rules of the markup language, this so they are not misunderstod by the program that reads the markup language.

    The special JAVA characters are: " ' \

    Parameters:

    o String - The string of data to be encoded

    Returns:

    o Encoded String

     

    RPGLE Coding example:

    	CSNAMEW = encodeJAVA(CSNAME); 
    			
     
     
    encodeCSV(string)
     
    Strings of data has to be encoded according to rules of the markup language, this so they are not misunderstod by the program that reads the markup language.

    The special CSV characters are: "

    Parameters:

    o String - The string of data to be encoded

    Returns:

    o Encoded String

     

    RPGLE Coding example:

    	CSNAMEW = encodeCSV(CSNAME); 
    			
     
     
    decodeXML(string)
     
    Strings of XML data has to be decoded according to rules of the markup language, this so they are not misunderstod by the program that reads the markup language.

    The special XML characters are: " & ' < > [ ]

    Parameters:

    o String - The string of data to be decoded

    Returns:

    o Decoded String

     

    RPGLE Coding example:

    	CSNAMEW = decodeXML(CSNAME); 
    			
     
     
    decodeJSON(string)
     
    Strings of JSON data has to be decoded according to rules of the markup language, this so they are not misunderstod by the program that reads the markup language.

    The special JSON characters are: " \

    Parameters:

    o String - The string of data to be decoded

    Returns:

    o Decoded String

     

    RPGLE Coding example:

    	CSNAMEW = decodeJSON(CSNAME); 
    			
     
     
    setGlobalTab(boolean)
     
    Sets generation of tabulated code on/off

    Working with markup languages and hierarchical tree data structures represents a challenge if the data isn't presentet in a tabular way. The API has a number of methods that ensures prober tabulation an insertsions of New Lines in the generated code.

    However, in production mode tabulation and new lines may be up to 20% of the send datastream so therefore this can be switched off at different levels by this and the following methods

    Parameters:

    o Boolean *on/*off

    Returns:

    o None

     
     
    setGlobalNL(boolean)
     
    Sets generation of New Line (NL) on/off

    se also the setGlobalTab method

    Parameters:

    o Boolean *on/*off

    Returns:

    o None

     
     
    tab()
     
    Add's 1 to the Tabulation Counter

    se also the setGlobalTab method

    Parameters:

    o None

    Returns:

    o None

     
     
    tabEnd()
     
    Subtracts 1 from the Tabulation Counter

    se also the setGlobalTab method

    Parameters:

    o None

    Returns:

    o None

     
     
    tabClear()
     
    Sets the Tabulation to 0

    se also the setGlobalTab method

    Parameters:

    o None

    Returns:

    o None

     
     
    NL()
     
    Returns a New Line and a string of tabs according to the Tabulation Counter

    se also the setGlobalTab method

    Parameters:

    o None

    Returns:

    o String af one NL and a number of tabulations

     
     
    timeStamp()
     
    Returns a timestamp with all 6 decimals in MS

    Parameters:

    o None

    Returns:

    o Timestamp

     
     
    uniqueKey()
     
    Returns a truly unique 32 bytes key for session and request management

    Parameters:

    o None

    Returns:

    o Uniquekey

     
     
    isoFromNum(numericDate:format:length)
     
    Converts a numeric field to a date in *ISO format (yyyy-mm-dd)

    Parameters:

    o numeric Date

    o format - *DMY/*YMD/*MDY

    o length - 6/8

    Returns:

    o Date string in *ISO format

     
     
    isoToNum(isoDate:format:length)
     
    Converts a *ISO (yyyy-mm-dd) date string to a numeric field

    Parameters:

    o iso Date String

    o format - *DMY/*YMD/*MDY

    o length - 6/8

    Returns:

    o Numeric date

     
     
    numMaxValue(fieldLength:fieldDecimals)
     
    Returns a max value of a numeric field i JSON format

    Parameters:

    o fieldLength

    o fieldDecimals

    Returns:

    o Numeric max value string - ex. 999999.99

     
     
    qcmd(command)
     
    Runs a CL command

    Parameters:

    o Command - CL command to be run

    Returns:

    o None