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 records from a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Copy records from a file
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: 2150
Location: At my coffee table

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

SORT FIELDS=COPY,SKIPREC=?,STOPAFT=?
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: Thu Sep 06, 2007 9:32 pm    Post subject:
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    Post subject: without a jcl
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: 3158
Location: Tucson AZ

PostPosted: Fri Sep 07, 2007 6:54 pm    Post subject: Re: without a jcl
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Sun Sep 09, 2007 4:32 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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