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 add variables into Environment?

Post new topic  Reply to topic
 How to add variables into Environment? « View previous topic :: View next topic » 
Author Message
sasad
PostPosted: Fri May 09, 2014 5:27 am    Post subject: How to add variables into Environment? Reply with quote

Acolyte

Joined: 30 Apr 2014
Posts: 67

Hi all,

I have developed a message flow in which I reads File from FTP using FileInput node, parse it record by record and if it record gets parsed successfully insert it into database. If not then create a log for it. After complete processing of File I want to create an log file for audit purpose. In which I want to show name of File, total records, Parsed records without errors and those with errors.

I have attached Trace node on the End of Data terminal of FileInput node. I am able to fetch file related information from LocalEnvironment but how can I maintain the number of passed and failed records?

I tried it by attaching compute node on Failure terminal of FileInput node, and adding a new variable for failed count, but that variable is not appearing on End of Data.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri May 09, 2014 5:48 am    Post subject: Re: How to add variables into Environment? Reply with quote

Grand High Poobah

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

sasad wrote:
how can I maintain the number of passed and failed records?


Use a shared variable and maintain a count.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
sasad
PostPosted: Fri May 09, 2014 5:58 am    Post subject: Reply with quote

Acolyte

Joined: 30 Apr 2014
Posts: 67

I am new to broker can you please share an example. I tried as below but it didn't worked.

SET OutputRoot.XMLNSC.SHARE.COUNT = 1;
Back to top
View user's profile Send private message
sasad
PostPosted: Fri May 09, 2014 6:46 am    Post subject: Reply with quote

Acolyte

Joined: 30 Apr 2014
Posts: 67

Well, I was able to create a Shared Variable. What I have notice in debug is that this shared variable appears only when I am under any Compute node.

I want to print value of this shared variable in a Trace. Can someone tell me how to print it to trace.

DECLARE Count SHARED INTEGER 0;


Trace Node Properties
Pattern : Failed Records : ${Environment.Count}

OR

Pattern : Failed Records : ${Count}
Back to top
View user's profile Send private message
McueMart
PostPosted: Fri May 09, 2014 8:01 am    Post subject: Reply with quote

Chevalier

Joined: 29 Nov 2011
Posts: 490
Location: UK...somewhere

I dont think you can access shared variables directly from within a Trace node (Someone will be along to correct me if i'm wrong!). What you can do is assign the value into the Environment tree in Compute node which comes before your trace node e.g.

SET Environment.Count = Count;

And then in your Trace node

${Environment.Count} should work.

If you are new to broker, one of the things you need to learn quickly is the different parts of the logical message assembly - these are:
- Root (i.e. Input/Output Root)
- Environment
- LocalEnvironment
- ExceptionList

Dont get these confused with SHARED variables. They are totally different things.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri May 09, 2014 8:21 am    Post subject: Reply with quote

Grand High Poobah

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

sasad wrote:
I want to print value of this shared variable in a Trace. Can someone tell me how to print it to trace.


a) You can't
b) You shouldn't use Trace node for anything other than debugging (like writing audit records). Aside from the overhead, if your broker administrator decides to switch off trace in your production environment to make it go faster, your audit function will stop working.

Extract the values with a Compute node then write them out with a FileOutput node.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
sasad
PostPosted: Fri May 09, 2014 8:52 am    Post subject: Reply with quote

Acolyte

Joined: 30 Apr 2014
Posts: 67

Thanks alot guys!!! Specially Vitor for the suggestion.
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 » How to add variables into Environment?
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.