How to compare Two PS.



IBM's Command List programming language & Restructured Extended Executor

How to compare Two PS.

Postby samurai » Fri Apr 04, 2014 7:29 pm

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.
samurai
 
Posts: 30
Joined: Tue Mar 18, 2014 3:29 pm
Has thanked: 6 times
Been thanked: 0 time

Re: How to compare Two PS.

 

Re: How to compare Two PS.

Postby NicC » Fri Apr 04, 2014 9:22 pm

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
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2702
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: How to compare Two PS.

Postby steve-myers » Sun Apr 06, 2014 10:49 am

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.
steve-myers
Global moderator
 
Posts: 1887
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 198 times

Re: How to compare Two PS.

Postby samurai » Sun Apr 06, 2014 12:53 pm

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!
samurai
 
Posts: 30
Joined: Tue Mar 18, 2014 3:29 pm
Has thanked: 6 times
Been thanked: 0 time

Re: How to compare Two PS.

Postby dick scherrer » Mon Apr 07, 2014 7:12 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: How to compare Two PS.

Postby enrico-sorichetti » Mon Apr 07, 2014 10:08 am

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2648
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 132 times

Re: How to compare Two PS.

Postby samurai » Mon Apr 07, 2014 11:21 am

Hi,

I didnt mean someone to work for me but was about to ask what enrico has posted.. Sorry for the confusion :(
samurai
 
Posts: 30
Joined: Tue Mar 18, 2014 3:29 pm
Has thanked: 6 times
Been thanked: 0 time

Re: How to compare Two PS.

Postby dick scherrer » Mon Apr 07, 2014 7:40 pm

Hello,

Sorry for the confusion
This happens rather often.

No long-term foul :)

We will be here when you have questions/problems implementing.
Hope this helps,
d.sch.

These users thanked the author dick scherrer for the post:
samurai (Tue Apr 08, 2014 12:17 pm)
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: How to compare Two PS.

Postby samurai » Tue Apr 08, 2014 6:03 pm

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
samurai
 
Posts: 30
Joined: Tue Mar 18, 2014 3:29 pm
Has thanked: 6 times
Been thanked: 0 time

Re: How to compare Two PS.

Postby enrico-sorichetti » Tue Apr 08, 2014 6:38 pm

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 ???
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2648
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 132 times

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post