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 » How to check for NULL or empty records for DFDL Messages

Post new topic  Reply to topic Goto page 1, 2  Next
 How to check for NULL or empty records for DFDL Messages « View previous topic :: View next topic » 
Author Message
akkypaul
PostPosted: Thu Jan 28, 2016 9:29 am    Post subject: How to check for NULL or empty records for DFDL Messages Reply with quote

Apprentice

Joined: 30 Jun 2014
Posts: 44
Location: India

Which function can we used the best to ITERATE through a sequence of DFDL message (CSV Type)

Input Message Format:-
Head
-Field1
-Field2
-Field3
-Field4

Comes like
H1,F1,F2,F3,F4
H2,F1,F2,F3,F4

I was able to develop a message set which could successfully parse this message BUT I don't know what is the right way to traverse through this?

I tried using the following:-
COALESCE ->
WHILE COALESCE(InputRoot.DFDL.InputMsg.Rows[counter],'') = NULL DO
-> Does not gets inside the loop

IS NOT NULL ->
WHILE InputRoot.DFDL.InputMsg.Rows[counter] IS NOT NULL DO ->
Does not gets inside the loop

LASTMOVE ->
WHILE LASTMOVE(InputRoot.DFDL.InputMsg.Rows[counter]) DO
<Some Function gets executed>
MOVE InputRoot.DFDL.InputMsg.Rows NEXTSIBLING REPEAT NAME TYPE;
END WHILE;
- This gives me an error that says "MOVE InputRoot.DFDL.InputMsg.Rows NEXTSIBLING" has been used illegally.

CARDINALITY ->
DECLARE varTotalDataRecords INTEGER CARDINALITY(InputRoot.DFDL.InputMsg.Rows);
-> Gives me a deployment error stating that the CARDINALITY function needs a list as an input not NOT 1.
>>>> How is this possible that it is picking 1 when I am feeding a list to it?

So, nothing is working. Is there anyone who can explain me where am I wrong?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jan 28, 2016 9:50 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

It's not a DFDL message, or a CSV type.

It's a logical message tree.

You reference each piece of any logical message tree in the same way.

A basic read through of the ESQL functions available should provide you several easy ways to iterate over a set of child nodes, without having to do any of the poor ideas you've shown.

Also, consider what part of the message tree you are actually looping over. Is it Rows? Or the children of Rows?
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
akkypaul
PostPosted: Thu Jan 28, 2016 9:59 am    Post subject: It is the children of the rows and the rows Reply with quote

Apprentice

Joined: 30 Jun 2014
Posts: 44
Location: India

When I made the DFDL parser for this input message, I created a CSV message model 5 fields of comma separated values.
I used the LASTMOVE method in one of my previous interfaces where it worked perfectly.
I understand that once the message from the file has been parsed into the logical message tree, it can be treated like an XML and the iterative functions can be applied over it. But its not helping.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jan 28, 2016 10:01 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Again.

Are you looping over InputRoot.DFDL.InputMsg.Rows[counter], or InputRoot.DFDL.InputMsg.Rows ?

Again.

There are easier functions to use.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
akkypaul
PostPosted: Thu Jan 28, 2016 10:04 am    Post subject: Reply with quote

Apprentice

Joined: 30 Jun 2014
Posts: 44
Location: India

UPDATE:-

CARDINALITY is working.
I used the wrong syntax for CARDINALITY which was not include the square brackets!!

CARDINALITY -> RESOLVED
DECLARE varTotalDataRecords INTEGER CARDINALITY(InputRoot.DFDL.InputMsg.Rows[]);
-> Deployed successfully and now I am able to traverse though the records based on the classic counter incremental method.

BUT, this is way too old and can hamper performance in long run.
I need a better reliable method which can simply check for NULLs or empty rows.
Back to top
View user's profile Send private message
akkypaul
PostPosted: Thu Jan 28, 2016 10:07 am    Post subject: Reply with quote

Apprentice

Joined: 30 Jun 2014
Posts: 44
Location: India

@mqjeff

I am actually using a reference.

DECLARE inpRef REFERENCE TO InputRoot.DFDL.InputMsg.Rows[1];

WHILE LASTMOVE(inpRef) DO

<Some Function gets executed>

MOVE inpRef NEXTSIBLING REPEAT NAME TYPE;

END WHILE;
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jan 28, 2016 10:19 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Ok.

So your message description doesn't show anything named "Rows". You show a bunch of header records, each of which has fields.

It's also not clear if you need to iterate over a set of elements named "Rows", or each child of a single element named "Rows".

