Page 1 of 1

What's the difference between sequential line sequential?

Posted: Tue Dec 24, 2013 5:50 pm
by Rudhra
Hi,

What is the difference between sequential and line sequential files? Do they need differnt processing from COBOL?

Re: What's the difference between sequential line sequential

Posted: Wed Dec 25, 2013 8:30 am
by Robert Sample
The Enterprise COBOL Language Reference Manual indicates that line sequential is reserved to only HFS (Unix System Services) files. Line sequential is text stream I/O, which means you can read individual bytes (or sets of bytes) rather than reading sequential records. If you are writing programs for z/OS, you are using sequential files -- period. ONLY if you are writing programs to access Unix System Services text stream files would you use line sequential.

Note that line sequential is used more often with Windows and Unix COBOL compilers; it is almost never seen on a z/OS system.

Re: What's the difference between sequential line sequential

Posted: Thu Dec 26, 2013 2:14 pm
by Rudhra
I read that LDS is also "line sequential" and we use them in DB2 - so they are under zOS? But as you say, if you are writing programs for z/OS, you are using sequential files - does that mean a COBOL can't read an LDS?

Re: What's the difference between sequential line sequential

Posted: Thu Dec 26, 2013 9:13 pm
by Robert Sample
A VSAM Linear Data Set -- which is what I assume you meant by "LDS" -- is a VSAM file and hence cannot be considered sequential as it is defined in terms of controlintervals and controlareas. A VSAM LDS cannot be read at a record level -- which will cause a problem for a COBOL program since COBOL works on records. It may be possible to read an LDS in COBOL using DIV (Data-In-Virtual) but I have not done any research to find out if this is possible.

The main two uses for LDS data sets are DB2 (which controls ALL access to the LDS and hence cannot be read in COBOL), and z/FS file systems (which again cannot be read in COBOL -- although it MAY be possible to read a file in the z/FS file system using COBOL).

Re: What's the difference between sequential line sequential

Posted: Thu Dec 26, 2013 11:12 pm
by Anuj Dhawan
LDS has unstructured 4k fixed size CIs and these CIs do not contain control fields. And so, they do not contain any logical records (a requirement for COBOL, as Robert has also said).

Hope this helps.

Re: What's the difference between sequential line sequential

Posted: Tue Dec 31, 2013 4:37 pm
by Rudhra
Thanks Robert and Anuj.