Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Copy first 50 records from input file to output file

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

New User


Joined: 27 Mar 2006
Posts: 95
Location: India

PostPosted: Mon Jun 12, 2006 7:49 pm    Post subject: Copy first 50 records from input file to output file
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

Moderator Team Head


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

PostPosted: Mon Jun 12, 2006 8:14 pm    Post subject: Re: Copy first 50 records from input file to output file
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: 95
Location: India

PostPosted: Mon Jun 12, 2006 8:25 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Re: Copy first 50 records from input file to output file
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 Moderator


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

PostPosted: Mon Oct 09, 2006 9:13 pm    Post subject:
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    Post subject: With Sort:
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 Moderator


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

PostPosted: Mon Nov 06, 2006 10:06 pm    Post subject:
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    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 Sort Card to Remove Duplicate records... raj4neo SYNCSORT 2 Wed Jan 25, 2017 4:44 am
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us