It's also confusing to me that you have not bothered to go look for an easier function to use. Or if you have, you haven't mentioned it.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
akkypaul
PostPosted: Thu Jan 28, 2016 10:23 am    Post subject: Reply with quote

Apprentice

Joined: 30 Jun 2014
Posts: 44
Location: India

FYI:-

This is with reference to an article in IBM Knowledge Center:-
https://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/bj28653_.htm

At the very bottom, they have showcased come of the ideas on how to iterate through message who have repeating records.
I tried a similar approach but failed.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jan 28, 2016 11:39 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

https://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ak05030_.htm

Again.

Are you looping over InputRoot.DFDL.InputMsg.Rows[] or over InputRoot.DFDL.InputMsg.Rows.[]

Given that your cardinality worked, it seems like you are looping over Rows[] and not Rows.[]
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
akkypaul
PostPosted: Thu Jan 28, 2016 12:19 pm    Post subject: Reply with quote

Apprentice

Joined: 30 Jun 2014
Posts: 44
Location: India

Yes.
I am looping over the first option i.e. InputRoot.DFDL.InputMsg.Rows[].
The one without the DOT between Rows and Square Brackets [].

So, do you mean to say that I should be using
InputRoot.DFDL.InputMsg.Rows.[] when I am using the LASTMOVE way of iteration?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jan 28, 2016 12:23 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I'm saying you need to use whichever one matches your logical message tree.

Which doesn't, apparently, match your message description. In that you didn't provide any relationship between "Rows" and "H1" or "H2" or etc.

And, I'm saying you should use the For statement, not anything else.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Jan 28, 2016 12:24 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

akkypaul wrote:
Yes.
I am looping over the first option i.e. InputRoot.DFDL.InputMsg.Rows[].
The one without the DOT between Rows and Square Brackets [].

So, do you mean to say that I should be using
InputRoot.DFDL.InputMsg.Rows.[] when I am using the LASTMOVE way of iteration?


You should be using the one that correctly matches your message tree.

The dot means something; it describes the relationship between data items.

So Rows.[] and Rows[] are describing 2 different locations in the message tree. The first describes all the Rows in your tree. The second describes all the children of the first Rows in your tree.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
akkypaul
PostPosted: Thu Jan 28, 2016 12:37 pm    Post subject: Reply with quote

Apprentice

Joined: 30 Jun 2014
Posts: 44
Location: India

Thank you Vitor!

Quote:

So Rows.[] and Rows[] are describing 2 different locations in the message tree. The first describes all the Rows in your tree. The second describes all the children of the first Rows in your tree.


So, considering my input file looks like:-
H1,F1,F2,F3,F4
H2,F1,F2,F3,F4
H3,F1,F2,F3,F4

And after parsing, it becomes:-
MessageSet
-----Row
-------Header - H1
-------Field1 - F1
-------Field2 - F2
-------Field3 - F3
-------Field4 - F4
-----Row
-------Header - H2
-------Field1 - F1
-------Field2 - F2
-------Field3 - F3
-------Field4 - F4
-----Row
-------Header - H3
-------Field1 - F1
-------Field2 - F2
-------Field3 - F3
-------Field4 - F4

I should be using Row.[] so, that it has all the rows of the of the message.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Jan 28, 2016 2:21 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

akkypaul wrote:
I should be using Row.[] so, that it has all the rows of the of the message.


No, because I'm utterly insane and have clearly not taken my meds today!

Vitor wrote:

So Rows.[] and Rows[] are describing 2 different locations in the message tree. The second describes all the Rows in your tree. The second describes all the children of the first Rows in your tree.


Note the subtle but significant correction above.... (!)

Rows[] is the collection of Rows (3 in your example)
Rows.[] is the collection of 5 objects (H1 - F4) under the first Rows in your example, because of the dot. Rows[2].[] would be the second collection of objects H2 - F4 and so on.

I echo the advice of my most worthy associate; a FOR loop can and should be used to iterate such structures.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Simbu
PostPosted: Fri Jan 29, 2016 1:58 am    Post subject: Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

akkypaul wrote:
@mqjeff

I am actually using a reference.

DECLARE inpRef REFERENCE TO InputRoot.DFDL.InputMsg.Rows[1];

WHILE LASTMOVE(inpRef) DO

<Some Function gets executed>

MOVE inpRef NEXTSIBLING REPEAT NAME TYPE;

END WHILE;


Hi, FOR LOOP can be the best option for this which eliminated LASTMOVE and MOVE.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to check for NULL or empty records for DFDL Messages
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.