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
 

 

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: 4648
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
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 pm
No new posts member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm


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