ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » XML to DB2... handling null values

Post new topic  Reply to topic
 XML to DB2... handling null values « View previous topic :: View next topic » 
Author Message
bpugh
PostPosted: Tue Apr 27, 2004 7:17 am    Post subject: XML to DB2... handling null values Reply with quote

Novice

Joined: 27 Apr 2004
Posts: 24
Location: St. Louis, MO

Forgive my ignorance, but I am new to WBIMB. I am trying to receive an XML file and insert the data into a DB2 database on z/OS. All of the fields on my DB2 database are specified as "Not Null", and I am not in a position to change that.

My schema has default values such as the following:

<xsd:element name="title" type="xsd:string" minOccurs="0" default=" "/>
<xsd:element name="first" type="xsd:string" minOccurs="0" default=" "/>
<xsd:element name="mi" type="xsd:string" minOccurs="0" default=" "/>
<xsd:element name="last" type="xsd:string" minOccurs="0" default=" "/>

If I receive a file that looks like this (notice there is no middle initial)

<title>Mr.</title>
<first>John</first>
<last>Doe</last>

my trace nodes show the "mi" field as null, not blank. This causes my database insert to blow up. I know I could take the minOccurs="0" off and require all fields, but that seems like a waste since the schema has many fields and I know that most of them will not be used most of the time.

Any ideas for a rookie on how to force it to see that field as blank, not null?
Back to top
View user's profile Send private message
GYR
PostPosted: Wed Apr 28, 2004 5:08 am    Post subject: Reply with quote

Acolyte

Joined: 23 Jan 2002
Posts: 72

You don't show how your doing your insert, is it via compute node or via an insert node. i would suggest that you use a compute node and construct the insert using the COALESCE function i.e

insert into Database.schema.table (fielda,fieldb...etc) values(COALESCE('InputBody.*.xxxxxxxx, ' ',.........etc) that way if any of your values come in as null then blank will be used instead which is more amenable to mainframe and iseries DB2 databases.

Just a thought
Back to top
View user's profile Send private message
bpugh
PostPosted: Wed Apr 28, 2004 5:58 am    Post subject: Reply with quote

Novice

Joined: 27 Apr 2004
Posts: 24
Location: St. Louis, MO

Thanks for the advice. I am using the compute node, so that's an easy change to make.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » XML to DB2... handling null values
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.