Segregating a variable length file in to different files.
-
- Registered Member
- Posts: 12
- Joined: Mon Sep 29, 2014 11:45 am
Segregating a variable length file in to different files.
Hi,
For an input file which is variable block and is of length 214. This file can have four type of records. Length 80, 100, 200 and 210. My objective is to read this input file, which is apparently variable block file, and write the output files. There should be four different output files. How can I know the length of the file while reading? And how can I write 4 output files. Please help out.
Thanks
For an input file which is variable block and is of length 214. This file can have four type of records. Length 80, 100, 200 and 210. My objective is to read this input file, which is apparently variable block file, and write the output files. There should be four different output files. How can I know the length of the file while reading? And how can I write 4 output files. Please help out.
Thanks
- Robert Sample
- Global Moderator
- Posts: 1891
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Segregating a variable length file in to different files.
Read the Enterprise COBOL Language Reference manual for the RECORD CONTAINS DEPENDING ON clause.How can I know the length of the file while reading?
1. Write 4 SELECT statements.And how can I write 4 output files.
2. Write 4 FDs.
3. Open 4 files for output.
4. Write WRITE <record name> 4 times with <record name> being different each time (one per file).
5. Close 4 files.
You'll need EVALUATE or IF logic to determine which record to write each time.
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: Segregating a variable length file in to different files.
Note, it is not the "length of the file" it is the record-length, an entirely different thing, whatever you think length of the file means.
Re: Segregating a variable length file in to different files.
Does the record length depend upon type of record? Id there a record type identifier? If "yes" to both then write out according to record type - no need to know the length.
Regards
Nic
Nic
-
- Registered Member
- Posts: 12
- Joined: Mon Sep 29, 2014 11:45 am
Re: Segregating a variable length file in to different files.
Thnaks Robert. Thanks for the hint, I will work with them.Robert Sample wrote:Read the Enterprise COBOL Language Reference manual for the RECORD CONTAINS DEPENDING ON clause.How can I know the length of the file while reading?
1. Write 4 SELECT statements.And how can I write 4 output files.
2. Write 4 FDs.
3. Open 4 files for output.
4. Write WRITE <record name> 4 times with <record name> being different each time (one per file).
5. Close 4 files.
You'll need EVALUATE or IF logic to determine which record to write each time.
-
- Registered Member
- Posts: 12
- Joined: Mon Sep 29, 2014 11:45 am
Re: Segregating a variable length file in to different files.
As of now there is no record type identifier. Length is the only record type identifier.nicc wrote:Does the record length depend upon type of record? Id there a record type identifier? If "yes" to both then write out according to record type - no need to know the length.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute