IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Copy first 50 records from input file to output file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rajesh_mbt

New User


Joined: 27 Mar 2006
Posts: 97
Location: India

PostPosted: Mon Jun 12, 2006 7:49 pm
Reply with quote

I want to copy first 50 records from an input file to output file.
How can I do it in JCL? Can anyone help me please ?
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Mon Jun 12, 2006 8:14 pm
Reply with quote

You can use the IDCAMS program with the REPRO function, specifying the optional COUNT(nn) parameter.

You can use the DFSORT method as described here in the Smart DFSORT Tricks guide.
Back to top
View user's profile Send private message
rajesh_mbt

New User


Joined: 27 Mar 2006
Posts: 97
Location: India

PostPosted: Mon Jun 12, 2006 8:25 pm
Reply with quote

Moderaor
Thank you very much...
Back to top
View user's profile Send private message
sameer

New User


Joined: 10 Mar 2005
Posts: 41
Location: United States Of America

PostPosted: Thu Jul 06, 2006 1:55 pm
Reply with quote

use SORT & STOPAFT=50
Back to top
View user's profile Send private message
cjcpr

New User


Joined: 21 Mar 2006
Posts: 21
Location: USA

PostPosted: Fri Jul 07, 2006 1:06 am
Reply with quote

sameer wrote:
use SORT & STOPAFT=50


This is the quick and easy way.
Back to top
View user's profile Send private message
raviprasath_kp
Warnings : 1

New User


Joined: 20 Feb 2005
Posts: 65
Location: chennai

PostPosted: Sun Oct 08, 2006 9:08 pm
Reply with quote

i think we can give FROMKEY AND TOKEY COMMAN
PLEASE VERIFY
Back to top
View user's profile Send private message
lal_arun_272

New User


Joined: 09 Oct 2006
Posts: 31
Location: Bangalore

PostPosted: Mon Oct 09, 2006 6:57 pm
Reply with quote

Hi Please find an example how to copy 50 infile record into output file


//STEP01 EXEC PGM=IDCAMS
//INDATA DD DSN=INPUTFLE1,
// DISP=SHR
//OUTDATA DD DSN=OUTPUTFILE,
// DISP=(NEW,CATLG,CATLG),
// DCB=(BLKSIZE=0,LRECL=75,RECFM=FB),
// SPACE=(TRK,(75,150),RLSE),
// UNIT=SYSDA
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSIN DD *
REPRO INFILE(INDATA) OUTFILE(OUTDATA) COUNT(50)
/*

Thanks
Arunlal
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Oct 09, 2006 9:13 pm
Reply with quote

With DFSORT:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY,STOPAFT=50
/*
Back to top
View user's profile Send private message
rini

New User


Joined: 16 May 2006
Posts: 6

PostPosted: Mon Nov 06, 2006 5:02 pm
Reply with quote

Startrec and Endrec option can also be given.
Code:
//step1 EXEC PGM=SORT
//sysout dd sysout=*
//sortin dd dsn=......input file
//sortof01 dd dsn=......output file
//sysin dd *
    sort fields=copy
    outfil files=01, startrec=01,endrec=50
/*       
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Nov 06, 2006 10:06 pm
Reply with quote

Quote:
Startrec and Endrec option can also be given


Well, that would be:

Code:

    SORT FIELDS=COPY
    OUTFIL FILES=01,STARTREC=01,ENDREC=50


but STARTREC=01 isn't needed in this case.

However, STOPAFT=50 is more efficient than ENDREC=50. With STOPAFT=50, DFSORT actually stops reading input records after the first 50 have been read, whereas with ENDREC=50, DFSORT reads all of the records.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top