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

Reading a varaible length file


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

New User


Joined: 16 Apr 2008
Posts: 86
Location: Bangalore

PostPosted: Wed Sep 24, 2008 12:19 pm
Reply with quote

Hi,
I have an issue in reading variable length file.
I have a file of RECFM VB and LRECL 1000.
When I read this file sequentially at some point of read, 2 3 lines are read for one read statement.
i.e.

Length of Line 1: 500
Length of Line 2: 650
Length of Line 3: 800

First Read Line1(1,500) + Line2(1,500) is read
Second Read Line2(501,150) + Line3(800) + Line4(1,50)

This is happening only for some records not for all
I have checked the HEX values which is spaces for all the unused bytes of all the records.

Please let me how I can resolve this issue?

Regards,
Balu
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed Sep 24, 2008 12:33 pm
Reply with quote

Hi Balu,

would you please give us the code for readingthe files. It seems that you are not initialize the records before reading it.
Back to top
View user's profile Send private message
vvmanyam

New User


Joined: 16 Apr 2008
Posts: 86
Location: Bangalore

PostPosted: Wed Sep 24, 2008 1:31 pm
Reply with quote

Ekta,
I don't think it is problem with initialization because the next record details are read in the current read.
i have displayed the record after each read..

Balu.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Sep 24, 2008 1:40 pm
Reply with quote

Balu,

need to see the file attributes.

need to see your select statement

need to see your fd statements

need to see your read statement

if you are using the workarea option with the read (hope you are)
need to see the working-storage description of the workarea


If you are looking in the FD record area, you will see a blocks worth of data. as you issue reads, the fd record area will be pointed appropriately.

What are you using to determine the different types of records?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Sep 24, 2008 6:00 pm
Reply with quote

Are you using READ INTO and displaying the WORKING-STORAGE 01, or are you using READ and displaying the FD 01? Do you have a RECORD VARYING clause in your FD?

If you're displaying the FD 01 you're working in the buffer and you need to have a RECORD VARYING clause in the FD so you can use reference modification to only display the current record data; if you display the entire 1,000 bytes you may see more than the current record in the DISPLAY.

Note that none of this has any impact on your program execution. The current record will be processed as it should be; it is only the display that can show data from additional record(s) -- the program won't process that data until the next READ statement is executed.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Sep 25, 2008 5:27 am
Reply with quote

In the COBOL manual, review the optional FD clause for variable-length records - RECORD CONTAINS XXXX TO 1000 CHARACTERS DEPENDING ON "AN UNSIGNED WS FIELD", such as a PIC 9(05) COMP-3 definition or a PIC 9(08) COMP or COMP-5 definition. A PIC 9(05) DISPLAY-NUMERIC definition is also an option.

In fact, I believe this has been discussed on the forum previously.

Regards,

Bill
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Sep 25, 2008 6:13 am
Reply with quote

Here's a previous post -

www.ibmmainframes.com/viewtopic.php?p=127660&highlight=#127660

Regards,

Bill
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 FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
Search our Forums:

Back to Top