IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Is this the problem with READ Statement in Cobol.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mohan Makana

New User


Joined: 07 Feb 2006
Posts: 18

PostPosted: Tue Feb 27, 2007 6:49 pm
Reply with quote

Hi,

My input file's record length(LRECL) is 760 bytes. but the first record of the input file contained only 350 bytes of data. While READing input file in my program ...it is filling all 760 bytes with the current record data along with the immediate next record data. How do I have to stop this from happening...is this the problem with the input file or with the READ statement.

Thanks,
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Feb 27, 2007 6:53 pm
Reply with quote

What is the COBOL blocksize?
What is the file blocksize?
What is the COBOL recfm?
What is the file recfm?
What is the COBOL lrecl?
What is the file lrecl?
Back to top
View user's profile Send private message
Mohan Makana

New User


Joined: 07 Feb 2006
Posts: 18

PostPosted: Tue Feb 27, 2007 7:01 pm
Reply with quote

Cobol :

BLOCK CONTAINS 0 CHARACTERS
RECORDING MODE IS V
LABEL RECORDS ARE STANDARD
----
Max. Record Length is 760 as it is using different layouts.
--------------------------------------------------------------------
JCL :
DCB=(RECFM=VB,LRECL=760,BLKSIZE=0,DSORG=PS)
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Feb 27, 2007 7:07 pm
Reply with quote

Mohan Makana wrote:
My input file's record length(LRECL) is 760 bytes. but the first record of the input file contained only 350 bytes of data. While READing input file in my program ...it is filling all 760 bytes with the current record data along with the immediate next record data. How do I have to stop this from happening...is this the problem with the input file or with the READ statement.
I can't think of how you can get a read statement to do that.
This sounds like the llbb at the front of the first record says that it is 760 bytes.
Take a hex dump of the block and look to confirm.
Back to top
View user's profile Send private message
Mohan Makana

New User


Joined: 07 Feb 2006
Posts: 18

PostPosted: Tue Feb 27, 2007 8:34 pm
Reply with quote

Cobol :

BLOCK CONTAINS 0 CHARACTERS
RECORDING MODE IS V
LABEL RECORDS ARE STANDARD
----
Max. Record Length is 760 as it is using different layouts.
--------------------------------------------------------------------
JCL :
DCB=(RECFM=VB,LRECL=760,BLKSIZE=0,DSORG=PS)




Hi William,

Does it make any difference if we didn't specify
BLOCK CONTAINS 0 CHARACTERS in the above FD section.

Thanks
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Tue Feb 27, 2007 8:53 pm
Reply with quote

Bill is talking about the preamble (first 4 bytes) in the record where you may find the recordlength of VB files. You can also investigate using TSO.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Feb 27, 2007 11:37 pm
Reply with quote

Mohan Makana wrote:
Does it make any difference if we didn't specify
BLOCK CONTAINS 0 CHARACTERS in the above FD section.
Not on an input file.
Again, you need to get a hex dump of at least the first 8 bytes of the first block (you did say it was the first record read, right?) so that you can verify the actual record length of the first record.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Feb 28, 2007 12:15 am
Reply with quote

Hello,

It would be interesting to see the code and the jcl that created this file. . .
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Wed Feb 28, 2007 5:21 pm
Reply with quote

Hi,

Could you please post the assign-to clause of your input file.

May be that is creating problem.

Actually I encountered the same problem but not on mainframes .
when I was using PC cobol for practice sessions got same problem.

Thanks,
-kapil.
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1104
Location: The Netherlands at Hole 19

PostPosted: Wed Feb 28, 2007 8:12 pm
Reply with quote

Check to DSN characteristics; just might say RECFM=FB
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Error to read log with rexx CLIST & REXX 11
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
Search our Forums:

Back to Top