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

Copy records from a file


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vasuma

New User


Joined: 23 Aug 2007
Posts: 4
Location: pune,india

PostPosted: Thu Sep 06, 2007 7:24 pm
Reply with quote

How can I copy selected records from a sequential file say for instance only first 10 records of 100, using a copy verb.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Sep 06, 2007 7:43 pm
Reply with quote

SORT FIELDS=COPY,SKIPREC=?,STOPAFT=?
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: Thu Sep 06, 2007 9:32 pm
Reply with quote

vasuma,

You can use this DFSORT job to copy the first 10 records:

Code:

//S1    EXEC  PGM=ICEMAN                                         
//SYSOUT    DD  SYSOUT=*                                         
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file   
//SYSIN    DD    *                                               
  OPTION COPY,STOPAFT=10
/*                                                   


You can use other DFSORT statements to copy other selected records. Which DFSORT statements you would use depends on which records you want to copy.
Back to top
View user's profile Send private message
vasuma

New User


Joined: 23 Aug 2007
Posts: 4
Location: pune,india

PostPosted: Fri Sep 07, 2007 6:45 pm
Reply with quote

hi frank,

I need to do it using a cobol code i mean i am supposed to code a cobol programme for that as i do not have JCL in my environment.



Thanks
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Sep 07, 2007 6:54 pm
Reply with quote

vasuma wrote:
I need to do it using a cobol code i mean i am supposed to code a cobol programme for that as i do not have JCL in my environment.
Might have made sense to post the question in the COBOL area...... icon_rolleyes.gif
Another problem, there is no "copy verb", only read and write verbs.....
Open the input and output files
Read a record
Decide if you want to write that record
Decide if you are done
Close both files
Done
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Sat Sep 08, 2007 10:40 am
Reply with quote

Quote:
i do not have JCL in my environment.

If your environment is IBM MF then how will your COBOL program be executed without JCL.
Back to top
View user's profile Send private message
vasuma

New User


Joined: 23 Aug 2007
Posts: 4
Location: pune,india

PostPosted: Sat Sep 08, 2007 12:38 pm
Reply with quote

hi devzee,


i execute it using unix and not jcl.


thanks
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Sep 09, 2007 4:32 am
Reply with quote

Hello Vasuma and welcome to the forums,

Which unix platform are you running on?

Which COBOL are you using?
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top