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
 
Copy PDS excluding empty members

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
senthils

Active User


Joined: 15 Nov 2005
Posts: 117
Location: Chennai, India

PostPosted: Thu Nov 05, 2009 9:14 am    Post subject: Copy PDS excluding empty members
Reply with quote

Hi,

how can we copy all the members of a PDS, excluding empty members, to another PDS?

I know using File-Aid it can be done. Is there another facility which can be used to do the same?
Back to top
View user's profile Send private message

MBabu

Active User


Joined: 03 Aug 2008
Posts: 401
Location: Mumbai

PostPosted: Thu Nov 05, 2009 9:14 pm    Post subject:
Reply with quote

If you can depend on ISPF statistics, you can sort a member list by lines and manually select the members to copy. Or you could write a small program that does LMINIT, LMOPEN, LMMLIST loop, STATS(YES), LMCOPY, ...

But be aware that ISPF statistics are only as good as the program that created them and most programs don't create them at all.

You could, however, modify the above to try to read a record and only do the copy if the record can be read. I seem to remember ISPF services doing odd things if you try to mix reading and writing in the same "dataid" but it might work.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Thu Nov 05, 2009 9:53 pm    Post subject:
Reply with quote

you can update ISPF statistics (line count is one) thru ispf option 3.5,
then you can follow MBabu's suggestion; as you access the STATS you can skip the zero line members.
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: Thu Nov 05, 2009 11:46 pm    Post subject: Reply to: Copy PDS excluding empty members
Reply with quote

This is the process I came up with:

Code:

//STEP0001 EXEC PGM=IEBPTPCH                                     
//SYSPRINT DD   SYSOUT=*                                         
//SYSUT1   DD   DISP=SHR,DSN=THE.PDS
//SYSUT2   DD   DSN=&&T1,DISP=(,PASS),                           
//         UNIT=VIO,SPACE=(CYL,(10,10),RLSE)                     
//SYSIN    DD   *                                                 
  PUNCH TYPORG=PO,STOPAFT=1                                       
/*                                                               
//*                                                               
//STEP0002 EXEC PGM=SORT                                         
//SORTIN   DD   DSN=&&T1,DISP=(OLD,DELETE)                       
//SORTOUT  DD   DSN=&&T2,DISP=(,PASS),                           
//         UNIT=VIO,SPACE=(CYL,(10,10),RLSE),RECFM=FB             
//SYSOUT   DD   SYSOUT=*                                         
//SYSIN    DD   *                                                 
  OPTION COPY                                                     
  INREC IFTHEN=(WHEN=GROUP,                                       
    BEGIN=(2,11,CH,EQ,C'MEMBER NAME'),                           
    PUSH=(81:SEQ=1,83:15,8))     
  OUTFIL INCLUDE=(81,1,CH,EQ,C'2'),                           
    BUILD=(C'  SELECT M=',83,8,80:X)                             
/*                                                               
//*                                                               
//STEP0003 EXEC PGM=IEBCOPY                                       
//PDSI     DD   DISP=SHR,DSN=THE.PDS
//PDSO     DD   DSN=THE.NEW.PDS,                             
//         DISP=(,CATLG,DELETE),UNIT=SYSDA,SPACE=...
//SYSPRINT DD   SYSOUT=*                                         
//SYSIN    DD   *                                                 
  COPY OUTDD=PDSO,INDD=PDSI                                       
/*                                                               
//         DD   DSN=&&T2,DISP=(OLD,DELETE)                       
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Thu Nov 05, 2009 11:59 pm    Post subject:
Reply with quote

SuperK,

one thing about people who have good skill sets:

their finished product looks so easy.
Back to top
View user's profile Send private message
senthils

Active User


Joined: 15 Nov 2005
Posts: 117
Location: Chennai, India

PostPosted: Fri Nov 06, 2009 9:31 am    Post subject:
Reply with quote

That works perfectly superk.

Thanks everyone for your replies.
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 401
Location: Mumbai

PostPosted: Fri Nov 06, 2009 10:23 am    Post subject: Reply to: Copy PDS excluding empty members
Reply with quote

Well. count me among the impressed! I have to study this one. icon_smile.gif
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1532
Location: Chennai

PostPosted: Fri Nov 06, 2009 8:32 pm    Post subject:
Reply with quote

icon_eek.gif Me too
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am
No new posts Compare and COPY using DFSORT pshongal DFSORT/ICETOOL 3 Fri Nov 17, 2017 9:49 am
No new posts Copy selected columns from 2 input fi... Poha Eater DFSORT/ICETOOL 3 Thu Nov 02, 2017 3:43 pm
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm

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