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
 

 

Variable file read in pl/1 and cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
Appu

New User


Joined: 26 Apr 2010
Posts: 74
Location: India

PostPosted: Tue Aug 09, 2011 3:18 pm    Post subject: Variable file read in pl/1 and cobol
Reply with quote

Hello Team,

I am facing one issue while reading a Variable record file in COBOL and PL/1. The record length of the file is 4064 which is getting read to a 4064 char varying in pl/1. But I was surprised to see in one single read COBOL is taking data from next row also.

Input file ( 4 records )
----------------------------
Record with length 4060
Record with length 4008
Record with length 4059
Record with length 2822

Reading in COBOL
-------------------------
Read1 : 1st record read
Read2 : 2nd record + 52 chars from record 3
Read3 : 3rd record read
Read 4: 4th record read



Reading in PL/1
-------------------------
Read1 : 1st record read
Read2 : 2nd record read
Read3 : 3rd record read
Read 4: 4th record read

Can anyone tell me why in COBOL in 2nd read, it reads the rest of teh characters from next record. Is there any option to do the same in PL/1.

The declaration for teh files in cobol and pl/1 are as follows:

PL/1
DCL INFILE FILE RECORD ENV(VB RECSIZE(4064));

COB
FD INFILE
RECORDING V
BLOCK 0 RECORDS.


Please comment.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Aug 09, 2011 3:32 pm    Post subject:
Reply with quote

the issue you are facing is lack of understanding.
Reading the manuals will correct that issue

1. for the COBOL:
not knowing your select statements,
your record definition in your fd statements
your read statement

I will still say:
cobol is not reading 52 chars from record 3
a cobol variable length read, will only move the length of the record.

what you are seeing is left over from the previous read.

use the read into work-area option
and
initialize the work-area to spaces or low-values before each read
and you will see.
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 -> PL/I & Assembler 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 11 Tue May 16, 2017 2:20 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 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


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