IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

CICS Web services Assistant - Handling empty XML elements


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Kadhir A

New User


Joined: 25 Jun 2020
Posts: 3
Location: United Kingdom

PostPosted: Thu Jun 25, 2020 6:33 pm
Reply with quote

Hi, We have implemented a CICS provider pipeline and are utilizing the CICS WSA capability to parse input SOAP XML. I have used DFHWS2LS to generate the COBOL copybooks and WSBIND. My wrapper program has logic to pass data from the WSA generated COBOL copybook structure to another copybook that will be used in the application program.

The setup is working fine but I see a problem when it comes to empty XML elements that are numeric, for instance

Schema Field Definition
<element name = "Testfield" minOccurs="0" >
<simpleType>
<restriction base="integer">
<minInclusive value="0"/>
<maxInclusive value="999"/>
</restriction>
</simpleType>
<element>

WSA copybook structure
Code:
09 Testfield-num  PIC S9(9) COMP-5 SYNC.
09 Testfield          PIC 9(18) COMP-3.


Wrapper module Code:
Code:
IF Testfield-num > 0
   MOVE Testfield TO TestField-O
END-IF


If the XML has something like <Testfield></Testfield> or <Testfield/>, the corresponding WSA copybook Testfield-num field has 1 and the actual field Testfield-num has 0s. So the above code sets TestField-O to 0 which isnt correct when it comes to business logic. The expectation is the copybook field should have 0 only when the XML has <Testfield>0</Testfield>.

Will tweaking the parameters in DFHWS2LS job help? I couldn't make out from the CICS web services guide. It will be appreciated if you can help me get around this problem. We are at CICS TS version 5.4.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri Jun 26, 2020 5:15 am
Reply with quote

So your question is why Testfield-num has 1 instead of 0?
Back to top
View user's profile Send private message
Kadhir A

New User


Joined: 25 Jun 2020
Posts: 3
Location: United Kingdom

PostPosted: Fri Jun 26, 2020 4:25 pm
Reply with quote

Hi Rohit

Yes, I use the greater than 0 check to pass the actual value to the OP copybook field. So, when the XML element is empty, I thought it should not have a value 1. But it looks like Testfield-num field has 1 because there is infact an XML element( though empty). Also the Testfield has 0 here. But I cannot introduce a Testfield check for 0s like

Code:
IF Testfield-num > 0 AND (Testfield NOT = 0)
   MOVE Testfield to Testfield-O
END-IF


because 0 is a valid value that can be passed in the input XML.

To summarize, the problem here is that the Testfield-O has 0 when the corresponding XML element was empty.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri Jun 26, 2020 4:35 pm
Reply with quote

Kadhir,
Did you test when a valid value is passed what’s in Testfield-num? Also when 0 is passed to Testfield vs just element with no values then if you treat them as 0 as a good one and move forward then what’s the downside ?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts How to access web services/website? Mainframe Interview Questions 4
No new posts Calling an Open C library function in... CICS 1
No new posts How to 'Ping' a CICS region in JCL CICS 2
No new posts Parallelization in CICS to reduce res... CICS 4
Search our Forums:

Back to Top