Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Reading a varaible length file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Reading a varaible length file
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: 1187
Location: Bangalore,India

PostPosted: Wed Sep 24, 2008 12:33 pm    Post subject:
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    Post subject:
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: 6967
Location: porcelain throne

PostPosted: Wed Sep 24, 2008 1:40 pm    Post subject:
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: 8055
Location: East Dubuque, Illinois, USA

PostPosted: Wed Sep 24, 2008 6:00 pm    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Sep 25, 2008 5:27 am    Post subject: Re: Reading a varaible length file
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Sep 25, 2008 6:13 am    Post subject: Re: Reading a varaible length file
Reply with quote

Here's a previous post -

http://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    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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us