IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Remove duplicate elements in Stem


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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: 2358
Location: Israel

PostPosted: Wed Aug 09, 2006 9:51 pm
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
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
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
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
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: 24

PostPosted: Mon Sep 25, 2006 8:23 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Remove leading zeroes SYNCSORT 4
No new posts Duplicate several members of/in one l... JCL & VSAM 7
No new posts Newbie Stuck on "Duplicate Datas... TSO/ISPF 5
Search our Forums:

Back to Top