Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
REXX code to compare while excluding last hlq(G0*)

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: REXX code to compare while excluding last hlq(G0*)
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

Moderator Team Head


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

PostPosted: Mon Jul 20, 2009 7:03 pm    Post subject: Reply to: REXX code to compare while excluding last hlq(G0*)
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    Post subject:
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: 401
Location: Mumbai

PostPosted: Mon Jul 20, 2009 7:38 pm    Post subject: Reply to: REXX code to compare while excluding last hlq(G0*)
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    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 Compare yesterday's date to the one o... migusd SYNCSORT 4 Fri Sep 22, 2017 11:35 pm
No new posts ejck thru rexx to multiple jobs insid... Susanta All Other Mainframe Topics 5 Tue Sep 19, 2017 1:39 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Creating ISPF Screens with Scrname vi... Albireo20 TSO/ISPF 9 Tue Sep 05, 2017 4:24 pm
No new posts How to Run Rexx Macro? Kalaivignesh CLIST & REXX 5 Fri Sep 01, 2017 9:08 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us