View previous topic :: View next topic
|
Author |
Message |
swati1977
New User
Joined: 01 Aug 2012 Posts: 5 Location: India
|
|
|
|
Hi ,
I just wanted to confirm if PLISAXC parser can be used for CICS transcation triggered Program/ Online program?
As per Manual, we can use it in for online process but recently I came across an issue where the following code was giving SOC4 . However, this code works fine in Batch program.
Code: |
SAXCTEST: package exports(SAXCTEST);
define alias event
limited entry( pointer, pointer, fixed bin(31) )
returns( byvalue fixed bin(31) )
options( byvalue linkage(optlink) );
.......
SAXCTEST: procedure (InpPtr) options(reentrant,fetchable) reorder;
/*necessary declaration for InpPtr is done */
dcl 1 XMLMsg based(InpPtr),
3 XML_data(33) char(32767);
XMLPtr = addr (XML_data);
/* Here it fails when triggered through online .
The reason is all GLOBAL VARIABLES are STATIC
and in CICS these are stored in Extended Readonly
Dynamic Storage Area (ERDSA) . To overwrite this storage
area is not allowed
*/
call plisaxc (eventHandler,
addr(token),
addr(XML_data(1)),
length(XML_data(1)));
end SAXCTEST;
/* PARSER EVENT HANDLER */
dcl XMLPtr pointer ;
dcl inpXML(33) char(32767) based(XMLPtr);
dcl arrCtr fixed bin(15) init(1) ;
dcl chars char(32000) based ;
start_of_document: proc(userToken)
returns( byvalue fixed bin(31) )
options( byvalue linkage(optlink) );
dcl userToken pointer;
return(0);
end;
end_of_input:proc( userToken, addr_xml, length_xml )
returns( byvalue fixed bin(31) )
options( byvalue linkage(optlink) );
dcl userToken pointer;
dcl addr_xml byaddr pointer;
dcl length_xml byaddr fixed bin(31);
arrCtr += 1;
if (arrCtr<=33) then do ;
addr_xml = addr(inpXML(arrCtr));
length_xml = length(inpXML(arrCtr));
return(0);
end;
end; /* Package end */ |
|
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
And what happens if you declare XMLPtr explicitly as AUTO? |
|
Back to top |
|
|
swati1977
New User
Joined: 01 Aug 2012 Posts: 5 Location: India
|
|
|
|
I made it AUTO and the following message was displayed during Compilation
Code: |
IBM1863I S 11 Variables declared in a PACKAGE outside of any
PROCEDURE must have the storage class STATIC, BASED or
CONTROLLED or must be DEFINED on STATIC. |
|
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Code: |
SAXCTEST: procedure (InpPtr) options(reentrant,fetchable) reorder;
/*necessary declaration for InpPtr is done */
dcl 1 XMLMsg based(InpPtr),
3 XML_data(33) char(32767);
XMLPtr = addr (XML_data); |
Why do you need an extra XMLPtr when you already have InpPtr???? |
|
Back to top |
|
|
swati1977
New User
Joined: 01 Aug 2012 Posts: 5 Location: India
|
|
|
|
Thanks for the response Prino.
Due the following reasons I have used XMLPtr
> InpPtr is local to SAXCTEST procedure and cannot be accesed by the
event handlers like END_OF_INPUT
> XMLPTR is used in END_OF_INPUT to provide the remaining XML to
parser as the input is in form of arrary of 33 elements. When PLISAXC
was invoked I passed the address of Arr(1) hence remaining input is
expected by parser in end_of_input event.
Please correct me if my understanding is wrong.
Just out of curiosity, is there any other way to pass Input XML ,an array(33), can be passed to Parser ? |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
There are very significant gaps in your PL/I knowledge...
Why are you not using the array as a single entity?[/list] |
|
Back to top |
|
|
swati1977
New User
Joined: 01 Aug 2012 Posts: 5 Location: India
|
|
|
|
I have tried sending array as single entity considering the fact that the data is in contiguous memory location. But in end_of_input I did not know how to increment the address since I did not have the address of start of array.
Is my understanding of scope of local variable insufficient ? Is it possible to use InpPtr for Parser ?
Let me know documents/links for above I can refer to enhance my knowledge. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
You can surely get the address of the start of ther array very simply:
Code: |
arr_addr = Addr(my_array); |
? |
|
Back to top |
|
|
swati1977
New User
Joined: 01 Aug 2012 Posts: 5 Location: India
|
|
|
|
Thanks Nic for your response.
Actually, I can pass the address of array to parser as mentioned however the parser fails . I have tried passing the full length of array and length of 1st element both .
sample below :
Case 1 : Address of array and full length of array (considering the fact that array data is in contiguous memory location): failed after invoking the pasrer
Error message :
start_of_document
exception return_code =0000000C, reason_code =000F3035, offset = 0
The message is not explainatory so I assumed it is due to length provided.
I reduced the length in CASE 2 below
Code: |
call plisaxc (eventHandler,
addr(token),
addr(xmldocument),
cstg(xmldocument)); |
In the above case i provided the start address of Array and complete length of array. Length is giving issue as it is on aggregate expression.
Case 2 :
Address of 1st element of array/ addr of array and length of 1st element in array. To continue parsing we need the address of rest of the array and thus I used the Global variable based on InpPtr . In the END_OF_INPUT trying to provided the next element in array until all input XML is processed.
This works fine in BATCH and FAILS in online process as mentioned in my 1st post .
Possible I have not understood the PLISAXC . It would nice if you clarify my understanding . |
|
Back to top |
|
|
|