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 

File Aid Copy

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
balasarathi
Beginner


Joined: 24 Aug 2006
Posts: 4
Topics: 2

PostPosted: Thu Sep 28, 2006 12:09 am    Post subject: File Aid Copy Reply with quote

Hi All,

I have a requirement to copy few records into an output file.
The selection criteria for the same is,

I/P file contails 1000's of records. The requirement is to copy the first record(header) and the last record(Trailer) and have to copy every 1000'th record.
i.e.

Header
1000'th record
2000'th record
3000'th record
4000'th record
5000'th record
..
..
..
..
..
Trailer


Can some one Help me how to copy the records in both sort and file-aid.

Regards,
Sarathi.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Sep 28, 2006 8:07 am    Post subject: Reply with quote

balasarathi,

Try this

Code:

//STEP0100 EXEC PGM=FILEAID                   
//SYSPRINT DD  SYSOUT=*                       
//DD01     DD  DSN=YOUR INPUT FILE,
//             DISP=SHR
//DD01O    DD  DSN=YOUR OUTPUT FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD  *                               
$$DD01 COPY IF=(1,EQ,C'HEADER'),OUT=1         
$$DD01 COPY SELECT=1000,IF=(1,NE,C'TRAILER'),OUT=0
$$DD01 COPYBACK OUT=1                         


Sort Solution: I assumed that your input file has 80 bytes lrecl and is of FB recfm.

Code:

//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD DSN=YOUR INPUT FILE,
//            DISP=SHR
//SORTOUT  DD DSN=YOUR OUTPUT FILE,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD *                                 
  SORT FIELDS=COPY                               
  OUTREC IFTHEN=(WHEN=INIT,                     
        OVERLAY=(81:SEQNUM,3,ZD,START=0,INCR=1)),
         IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),     
        OVERLAY=(81:C'000')),                   
         IFTHEN=(WHEN=(1,7,CH,EQ,C'TRAILER'),   
        OVERLAY=(81:C'000'))                     
  OUTFIL INCLUDE=(81,3,ZD,EQ,0),                 
  OUTREC=(1,80)                                 
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities 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