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
547c547
PostPosted: Wed Nov 19, 2014 4:28 am    Post subject: ARRAY Reply with quote

Acolyte

Joined: 16 Jun 2014
Posts: 51

ARRAY

Last edited by 547c547 on Wed Nov 19, 2014 9:39 pm; edited 1 time in total
Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed Nov 19, 2014 4:36 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.

When you run it what happens?
does it work?
does it fail?
does the sun rise in the East every day?
_________________
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
547c547
PostPosted: Wed Nov 19, 2014 5:06 am    Post subject: Reply with quote

Acolyte

Joined: 16 Jun 2014
Posts: 51

It is not separting
It is deleting all the records

if I set the value in different tree , it is giving 10 records (my input is of 7 records )
Back to top
View user's profile Send private message
McueMart
PostPosted: Wed Nov 19, 2014 5:08 am    Post subject: Reply with quote

Chevalier

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

This is is exactly the kind of thing I use the debugger for. You can step through line by line and work out exactly if it's behaving as expected, and if not, why not.

This really is programmer 101.
Back to top
View user's profile Send private message
547c547
PostPosted: Wed Nov 19, 2014 5:13 am    Post subject: Reply with quote

Acolyte

Joined: 16 Jun 2014
Posts: 51

Sorry to say this..
I debugged and tried in ample ways to separate but couldn't figure out how to separate. .

One more method I tried, .. (NOT GIVING EXPECTED RESULT )
Code:
WHILE j < CARDINALITY(OLE.MRM.Record[])  DO
       SET i = 1;
         SET EV = OLE.MRM.Record[j];
           MOVE EV TO EV.Row;
          FOR  A AS OLE.MRM.Record[] DO   
             IF POSITION(CAST(EV AS CHAR) IN  OLE.MRM.Record[i].Row)<> 0 AND i < CARDINALITY(OLE.MRM.Record[]) THEN
                DELETE FIELD  OLE.MRM.Record[i].Row;
             ELSE
        SET OLE.TEMP.Record[k].Row = OLE.MRM.Record[i].Row;
                SET k = k+1;
             END IF;
             SET i = i+1;
         END FOR;
         
         SET j = j+1;
       
    END WHILE;


I would really appreciate your help
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Nov 19, 2014 5:38 am    Post subject: Reply with quote

Grand High Poobah

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

How is OLE.MRM.Record populated?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
maurito
PostPosted: Wed Nov 19, 2014 6:02 am    Post subject: Re: Identify duplicates in file Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

547c547 wrote:
DELETE FIELD OLE.MRM.Record[j] ;

ASAP .. PLEASE

if you are going to delete records, DO NOT iterate from 1 to cardinality, as every time you delete the cardinality changes and the structure gets compressed, i.e. whatever you had in MRM.Record[100] will move to be MRM.Record[99] and so on, which will give you lots of trouble. So your loops should go from v to 1 rather than from 1 to v.
Then, as it has been suggested, you need to work out the rest, use debugger, traces, etc.
Start with a simple case, maybe 3 or 4 records.
Back to top
View user's profile Send private message
McueMart
PostPosted: Wed Nov 19, 2014 7:17 am    Post subject: Reply with quote

Chevalier

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

Additionally (I feel like a programming interviewer now) , the approach you are using is quite inefficient whereby you are testing every record against every other record.

A more efficient way of detecting duplicates in data is to do something like:

- Create empty hash/map , MAP
- For each data item A in data set S :
- Does MAP contain A already?
- If yes, remove item A from set S
- If no, put A into MAP

So as some more 'ESQL-like' pseudo code:

Code:

DECLARE hashRow ROW;
DECLARE outputRow ROW;
FOR record AS InputRow.Record[] DO
    IF NOT EXISTS(hashRow.{records.Row}) THEN
       CREATE LASTCHILD OF outputRow AS tmp NAME 'Record';
       SET tmp = record;
       CREATE LASTCHILD OF hashRow NAME record.Row;
    END IF;
END FOR;


Something like that...
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Nov 19, 2014 11:49 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

And don't iterate with indexes, use references!
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
547c547
PostPosted: Wed Nov 19, 2014 11:17 pm    Post subject: .. Reply with quote

Acolyte

Joined: 16 Jun 2014
Posts: 51

..

Last edited by 547c547 on Wed Nov 19, 2014 11:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
547c547
PostPosted: Wed Nov 19, 2014 11:19 pm    Post subject: .. Reply with quote

Acolyte

Joined: 16 Jun 2014
Posts: 51

..
Back to top
View user's profile Send private message
547c547
PostPosted: Wed Nov 19, 2014 11:21 pm    Post subject: Reply with quote

Acolyte

Joined: 16 Jun 2014
Posts: 51

McueMart wrote:
Additionally (I feel like a programming interviewer now) , the approach you are using is quite inefficient whereby you are testing every record against every other record.

A more efficient way of detecting duplicates in data is to do something like:

- Create empty hash/map , MAP
- For each data item A in data set S :
- Does MAP contain A already?
- If yes, remove item A from set S
- If no, put A into MAP

So as some more 'ESQL-like' pseudo code:

Code:

DECLARE hashRow ROW;
DECLARE outputRow ROW;
FOR record AS InputRow.Record[] DO
    IF NOT EXISTS(hashRow.{records.Row}) THEN
       CREATE LASTCHILD OF outputRow AS tmp NAME 'Record';
       SET tmp = record;
       CREATE LASTCHILD OF hashRow NAME record.Row;
    END IF;
END FOR;


Something like that...




Thankyou so much.. You took a lot pain and answered for my problem
but Its not working .. .
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Nov 20, 2014 5:48 am    Post subject: Reply with quote

Grand High Poobah

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

@547c547 - there's no need and no point editing your posts to remove the content unless you've accidently included your SSN.

It makes responses nonsensical and removes any value this thread has to future readers.
_________________
Honesty is the best policy.
Insanity is the best defence.
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.