variable record length file



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

variable record length file

Postby p kavitha » Wed Sep 08, 2010 12:52 pm

hi,


can any body explain how the variable record length file can be specified in file control section :?: :?: :?: .


Thanks and regards,
kavitha
p kavitha
 
Posts: 3
Joined: Wed Sep 08, 2010 11:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: variable record length file

Postby Robert Sample » Wed Sep 08, 2010 2:55 pm

The FILE-CONTROL paragraph associates the COBOL name for the file with the external name (DD name) of the file. There is absolutely nothing in FILE-CONTROL to indicate that a file has variable length records -- this is determined in the FILE SECTION of DATA DIVISION.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: variable record length file

Postby p kavitha » Wed Sep 08, 2010 5:23 pm

Hi,

thanks for replay .then in file section what we want to specify and how can COBOL program recognize that either fixed length or variable length file is using.
p kavitha
 
Posts: 3
Joined: Wed Sep 08, 2010 11:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: variable record length file

Postby Robert Sample » Wed Sep 08, 2010 5:43 pm

There are several ways that COBOL can determine a file has variable length records from the FD description in the FILE SECTION:

1. RECORDING MODE V
2. RECORD CONTAINS clause with minimum and maximum record lengths (and these values are different)
3. Multiple 01 variables in the FD with different lengths
4. At least one 01 variable in the FD that has OCCURS DEPENDING ON
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: variable record length file

Postby p kavitha » Wed Sep 08, 2010 5:55 pm

Hi,


'RECORD CONTAINS clause with minimum and maximum record lengths (and these values are different)'

according to this sentence i want to define two 01 variables in file section then while reading the record how can we specify into which variable the values must move. and explain the situation if the record length is in between minimum and maximum.

reading the record means 'read input-file into variable'.
p kavitha
 
Posts: 3
Joined: Wed Sep 08, 2010 11:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: variable record length file

Postby Robert Sample » Wed Sep 08, 2010 6:19 pm

If you have multiple 01 variables in the FD, when you do a READ command they ALL are loaded with the data read from the file -- there is an implied REDEFINES clause for each so you're really only describing one record area -- just in multiple ways.

RECORD CONTAINS (or RECORD IS VARYING -- they're formats 2 and 3 of the RECORD clause in the Language Reference manual) has nothing to do with multiple 01 variables. You seem to be confusing concepts here.

I strongly recommend you go to IBM's web site, find the COBOL Language Reference manual, and read every page of every subsection of section 5.2 on the file description entries -- this will clarify your understanding of how COBOL deals with files.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: variable record length file

Postby dick scherrer » Thu Sep 09, 2010 12:09 am

Hello,

Do you have something that needs a variable file or is this a solution in search of a requirement?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post