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

REXX code to compare while excluding last hlq(G0*)


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rahulbank

New User


Joined: 25 Sep 2008
Posts: 66
Location: Bengaluruuuuuu

PostPosted: Mon Jul 20, 2009 6:53 pm
Reply with quote

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
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Mon Jul 20, 2009 7:03 pm
Reply with quote

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
View user's profile Send private message
rahulbank

New User


Joined: 25 Sep 2008
Posts: 66
Location: Bengaluruuuuuu

PostPosted: Mon Jul 20, 2009 7:32 pm
Reply with quote

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
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Mon Jul 20, 2009 7:38 pm
Reply with quote

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
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
Search our Forums:

Back to Top