Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
how to read a Unformatted file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 120
Location: USA

PostPosted: Fri Jan 18, 2008 11:32 am    Post subject: how to read a Unformatted file
Reply with quote

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
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Fri Jan 18, 2008 11:56 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jan 18, 2008 9:02 pm    Post subject:
Reply with quote

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
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Fri Jan 18, 2008 9:20 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 967
Location: Richmond, Virginia

PostPosted: Sat Jan 19, 2008 6:30 am    Post subject:
Reply with quote

Dick's question is the key - what are you doing with this file?
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Jan 20, 2008 9:27 am    Post subject:
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Jan 23, 2008 4:56 am    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10375
Location: italy

PostPosted: Wed Jan 23, 2008 5:07 am    Post subject: Reply to: how to read a Unformatted file
Reply with quote

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
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Jan 23, 2008 5:18 am    Post subject:
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Jan 23, 2008 7:07 pm    Post subject:
Reply with quote

Enrico,

You quoted my post and then commented. I'm not sure of what you disagreed.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jan 23, 2008 8:38 pm    Post subject:
Reply with quote

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. . . icon_smile.gif
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Jan 23, 2008 10:38 pm    Post subject:
Reply with quote

Agreement is usually prefaced with: "To expand on Jack's EXCELLENT comments, ......" icon_biggrin.gif

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jan 23, 2008 11:17 pm    Post subject: Reply to: how to read a Unformatted file
Reply with quote

Quote:
Agreement is usually prefaced with: "To expand on Jack's EXCELLENT comments, ......"
heh heh heh. . .

d
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10375
Location: italy

PostPosted: Thu Jan 24, 2008 1:36 pm    Post subject: Reply to: how to read a Unformatted file
Reply with quote

Hi Jack,
I was not disagreing icon_biggrin.gif

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Jan 24, 2008 7:22 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us