|
View previous topic :: View next topic
|
| Author |
Message |
vrakeshmbt
New User
Joined: 17 Aug 2005 Posts: 30
|
|
|
|
| How to copy only the required records from a sequential file with out writing a COBOL program. |
|
| Back to top |
|
 |
sunish
New User
Joined: 23 May 2005 Posts: 19
|
|
|
|
hi
use the jcl sort
consider that your file has 10 records and you want records from 5 to 10 to be written in to another file. give the code. if iam worng pl correct
sort fields=(1,5,ch,a) skiprec=4 stopaft=10 |
|
| Back to top |
|
 |
vrakeshmbt
New User
Joined: 17 Aug 2005 Posts: 30
|
|
|
|
| Thanks a lot Sunish |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
| sort fields=(1,5,ch,a) skiprec=4 stopaft=10 |
This is a sort - it will sort the records by the first 5 bytes, so they will be rearranged (unless they're already in sorted order). A sort is different from a copy.
The question was:
| Quote: |
| How to copy only the required records from a sequential file with out writing a COBOL program. |
For a copy operation, use:
| Code: |
OPTION COPY
or
SORT FIELDS=COPY
|
How you would copy only the required records depends on how you identify the records to be copied. If you want to copy from record x to record x+n (e.g. records 5-10), you can use SKIPREC and STOPAFT (or OUTFIL STARTREC and ENDREC). If you want to copy records identified by a specific criteria (e.g. all the records with 'A' in position 25), you can use INCLUDE. If you want to copy a sample of records (e.g. every 10th record), you can use SAMPLE, etc.
If you need more specific help, describe how you want to identify the records to be copied. |
|
| Back to top |
|
 |
|
|