MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Search all members within PDS based on some condition

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
nbdtrjk
Beginner


Joined: 08 Mar 2006
Posts: 17
Topics: 11

PostPosted: Fri Aug 04, 2006 12:45 am    Post subject: Search all members within PDS based on some condition Reply with quote

Is there any job that actually opens a PDS and reads all members of PDS (to pick up a certain field from each member in the PDS)

Take a example.
i Have two members(S1 and S2) in S1 i have the value of
A1
A2
A3
B1

In S2 having the value of
B1
B2
B3
A1

I want A1 string to be picked from Only S1 members and B1 string to be picked from S2 members.This what my requirement in a Single JCLs...
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Fri Aug 04, 2006 4:50 am    Post subject: Reply with quote

nbdtrjk,

1.Flatten the PDS using IEBPTPCH and then run it thru sort.

2. If your shop has file-aid then you can copy all the members which has the A1, b1 string
[code:1:b99830c4f0]
$$DD01 COPYMEM IF=(1,0,C
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Fri Aug 04, 2006 6:28 pm    Post subject: Reply with quote

I don't understand the requirement. What causes you to select these things from particular members? Is it because it is the 1st record? The record that preceeds some other value? You need to be much more specific in your requirement.
Back to top
View user's profile Send private message Visit poster's website
Steve Coalbran
Beginner


Joined: 09 Mar 2005
Posts: 22
Topics: 0
Location: Stockholm, Sweden

PostPosted: Mon Aug 14, 2006 5:00 am    Post subject: Reply with quote

Continuing the assumption that if the first record in any member of your 'from-library' is either A1 or B1 then copy that member to a second 'to-library'...
Use SUPERC - ISPF Option 3.15, run in batch or foreground
I set up a PDS with two members as you defined. Substitute your own input library here.
Code:

//SEARCH   EXEC PGM=ISRSUPC,PARM=(SRCHCMP,FINDALL)
//NEWDD    DD DISP=SHR,DSN=SE16661.TEST.PDSAB     
//OUTDD    DD SYSOUT=(*)                           
//SYSIN    DD *                                   
SRCHFOR  'A1'                                     
SRCHFOR  'B1'                                     
CMPCOLM  1:2                                       
/*                                                 

run this and you should get a listing...
[code:1:f723cf318c]
ISRSUPC - MVS/PDF FILE/LINE/WORD/BYTE/SFOR COMPARE UTILITY- ISPF FOR z/OS
LINE-
Back to top
View user's profile Send private message Send e-mail MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Mon Aug 14, 2006 7:06 am    Post subject: Reply with quote

Steve Coalbran,

I would add IDPFX option for the SEARCH so that the results have the Name prefixed for all the search strings, so that it is easier to format in rexx.

Code:

//SEARCH   EXEC PGM=ISRSUPC,PARM=(SRCHCMP,IDPFX,FINDALL)


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Steve Coalbran
Beginner


Joined: 09 Mar 2005
Posts: 22
Topics: 0
Location: Stockholm, Sweden

PostPosted: Wed Aug 16, 2006 5:00 am    Post subject: Reply with quote

Hi Kolusu,
Thanks - good tip - I hadn't used that one before - I will in future!

Wink /Steve Cool
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Steve Coalbran
Beginner


Joined: 09 Mar 2005
Posts: 22
Topics: 0
Location: Stockholm, Sweden

PostPosted: Wed Aug 16, 2006 10:19 am    Post subject: Reply with quote

Well, that would also change the solution which is rather more REXXy than before.
Here's a possible exec...
Code:

/*REXX*(SUPCEXT)*/                                                     
CALL MSG "OFF"                                                         
PARSE VALUE 0 WITH lib. 1 lst. 1 idpfx 1 mbr.                           
                                                                       
"EXECIO * DISKR SYSLIST (STEM LST. FINIS"                               
DO i = 1 TO lst.0                                                       
   IF( SUBSTR(lst.i,2,15) = 'THE FOLLOWING "' )THEN idpfx = 1           
   IF( idpfx=0 )THEN ITERATE                                           
   PARSE VAR lst.i 3 ?lb 4 ?cc 6 ?rb . 8 ?ds                           
   IF( ?lb!!?rb = "()" )THEN                                           
      PARSE VALUE ?cc+0";"?ds WITH n";" . =1 lib.0";" lib.n             
   ELSE NOP                                                             
END                                                                     
                                                                       
DO i = 1 TO lst.0                                                       
   IF( SUBSTR(lst.i,2,15) = 'THE FOLLOWING "' )THEN LEAVE               
   PARSE VAR lst.i . 2 ?mn 11 ?lb 12 ?cc 14 ?rb 15 . 23 ?1x 28 .       
   IF( ?lb!!?rb = "()" ,                                               
     & ( ?1x = "1  A1" ,                                               
       ! ?1x = "1  B1" ) )THEN DO                                       
      ?cc = ?cc+0                                                       
      PARSE VALUE mbr.?cc.0+1";"?mn WITH n";" . =1 mbr.?cc.0";"mbr.?cc.n
      END                                                               
   ELSE NOP                                                             
END                                                                     
                                                                       
dds = ""                                               
DO c = 1 TO lib.0                                     
   dsn = STRIP(lib.c)                                 
   DO m = 1 TO mbr.c.0                                 
      IF( m=1 )THEN DO                                 
         ddn = "SYS"RIGHT(c,5,0)                       
         dds = dds ddn                                 
         "FREE DD("ddn") DS('"dsn"')"                 
         "ALLOC DD("ddn") DS('"dsn"') SHR REUSE"       
         QUEUE "  COPY INDD=(("ddn",R)),OUTDD=SYSOLIB"
         END                                           
      QUEUE "  S M="mbr.c.m                           
   END                                                 
END                                                   
q = QUEUED()                                           
IF( q = 0 )THEN EXIT 8                                 
                                                       
dds = SPACE(dds)                                       
"ALLOC DD(SYSIN)    NEW REUSE UNIT(VIO) SP(30)TRACK", 
                   "LRECL(80) RECFM(F B)"             
"ALLOC DD(SYSPRINT) DS(*) REUSE"                       
"EXECIO" q "DISKW SYSIN (FINIS"             
"ALLOC DD(SYSUT3)   UNIT(VIO) SP(30)TRACK"             
"ALLOC DD(SYSUT4)   UNIT(VIO) SP(30)TRACK"   
"CALL *(IEBCOPY)"                           
xc = RC                                     
"FREE DD("dds "SYSIN SYSPRINT SYSUT3 SYSUT4)"
EXIT xc                                     

and the JCL to run it...
Code:

//SE16661O JOB (SDS,T,ZN,00),'STEVE',MSGCLASS=H,                       
//*RESTART=EXTRACT,                                                   
//         MSGLEVEL=(1,1),CLASS=A,TIME=(5,0),NOTIFY=&SYSUID           
//*--------------------------------------------------------------------
//         SET MD='(MOD,DELETE),SPACE=(TRK,0)'                         
//         SET OK='(OLD,KEEP)'                                         
//         SET NC='(,CATLG,DELETE),SPACE=(TRK,(3,3))'                 
//         SET VS='(,PASS),UNIT=VIO,SPACE=(TRK,30)'                   
//*--------------------------------------------------------------------
//CLEANUP  EXEC PGM=IEFBR14                                           
//OUTDD    DD DISP=&MD,DSN=&SYSUID..SRCHFOR.LIST                       
//*--------------------------------------------------------------------
//SEARCH   EXEC PGM=ISRSUPC,PARM=(SRCHCMP,IDPFX,FINDALL)               
//NEWDD    DD DISP=SHR,DSN=ISPF.SDC.PANELS                             
//         DD DISP=SHR,DSN=SYS1.MAIN.PANELS                           
//         DD DISP=SHR,DSN=SYS1.MAINPENU                               
//         DD DISP=SHR,DSN=SYS1.SISPPENU                               
//OUTDD    DD DISP=&NC,DSN=&SYSUID..SRCHFOR.LIST                       
//SYSIN    DD *                                                       
SRCHFOR  ')ATTR'                                                       
//*--------------------------------------------------------------------
//EXTRACT  EXEC PGM=IEFBR14                                           
//SYSOLIB  DD DISP=&MD,DSN=&SYSUID..SRCHFOR.EXTRACT                   
//*--------------------------------------------------------------------
//SUPCEXT  EXEC PGM=IKJEFT1A,PARM='SUPCEXT'                           
//SYSEXEC  DD DISP=SHR,DSN=SE16661.USER.EXEC                           
//SYSLIST  DD DISP=&OK,DSN=&SYSUID..SRCHFOR.LIST           
//SYSIN    DD DISP=&VS                                     
//SYSTSPRT DD SYSOUT=*                                     
//SYSPRINT DD SYSOUT=*                                     
//SYSOLIB  DD DSN=&SYSUID..SRCHFOR.EXTRACT,DSNTYPE=LIBRARY,
//            DISP=(,CATLG,DELETE),SPACE=(TRK,(3,3,30)),   
//            DCB=*.SEARCH.NEWDD                           
//SYSTSIN  DD DUMMY                                         
//                                                         

I had to edit the SRCHFOR.LIST halfway to match the A1 & B1 criteria...
(hence the RESTART left in the job)
[code:1:ede72617f0]
ISRSUPC - MVS/PDF FILE/LINE/WORD/BYTE/SFOR COMPARE UTILITY- ISPF FOR z/OS
MEMBER CONC
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group