Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Read Unknown Length record
Hi All,
We have file containing n*Records without any Line seperator.
This implies complete file will be in one line: Now, How do we read
this one line (nRecords with no seperator) in Cobol?

No. of Records in the file can vary from 2000-15000 and each record is
of size 60 bytes.

Would it be possible to read a file for X bytes without knowing the
complete length?

Can someone help me please !

-Vijay


Report this thread to moderator Post Follow-up to this message
Old Post
svaranas@hotmail.com
12-17-04 01:55 AM


Re: Read Unknown Length record
> We have file containing n*Records without any Line seperator.
> This implies complete file will be in one line:

No, it does not imply that at all.  Not in Cobol, nor in any language.
The file is most likely in fixed length segments, the length of which
is known to be program.  The program just reads one chunk of n bytes
and then the next chunk of n bytes.

> No. of Records in the file can vary from 2000-15000 and
> each record is of size 60 bytes.

Exactly.   The program knows it is 60 byte records so the first read
just reads bytes 1 - 60 and advances the file pointer to 61.  The next
read gets bytes 61-120 and so on.


Report this thread to moderator Post Follow-up to this message
Old Post
Richard
12-17-04 08:55 AM


Re: Read Unknown Length record
- posted and emailed -

In article <1103237938.139278.319220@z14g2000cwz.googlegroups.com>,
<svaranas@hotmail.com> wrote:
>Hi All,
>We have file containing n*Records without any Line seperator.

[snip]

>Can someone help me please !

This might be possible... but it would be good not to duplicate your own
efforts; please post what you have coded so far for a solution.

DD


Report this thread to moderator Post Follow-up to this message
Old Post
docdwarf@panix.com
12-17-04 08:55 AM


Re: Read Unknown Length record
svaranas@hotmail.com wrote:
> Hi All,
> We have file containing n*Records without any Line seperator.
> This implies complete file will be in one line: Now, How do we read
> this one line (nRecords with no seperator) in Cobol?
>
> No. of Records in the file can vary from 2000-15000 and each record is
> of size 60 bytes.
>
> Would it be possible to read a file for X bytes without knowing the
> complete length?
>
> Can someone help me please !

Allow me to rephrase: You have an indeterminate number of fixed-length
60-byte records. Yes?

COBOL generally admits of two types of text files:

LINE SEQUENTIAL where the record is delimited by a carriage-return and the
unused bytes of the FD are blank-filled on input and

SEQUENTIAL where the record is defined as the length specified in the FD.

Point being, there are TWO types of sequential files native to COBOL; you
want the other one.

In your case:

SELECT IN-FILE ASSIGN TO {something}
ORGANIZATION IS SEQUENTIAL (or whatever your compiler uses)
..

FD  IN-FILE.
01  IN-REC   PIC X(60).

There is another way. Don't use it if you want the results before next
Wednesday.

FD  IN-FILE.
01  IN-REC  PIC X.

PERFORM VARYING I FROM 1 BY 1 UNTIL I > 60
READ IN-FILE
END-PERFORM.

This last example burns CPU cycles like witches in Salem, but may sometimes
be necessary if the record delimited is something goofy (like "?").




Report this thread to moderator Post Follow-up to this message
Old Post
JerryMouse
12-17-04 08:55 AM


Re: Read Unknown Length record
On 16 Dec 2004 14:58:58 -0800, svaranas@hotmail.com wrote:

>Hi All,
>We have file containing n*Records without any Line seperator.
>This implies complete file will be in one line: Now, How do we read
>this one line (nRecords with no seperator) in Cobol?
>
>No. of Records in the file can vary from 2000-15000 and each record is
>of size 60 bytes.
>
>Would it be possible to read a file for X bytes without knowing the
>complete length?
>
>Can someone help me please !

It's normal for 'Cobol files' to not have a line seperator. Define it
as ORGANIZATION [RECORD] SEQUENTIAL with a record length (in the FD)
of 60 bytes.

Report this thread to moderator Post Follow-up to this message
Old Post
Robert Wagner
12-17-04 08:55 AM


Re: Read Unknown Length record
On 16 Dec 2004 14:58:58 -0800, svaranas@hotmail.com wrote:

>Hi All,
>We have file containing n*Records without any Line seperator.
>This implies complete file will be in one line: Now, How do we read
>this one line (nRecords with no seperator) in Cobol?
>
>No. of Records in the file can vary from 2000-15000 and each record is
>of size 60 bytes.
>
>Would it be possible to read a file for X bytes without knowing the
>complete length?
>
>Can someone help me please !

It's normal for 'Cobol files' to not have a line seperator. Define it
as ORGANIZATION [RECORD] SEQUENTIAL with a record length (in the FD)
of 60 bytes.

Report this thread to moderator Post Follow-up to this message
Old Post
Robert Wagner
12-19-04 01:55 AM


Re: Read Unknown Length record
- posted and emailed -

In article <1103237938.139278.319220@z14g2000cwz.googlegroups.com>,
<svaranas@hotmail.com> wrote:
>Hi All,
>We have file containing n*Records without any Line seperator.

[snip]

>Can someone help me please !

This might be possible... but it would be good not to duplicate your own
efforts; please post what you have coded so far for a solution.

DD


Report this thread to moderator Post Follow-up to this message
Old Post
docdwarf@panix.com
12-20-04 08:55 PM


Re: Read Unknown Length record
svaranas@hotmail.com wrote:
> Hi All,
> We have file containing n*Records without any Line seperator.
> This implies complete file will be in one line: Now, How do we read
> this one line (nRecords with no seperator) in Cobol?
>
> No. of Records in the file can vary from 2000-15000 and each record is
> of size 60 bytes.
>
> Would it be possible to read a file for X bytes without knowing the
> complete length?
>
> Can someone help me please !

Allow me to rephrase: You have an indeterminate number of fixed-length
60-byte records. Yes?

COBOL generally admits of two types of text files:

LINE SEQUENTIAL where the record is delimited by a carriage-return and the
unused bytes of the FD are blank-filled on input and

SEQUENTIAL where the record is defined as the length specified in the FD.

Point being, there are TWO types of sequential files native to COBOL; you
want the other one.

In your case:

SELECT IN-FILE ASSIGN TO {something}
ORGANIZATION IS SEQUENTIAL (or whatever your compiler uses)
..

FD  IN-FILE.
01  IN-REC   PIC X(60).

There is another way. Don't use it if you want the results before next
Wednesday.

FD  IN-FILE.
01  IN-REC  PIC X.

PERFORM VARYING I FROM 1 BY 1 UNTIL I > 60
READ IN-FILE
END-PERFORM.

This last example burns CPU cycles like witches in Salem, but may sometimes
be necessary if the record delimited is something goofy (like "?").




Report this thread to moderator Post Follow-up to this message
Old Post
JerryMouse
12-22-04 01:55 PM


Re: Read Unknown Length record
On 16 Dec 2004 14:58:58 -0800, svaranas@hotmail.com wrote:

>Hi All,
>We have file containing n*Records without any Line seperator.
>This implies complete file will be in one line: Now, How do we read
>this one line (nRecords with no seperator) in Cobol?
>
>No. of Records in the file can vary from 2000-15000 and each record is
>of size 60 bytes.
>
>Would it be possible to read a file for X bytes without knowing the
>complete length?
>
>Can someone help me please !

It's normal for 'Cobol files' to not have a line seperator. Define it
as ORGANIZATION [RECORD] SEQUENTIAL with a record length (in the FD)
of 60 bytes.

Report this thread to moderator Post Follow-up to this message
Old Post
Robert Wagner
12-22-04 01:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:46 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.