It is not the "length of the file" it is the record-length.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Gaurav ABN
Registered Member
Posts: 12
Joined: Mon Sep 29, 2014 11:45 am

It is not the "length of the file" it is the record-length.

Post by Gaurav ABN »

HI

I created this post Segregating a variable length file in to different files.. What is the meaning of statement "It is not the "length of the file" it is the record-length." Is not it one or the same thing?
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: It is not the "length of the file" it is the record-length.

Post by nicc »

1) it is not a file but a dataset
2) a record is a single item within the dataset - a dataset contains 0 to many records. The length of a dataset is the combined length of all the records within it plus the lengths of each inter-block gap plus the length of included control information. A bit of simple thinking would tell you this.
Regards
Nic
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1885
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: It is not the "length of the file" it is the record-length.

Post by Robert Sample »

What is the meaning of statement "It is not the "length of the file" it is the record-length." Is not it one or the same thing?
Consider a data set with fixed 80-byte length records. The data set has 10,000 records (exactly) in it. The record length for each and every record is 80 bytes. However, the data set has a total size of 800,000 bytes (10000 times 80). If you transfer this data set to a PC, the resulting PC file will be at least 800,000 bytes (more if transferred as text), not 80 bytes.
Gaurav ABN
Registered Member
Posts: 12
Joined: Mon Sep 29, 2014 11:45 am

Re: It is not the "length of the file" it is the record-length.

Post by Gaurav ABN »

nicc wrote:1) it is not a file but a dataset
2) a record is a single item within the dataset - a dataset contains 0 to many records. The length of a dataset is the combined length of all the records within it plus the lengths of each inter-block gap plus the length of included control information. A bit of simple thinking would tell you this.
Hmm.. yes a rational thinking is all we need but I thought to ask it as a discussion. And thought to start a new thread so that I don't disturb the existing one.

I understand that a dataset can have many records but we also refer the file length as "Logical record length" which is always, logically assumed to be the file length while it's the length of the highest record in the file. So it's not really a length of the file, so to say, it's the length of the record?


You also said, "it is not a file but a dataset", but we can use the interchangeably right? Or can not we?
Gaurav ABN
Registered Member
Posts: 12
Joined: Mon Sep 29, 2014 11:45 am

Re: It is not the "length of the file" it is the record-length.

Post by Gaurav ABN »

Robert Sample wrote:
What is the meaning of statement "It is not the "length of the file" it is the record-length." Is not it one or the same thing?
Consider a data set with fixed 80-byte length records. The data set has 10,000 records (exactly) in it. The record length for each and every record is 80 bytes. However, the data set has a total size of 800,000 bytes (10000 times 80). If you transfer this data set to a PC, the resulting PC file will be at least 800,000 bytes (more if transferred as text), not 80 bytes.
Thank you Robert. :)
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: It is not the "length of the file" it is the record-length.

Post by nicc »

Being pedantic, and technically, correct then you cannot use 'file' instead of 'dataset'. We know what you mean and we (all?) use the terms interchangeably - but we shouldn't especially if you are discussing PC/*nix files and z/os datasets in the same conversation.

We NEVER refer to the dataset length as the logical record length - the two are entirely different things. The logical record length is the length of an individual record,
the physical record length is the length of a block which usually contains several logical records, the 'file' length is the sum of the lengths of all the records within the file plus any inter-block gaps and embedded control data.
Regards
Nic
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1885
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: It is not the "length of the file" it is the record-length.

Post by Robert Sample »

You also said, "it is not a file but a dataset", but we can use the interchangeably right? Or can not we?
The ONLY time the term "file" should be used on a mainframe is when you are talking about Unix System Services files. z/OS has data sets, and since z/OS runs Unix System Services which has files, the terms are NOT interchangeable -- a "file" is a Unix System Services term and a "data set" is a z/OS term. A file will have Unix permissions while a data set won't. A file is in a directory; a data set is not.

Practically, when the context is clear, a data set is sometimes referred to as a file even though technically the term is used wrongly. However, especially since Unix System Services came along and directories / files became relevant to z/OS, I personally have tried to avoid the term "file" in referring to z/OS data sets since it is easy to be misinterpreted.
Gaurav ABN
Registered Member
Posts: 12
Joined: Mon Sep 29, 2014 11:45 am

Re: It is not the "length of the file" it is the record-length.

Post by Gaurav ABN »

