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

Variable file read in pl/1 and cobol


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Appu

New User


Joined: 26 Apr 2010
Posts: 73
Location: India

PostPosted: Tue Aug 09, 2011 3:18 pm
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: 6966
Location: porcelain throne

PostPosted: Tue Aug 09, 2011 3:32 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 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 Replace each space in cobol string wi... COBOL Programming 3
No new posts Error to read log with rexx CLIST & REXX 11
Search our Forums:

Back to Top