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 » ARRAY

Post new topic  Reply to topic
 ARRAY « View previous topic :: View next topic » 
Author Message
chaitu
PostPosted: Wed Jul 29, 2015 2:10 am    Post subject: ARRAY Reply with quote

Voyager

Joined: 15 Apr 2014
Posts: 89

Hello All,

I am deleting the records1 and record4 which are repeating in an array of 8 records and storing in another variable. Next time the loop repeat i am checking for repeating element it shipping record3 and jumps to record4 and skipping record5 and jumps to record6. I am unable to figure it out why it skipping. Can any one please guide me to figure it out.

Code:
WHILE count1<>0 DO
      
   X : REPEAT
      SET ll = Environment.Variables.Order.records[n].val;
      SET ll2 =Environment.Variables.Order.records[m].val2;
      SET SK = Environment.Variables.Order.records[n].1SKU;
      SET SK2 = Environment.Variables.Order.records[m].2SKU;
      IF ll = ll2  AND SK <> SK2 THEN
         SET Environment.Variables.Repeat[x] = Environment.Variables.Order.records[m];
         DELETE FIELD Environment.Variables.Order.records[m];
         
         
         SET m = m+1;
         SET x = x+1;
         

         ITERATE X;
      END IF;
      
      SET m = m+1;
   UNTIL count1<=m
        END REPEAT X;
      SET Environment.Variables.Repeat[x] = Environment.Variables.Order.records[n];
      DELETE FIELD Environment.Variables.Order.records[n];
      
      SET m = 1;
      SET n = 1;
      SET  OutputRoot.XMLNSC.Order.records[]= Environment.Variables.Repeat[];
PROPAGATE TO TERMINAL 'out' DELETE NONE;
SET count1 = CARDINALITY(Environment.Variables.Order.records[]);
       SET x = 1;
      END WHILE;


the above is the code i am using.

Thanks in advance.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jul 29, 2015 4:41 am    Post subject: Re: ARRAY Reply with quote

Grand High Poobah

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

chaitu wrote:
I am unable to figure it out why it skipping.


Because when you DELETE FIELD 1 (i.e. the first record in the list), what was field 2 suddenly becomes the first record in the list (i.e. field 1). So your index of where you are in the list is out by 1.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Wed Jul 29, 2015 8:30 am    Post subject: Re: ARRAY Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

Vitor wrote:
chaitu wrote:
I am unable to figure it out why it skipping.


Because when you DELETE FIELD 1 (i.e. the first record in the list), what was field 2 suddenly becomes the first record in the list (i.e. field 1). So your index of where you are in the list is out by 1.


This is one reason out of many why you should not be using array syntax in broker code, use references instead.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jul 29, 2015 8:38 am    Post subject: Re: ARRAY Reply with quote

Grand High Poobah

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

joebuckeye wrote:
Vitor wrote:
chaitu wrote:
I am unable to figure it out why it skipping.


Because when you DELETE FIELD 1 (i.e. the first record in the list), what was field 2 suddenly becomes the first record in the list (i.e. field 1). So your index of where you are in the list is out by 1.


This is one reason out of many why you should not be using array syntax in broker code, use references instead.



_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
chaitu
PostPosted: Wed Jul 29, 2015 9:20 pm    Post subject: Reply with quote

Voyager

Joined: 15 Apr 2014
Posts: 89

Hello All,
Thanks for your quick responses .
I used a reference point to Environment.Variables.Order.records[m] but still same problem. could you please help me on this.

Thanks in Advance for giving your valuable time.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Jul 30, 2015 4:21 am    Post subject: Reply with quote

Grand High Poobah

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

chaitu wrote:
I used a reference point to Environment.Variables.Order.records[m] but still same problem. could you please help me on this.


Of course you're getting the same problem. You're using a reference but still pointing to an index. Given that it was the index causing the problem, continued use of the index results in a continuing problem.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
chaitu
PostPosted: Fri Jul 31, 2015 2:18 am    Post subject: Reply with quote

Voyager

Joined: 15 Apr 2014
Posts: 89

Hello All,
Thanks again to you Vitor finally i am able to figure it out

one more issue is my flow is like

MQI/P>>COMPUTE>>FILEO/P

in compute i am doing all the below coding. Now their may be n number of files come to fileo/p node from compute with in a fraction of seconds i need to place that files with same name in my local path what property i need to set to achieve this. I am using time stamp, archive and replace existing but the files are storing in masiarchive. Could you please guide me on this.

Thanks in advance.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jul 31, 2015 4:35 am    Post subject: Reply with quote

Grand High Poobah

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

chaitu wrote:
i need to place that files with same name in my local path what property i need to set to achieve this. I am using time stamp, archive and replace existing but the files are storing in masiarchive. Could you please guide me on this.


