Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Remove duplicate elements in Stem

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
ravi.bollineni

New User


Joined: 28 Jun 2006
Posts: 8

PostPosted: Wed Aug 09, 2006 8:41 pm    Post subject: Remove duplicate elements in Stem
Reply with quote

Hi All,

I have verified the forum for this but i didn't find any valuable information.

But i want to do the following.
My program creating a Stem output. But it contains duplicate elements. I want to remove duplicate elements from my Stem output.

For the above, thoughts right now are first perform a sorting(Bubble or selection) methodology after that write a code to remove the duplicate elements.

Am i going in correct way...or any other functions exist in REXX Language to remove the duplicate elements in STEM.

If you have sample code for this Please share with me.

Always Thanking You,
Ravi.
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Wed Aug 09, 2006 9:51 pm    Post subject:
Reply with quote

The is no REXX function to do that.

You can write the whole stem into a file (EXECIO DISKW), then use that file as an input to SORT with SUM=NONE (or something like that to remove the duplicates), then read the output back into a stem.
Back to top
View user's profile Send private message
mike53

New User


Joined: 09 Jul 2006
Posts: 3
Location: UK

PostPosted: Thu Aug 10, 2006 3:42 am    Post subject: Re: Remove duplicate elements in Stem
Reply with quote

Maybe it would be possible to re-design your REXX program so that you don't get the duplicate variables in the first place? It's difficult to comment without seeing the actual code, but remember that the index of a stem variable does not have to be a number - it can be anything. In effect the stem variable acts a bit like a keyed file, with the index as a key. Keep that in mind and take a fresh look at your code. Just an idea! icon_biggrin.gif
Back to top
View user's profile Send private message
ravi.bollineni

New User


Joined: 28 Jun 2006
Posts: 8

PostPosted: Thu Aug 10, 2006 9:47 am    Post subject:
Reply with quote

Thanks a lot for all of you.

Actually i wrote the code in REXX program and i don't want write it to another file and give the same as input to the SORT JCL.

I need to do the requirement in REXX only. So am following like whatever i mentioned.

Anyway thanks for all of you.


Always Thanking You,
Ravi.
Back to top
View user's profile Send private message
nuck

New User


Joined: 09 Dec 2005
Posts: 33

PostPosted: Wed Aug 23, 2006 1:52 pm    Post subject:
Reply with quote

ok, so this thread is probably dead, but I'll add my $0.02...

to make sure duplicate (contents?) in a stem don't occur, before adding the new value into the stem, do a search on the existing contents.

content_found='N'
do j = 1 to content_count
if this_content = stem_content.j
then do
content_found= 'Y'
j = content_count +1
end
end
if content_found = 'N'
then do
content_count=content_count+1
stem.content.content.count = this_content
end

no?
Back to top
View user's profile Send private message
Redrose
Currently Banned

New User


Joined: 06 Mar 2006
Posts: 19

PostPosted: Mon Sep 25, 2006 5:34 pm    Post subject:
Reply with quote

Hi friends icon_smile.gif,

We can eliminate duplicates from the Stem variable as below,

Steps:

1. If InStem's 1'st element, Move the element to OutStem
2. Else check all OutStem elements for the current InStem element
3. If found, Iterate to next InStem element
4. Else add InStem's element to OutStem

**********************Code-Starts-Here************************

/* REXX code to remove duplicates from Stem
Input Stem - InStem.
Output Stem - OutStem.
Array Counters - I, J, K */

J = 1
DO I = 1 TO InStem.0
IF I = 1 THEN
OutStem.I = InStem.I
ELSE
DO K = 1 TO J
IF (InStem.I ?= OutStem.K) & (K = J) THEN
DO
J = J + 1
OutStem.J = InStem.I
END
ELSE
DO
IF (InStem.I == OutStem.K) THEN
ITERATE I
END
END
END
OutStem.0 = J

**********************Code-Ends-Here*************************

Hope it helps,

Ur's
Ramanan R
-------------------------------------------------------------------------------------
Winners Don't Do Different Things, They Do Things Differently
- Shiv Kehra
-------------------------------------------------------------------------------------
Back to top
View user's profile Send private message
srajendran

New User


Joined: 25 Sep 2006
Posts: 22

PostPosted: Mon Sep 25, 2006 8:23 pm    Post subject:
Reply with quote

To do this in An easy way .....

Just Concatenate the stem variables separated by spaces and before concatnating check for the WORDPOS of the current variable....If the WORDPOS is greater than 0, then it would be a duplicate...If not concatenate the string....

Do this for the whole stem n when its done then take up the words into the stem again....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Remove Special Characters from Mainfr... Rodger Zhang All Other Mainframe Topics 6 Wed Jul 06, 2016 1:12 am
No new posts Is it possible to pass variables of s... Csongor CLIST & REXX 2 Fri Jun 10, 2016 7:33 pm
No new posts how to find the duplicate list RAVIGUPTA1990 DB2 6 Wed Mar 30, 2016 12:11 am
No new posts Remove header only knobi SYNCSORT 5 Mon Feb 15, 2016 10:42 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us