View previous topic :: View next topic
|
Author |
Message |
rahulbank
New User
Joined: 25 Sep 2008 Posts: 66 Location: Bengaluruuuuuu
|
|
|
|
I am comparing two PS having some files as entries. I want an output only when the file names match. I was able to achieve that however now I have to compare the GDG bases alone. Is there a way we can compare the bases of the GDG alone. How do we compare the bases alone and excluse the gdg versions during that.
"EXECIO * DISKR INPFILE2 (STEM File1. FINIS)"
"EXECIO * DISKR INPFILE3 (STEM File2. FINIS)"
Do cnt = 1 to File1.0
Do I = 1 to File2.0
If WORD(File1.cnt,1) = WORD(File2.I,1) THEN
Do
Say File1.cnt
End
End
End
This is my rexx code. Please advice. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
What do you mean by "compare the bases"? The only comparisons I can imagine being of any value is either comparing names or attributes. |
|
Back to top |
|
|
rahulbank
New User
Joined: 25 Sep 2008 Posts: 66 Location: Bengaluruuuuuu
|
|
|
|
ok I meant like adf.juk.lik.G0100V00 and adf.juk.lik.G0200V00. I want to compare only adf.juk.lik and o/p. I meant gdg base. |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
You need to account for many other things because the lists will not have the same data set on the same line, they may not be sorted the same, and there will be duplicates which you probably only want reported once. The usual way to do compares like this in Rexx is to use stem variables as associative arrays and compare the contents of the arrays. In most cases, this automatically eliminates duplicates and accounts for sorting differences, but I shortened this example to make only 1 pass over the data so there is specific code to eliminate duplicates
Code: |
/* rexx - read 2 files containing dsnames and show matches */
/* where gdg generations are treated as the gdg base name */
"ALLOC F(INPFILE2) DA(F1.DATASETS) SHR REU"
"ALLOC F(INPFILE3) DA(F2.DATASETS) SHR REU"
"EXECIO * DISKR INPFILE2 (STEM File1. FINIS)"
"EXECIO * DISKR INPFILE3 (STEM File2. FINIS)"
contents.file1. = ""
contents.file2. = ""
/* Create list of unique file1 names as file1.cnt stem */
Do cnt = 1 to file1.0
Parse Var file1.cnt dsname .
If pos(".",dsname) > 0 Then
dsname = removeGooVoo(dsname)
contents.file1.dsname = "found"
End
/* Compare file2 names to file1.cnt and report matches only once */
Do cnt = 1 to file2.0
Parse Var file2.cnt dsname .
If pos(".",dsname) > 0 Then
dsname = removeGooVoo(dsname)
If contents.file1.dsname = "found" Then
Do
Say dsname /* Entry in both files */
contents.file1.dsname = "used" Then /* Mark as used */
End
End
Return
/* remove llq if last qualifier is pattern GnnnnVnn. */
/* Note reverse() calls to find last qualifier */
removeGooVoo: Procedure
dsname = Arg(1)
Parse Value reverse(dsname) With llq "." hlqs
llq = translate(reverse(llq),"0000000000","0123456789")
If llq = "G0000V00" Then
dsname = reverse(hlqs)
Return dsname
|
|
|
Back to top |
|
|
|