nicc wrote:Being pedantic, and technically, correct then you cannot use 'file' instead of 'dataset'. We know what you mean and we (all?) use the terms interchangeably - but we shouldn't especially if you are discussing PC/*nix files and z/os datasets in the same conversation.

We NEVER refer to the dataset length as the logical record length - the two are entirely different things. The logical record length is the length of an individual record,
the physical record length is the length of a block which usually contains several logical records, the 'file' length is the sum of the lengths of all the records within the file plus any inter-block gaps and embedded control data.
Thanks but in JCL we always make use of LRECL which actually mean logical record length and relate to the dataset mentioned there. Then is it actually relating to the records and not the data set?
Gaurav ABN
Registered Member
Posts: 12
Joined: Mon Sep 29, 2014 11:45 am

Re: It is not the "length of the file" it is the record-length.

Post by Gaurav ABN »

Robert Sample wrote:
You also said, "it is not a file but a dataset", but we can use the interchangeably right? Or can not we?
The ONLY time the term "file" should be used on a mainframe is when you are talking about Unix System Services files. z/OS has data sets, and since z/OS runs Unix System Services which has files, the terms are NOT interchangeable -- a "file" is a Unix System Services term and a "data set" is a z/OS term. A file will have Unix permissions while a data set won't. A file is in a directory; a data set is not.

Practically, when the context is clear, a data set is sometimes referred to as a file even though technically the term is used wrongly. However, especially since Unix System Services came along and directories / files became relevant to z/OS, I personally have tried to avoid the term "file" in referring to z/OS data sets since it is easy to be misinterpreted.
"A file is in a directory; a data set is not", directory as in "folder"? or you mean some meaning?
User avatar
Akatsukami
Global Moderator
Global Moderator
Posts: 122
Joined: Tue Oct 20, 2015 3:20 am
Location: Bloomington, IL
Contact:

Re: It is not the "length of the file" it is the record-length.

Post by Akatsukami »

Gaurav ABN wrote:Thanks but in JCL we always make use of LRECL which actually mean logical record length and relate to the dataset mentioned there. Then is it actually relating to the records and not the data set?
That is basically correct, although that you won't "always make use of LRECL"; you do not use it on data sets with a status of OLD or SHR, and many utilities can (and do) determine the LRECL of their outputs themselves.
"I come to the conclusion that, men loving according to their own will and fearing according to that of the prince, a wise prince should establish himself on that which is in his own control and not in that of others." -- Niccolò Machiavelli
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1885
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: It is not the "length of the file" it is the record-length.

Post by Robert Sample »

"A file is in a directory; a data set is not", directory as in "folder"? or you mean some meaning?
ABSOLUTELY NOT! A "folder" is a Windows construct and has no meaning on a mainframe. A Unix directory is equivalent to a folder on Windows but they are different (one key respect is that only Windows will have folders; Unix systems -- including the mainframe -- has directories).
Gaurav ABN
Registered Member
Posts: 12
Joined: Mon Sep 29, 2014 11:45 am

Re: It is not the "length of the file" it is the record-length.

Post by Gaurav ABN »

Akatsukami wrote:
Gaurav ABN wrote:Thanks but in JCL we always make use of LRECL which actually mean logical record length and relate to the dataset mentioned there. Then is it actually relating to the records and not the data set?
That is basically correct, although that you won't "always make use of LRECL"; you do not use it on data sets with a status of OLD or SHR, and many utilities can (and do) determine the LRECL of their outputs themselves.
Thank you!

But should not the concept be applicable to all the type of DISP equally and should not change its meaning of it as per the different DISP parameters?
Gaurav ABN
Registered Member
Posts: 12
Joined: Mon Sep 29, 2014 11:45 am

Re: It is not the "length of the file" it is the record-length.

Post by Gaurav ABN »

Robert Sample wrote:
"A file is in a directory; a data set is not", directory as in "folder"? or you mean some meaning?
ABSOLUTELY NOT! A "folder" is a Windows construct and has no meaning on a mainframe. A Unix directory is equivalent to a folder on Windows but they are different (one key respect is that only Windows will have folders; Unix systems -- including the mainframe -- has directories).
Thanks for the clarification. This is helpful.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: It is not the "length of the file" it is the record-length.

Post by nicc »

You only need to specify LRECL and RECFM when creating a dataset. That information is recorded and the system can reference it at all other times. You really need to read various manuals to get the basics sorted out.
Regards
Nic
Post Reply

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

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”