Stop me when I get something wrong:

Say you're getting (let's say) 50 messages a second through the MQInput node. The content of each message becomes a file via the FileOutput node and you give each file the same name. So in 1 second you've generated 50 identically named files in the same output directory, and any consuming application will not have managed to read all those files in that time frame. Hence, and according to the configuration you've set, broker moves the unread files to the mqsiarchive directory with a timestamp on them.

So what do you want to happen:

- Broker to overwrite the existing file with the new one, destroying the contents of the old one before it can be processed
- Broker to wait until the previous file has been read out of the directory before writing a new one
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
inMo
PostPosted: Fri Jul 31, 2015 5:04 am    Post subject: Reply with quote

Master

Joined: 27 Jun 2009
Posts: 216
Location: NY

Quote:
Now their may be n number of files come to fileo/p node from compute with in a fraction of seconds i need to place that files with same name


From a layman's perspective, can you first explain how that is accomplished? I have to think there is a piece of the requirement that is missing. Perhaps that is what Vitor is going after?
Back to top
View user's profile Send private message
smdavies99
PostPosted: Fri Jul 31, 2015 7:38 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Vitor wrote:

Say you're getting (let's say) 50 messages a second through the MQInput node. The content of each message becomes a file via the FileOutput node and you give each file the same name. So in 1 second you've generated 50 identically named files in the same output directory, and any consuming application will not have managed to read all those files in that time frame.


This is especially true if the destination filesystem can't handle many copies of a file with the same filename including extension. Only a very select few filesystems can do that by adding a file version.
Normal UNIX/Linux or Windows Filesystems can't handle more than one version of a file with the same name.

So please explain what you really want and we can possible help you.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
maurito
PostPosted: Mon Aug 03, 2015 1:00 am    Post subject: Re: ARRAY Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

chaitu wrote:
Hello All,

I am deleting the records1 and record4 which are repeating in an array of 8 records and storing in another variable. Next time the loop repeat i am checking for repeating element it shipping record3 and jumps to record4 and skipping record5 and jumps to record6. I am unable to figure it out why it skipping. Can any one please guide me to figure it out.

Code:
WHILE count1<>0 DO
      
   X : REPEAT
      SET ll = Environment.Variables.Order.records[n].val;
      SET ll2 =Environment.Variables.Order.records[m].val2;
      SET SK = Environment.Variables.Order.records[n].1SKU;
      SET SK2 = Environment.Variables.Order.records[m].2SKU;
      IF ll = ll2  AND SK <> SK2 THEN
         SET Environment.Variables.Repeat[x] = Environment.Variables.Order.records[m];
         DELETE FIELD Environment.Variables.Order.records[m];
         
         
         SET m = m+1;
         SET x = x+1;
         

         ITERATE X;
      END IF;
      
      SET m = m+1;
   UNTIL count1<=m
        END REPEAT X;
      SET Environment.Variables.Repeat[x] = Environment.Variables.Order.records[n];
      DELETE FIELD Environment.Variables.Order.records[n];
      
      SET m = 1;
      SET n = 1;
      SET  OutputRoot.XMLNSC.Order.records[]= Environment.Variables.Repeat[];
PROPAGATE TO TERMINAL 'out' DELETE NONE;
SET count1 = CARDINALITY(Environment.Variables.Order.records[]);
       SET x = 1;
      END WHILE;


the above is the code i am using.

Thanks in advance.


start from the last element and work your way up to the first, so that the delete statement does not alter the indices.
Back to top
View user's profile Send private message
chaitu
PostPosted: Mon Aug 03, 2015 3:46 am    Post subject: Reply with quote

Voyager

Joined: 15 Apr 2014
Posts: 89

Hello All,
Thanks for the responses.
Flow is like
MQI/P>>COMPUTE>>FILEO/P
I have to save the files with different file name in the local system and the file name should come dynamically from one of the field in compute node.
how could i achieve this. could any one spare some time for me on this.

Thanks in advace
Back to top
View user's profile Send private message
maurito
PostPosted: Mon Aug 03, 2015 4:14 am    Post subject: Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

chaitu wrote:

how could i achieve this.
Thanks in advace


by setting the appropriate values in the compute node / local environment. Read the Fileoutput node docuementation in the info center.
chaitu wrote:

could any one spare some time for me on this.

not before you have done some investigation and tried what is explained in the documentation.
Back to top
View user's profile Send private message
chaitu
PostPosted: Tue Aug 04, 2015 2:14 am    Post subject: Reply with quote

Voyager

Joined: 15 Apr 2014
Posts: 89

Hello All,

I am able to generate files with different names using esql(localenvironment).

Thanks.
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 » ARRAY
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.