View previous topic :: View next topic
|
Author |
Message |
bhaskar_kanteti
Active User
Joined: 01 Feb 2007 Posts: 123 Location: Hyderabad
|
|
|
|
Hi,
how to define and read a unformatted file in cobol program. I will be getting the file as U type. ie. Unformatted.
when i seen the properties of this U file, the LRECL is 0.
How to define in file section. How to handle this unformatted file in cobol program. Is it different from FB and VB.
Help me in this regard. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Bhaskar,
Quote: |
how to define and read a unformatted file in cobol program. |
Refer 'RECORDING-MODE' and 'read' statements in the COBOL manual. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
If the file is "unformatted", how will you process it?
What kind of data will/does it contain?
What does the data look like if you view it in tso/ispf or some other editor? |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 631 Location: Wisconsin
|
|
|
|
U doesn't mean unformatted, it means the blocking for the file is unknown. If the records actually have a layout but have unknown blocking, you would have to read a byte stream and look for indicators that you have read a whole record.
Things just don't deal well with U though. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1049 Location: Richmond, Virginia
|
|
|
|
Dick's question is the key - what are you doing with this file? |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Bhaskar,
Whoever created this file holds the key to processing it. If you don't know the name of the pgm that created the file, search the JCL/sourcelib(s) at your site to find it.
Then study the code. It will tell you how to acess the data in the file. Then do what you need to do.
PS. The blocks in the file can be either fixed length (as in a PDS directory) or variable in length, but will not contain RDWs or BDWs as V/VB files do. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
While we're waiting for Bhaskar to reply...
Steve said:
Quote: |
you would have to read a byte stream and look for indicators that you have read a whole record. |
Actually, U records can be processed very much like V recs:
Use the same RECORD VARYING.... DEPENDING ON .... clause in the FD or multiple 01 rec descriptions.
READ the file and chk the DEPENDING ON field for the length of the block.
Fill the DEPENDING ON field before issuing each WRITE.
The only difference between V and U is that U recs use the same length in the pgm and JCL, and, there's no block (or is it rec?) w/format U. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Quote: |
The only difference between V and U is that U recs use the same length in the pgm and JCL, and, there's no block (or is it rec?) w/format U. |
record format undefined, blksize xxxxx
at every read or write operation up to xxxxx bytes are going to transferred
from/to the external medium
from an I/O point of view the logical record is always a full block..
there is no guarantee at all that each block(record) will be of the same size |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 631 Location: Wisconsin
|
|
|
|
If it is just a big XML stream you could be fine too. Then who cares what the layout of the data is, just use the cobol XML PARSE. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Enrico,
You quoted my post and then commented. I'm not sure of what you disagreed. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Guys,
Maybe i'm still in the fog, but i read it as additional clarification rather than a difference. . .
If i'm still in the fog, shine a light my way. . . |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Agreement is usually prefaced with: "To expand on Jack's EXCELLENT comments, ......"
I think Enrico may have thought that I was saying that all blocks(recs) in a fmt U file are the same. What I meant was that fmt U recs, unlike fmt V recs, don't use a n RDW. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Quote: |
Agreement is usually prefaced with: "To expand on Jack's EXCELLENT comments, ......" |
heh heh heh. . .
d |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Hi Jack,
I was not disagreing
Quote: |
... there's no block (or is it rec?) w/format U. |
I was lazy not to quote the exact fragment I wanted to comment on...
I have always, in my loong years of IT practicing, spoken about
blocks when seen from the point of view of the data management
records when seen from the point of view of the program
maybe was the question mark which made me try to clarify |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Enrico,
The reason I used the "?" is that I noticed COBOL prohibits the use of the "BLOCK CONTATNS ..." clause for fmt U files, but on the other hand, in the JCL, the DD stmt requires "BLKSIZE= ..." when creating one.
I'm easily confused. |
|
Back to top |
|
|
|