Page 1 of 2

How to compare Two PS.

PostPosted: Fri Apr 04, 2014 7:29 pm
by samurai
Can anyone help me to get the syntax or code to compare 2 PS.

PS 1
mmm.work.jcl
aaa
bbb
ccc

PS 2

ooo.work.jcl
XXXjjjjjaaaa
sssssssss
fffghfgdgdgfdg
sdssdfsdfsfdsfscccghfhfghfhf


Now i need to compare PS1 & PS2 and tell aaa & ccc is present.

Re: How to compare Two PS.

PostPosted: Fri Apr 04, 2014 9:22 pm
by NicC
Store the strings to be searched for in a stem
Read a record from the 2nd dataset
Do while more data to read
   loop through stem
      do a POS of the stem data in the record read
      If found
      then do something
      else do something else
   end loop
   read next record
end read loop

Re: How to compare Two PS.

PostPosted: Sun Apr 06, 2014 10:49 am
by steve-myers
I strongly suggest you read up on ISRSUPC in ISPF User's Guide for your z/OS release rather than try to write your own compare; it's much harder than NicC proposes. ISRSUPC is what ISPF uses for options 3.12,3.13, 3.14 and 3.15.

Re: How to compare Two PS.

PostPosted: Sun Apr 06, 2014 12:53 pm
by samurai
Hello,

Rather than checking manually using superc or something else i need to get the output as whether the given names in PS1 is present in PS2 or not.

Thanks!

Re: How to compare Two PS.

PostPosted: Mon Apr 07, 2014 7:12 am
by dick scherrer
Hello,

In other words, you want someone to do the work for you . . . .

We intend to help but Not do your work for you.

When you try something and hyave questions/problems, post what you tried here and also what happened (do NOT post "it didn't work".

Someone should be able to help once there you have something to work with.

Re: How to compare Two PS.

PostPosted: Mon Apr 07, 2014 10:08 am
by enrico-sorichetti
it would be better for You to learn to use the proper terminology ...

... i need to get the output as whether the given names in PS1 is present in PS2 or not.


Your requirement seems NOT compare two files
but to find out if some string is present in a file,
for that the proper way is to use the otter ISPF tool SRCHFOR

see the ISPF help on how to use it

Re: How to compare Two PS.

PostPosted: Mon Apr 07, 2014 11:21 am
by samurai
Hi,

I didnt mean someone to work for me but was about to ask what enrico has posted.. Sorry for the confusion :(

Re: How to compare Two PS.

PostPosted: Mon Apr 07, 2014 7:40 pm
by dick scherrer
Hello,

Sorry for the confusion
This happens rather often.

No long-term foul :)

We will be here when you have questions/problems implementing.

Re: How to compare Two PS.

PostPosted: Tue Apr 08, 2014 6:03 pm
by samurai
i have tried using index as below and able to search..

"ALLOC F(CD) DS('XXXX.SAM1.JCL')SHR" 
"EXECIO * DISKR CD(FINIS STEM INP."   
"FREE F(CD)"                         
"ALLOC F(CD1) DS('XXXX.SAM2.JCL')SHR"
"EXECIO * DISKR CD1(FINIS STEM ICD." 
"FREE F(CD1)"                         
NOT_FOUND = 0                         
DO I = 1 TO INP.0                     
INP.I = STRIP(INP.I)                 
   DO J = 1 TO ICD.0                 
      IF INDEX(ICD.J,INP.I) > 0 THEN 
      DO                             
         SAY ' FOUND' INP.I


Coded

Re: How to compare Two PS.

PostPosted: Tue Apr 08, 2014 6:38 pm
by enrico-sorichetti
if You are happy we are happy ... :geek:

but Your way of doing it is not the smartest one!

what is wrong in trying SRCHFOR ???