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

file description


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

New User


Joined: 16 Mar 2009
Posts: 55
Location: India

PostPosted: Wed Jun 09, 2010 8:57 pm
Reply with quote

Hi,

I am reading a file cobol program.

SELECT FILENAME ASSIGN HUST

FD FILENAME
DATARECORD IS FILENAME-REC
01 FILENAME-REC.
05 FILEEMP PIC X(5).
05 FILEDEP PIC X(5).


PROCEDURE DIVISION.

READ FILENAME INTO FILENAME-REC
AT END MOVE Y TO END-OF-FILE.

I am getting a error that overlapping will occur.

Please help out in this,

Thanks,
venkat
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 Jun 09, 2010 8:59 pm
Reply with quote

Hello,

The code is redundant. . . The READ will automatcally put the data into filename-rec. No need for INTO. . .
Back to top
View user's profile Send private message
venkatatcts

New User


Joined: 16 Mar 2009
Posts: 55
Location: India

PostPosted: Wed Jun 09, 2010 9:00 pm
Reply with quote

Thank U..Will post u once i do the change and get it resolved.

Thanks for responding..

Have a nice Day
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Jun 09, 2010 9:07 pm
Reply with quote

the WORKAREA OPTION (into) means that you are in addition to reading the record, moving to a WORKING-STORAGE structure.

when you are simply reading a record from a file into the associated record area,
you don't need the WORKAREA OPTION.
that is why you are receiving the warning about overlapping.

suggest you review the READ statement syntax,
pay particular attention to the INTO identifier-1 description,
where it explicitly states:
The record areas associated with file-name-1 and identifier-1 must not be the same storage area
Back to top
View user's profile Send private message
venkatatcts

New User


Joined: 16 Mar 2009
Posts: 55
Location: India

PostPosted: Wed Jun 09, 2010 10:33 pm
Reply with quote

Thanks for the explanation

Hi,

SELECT FILENAME ASSIGN HUST

FD FILENAME
DATARECORD IS FILENAME-REC
01 FILENAME-REC.
COPY T111145.

PROCEDURE DIVISION.

READ FILENAME INTO FILENAME-REC
AT END MOVE Y TO END-OF-FILE.

COPY T111145 HAS,
01 FILENAME-REC.
05 FILEEMP PIC X(5).
05 FILEDEP PIC X(5).

In this scenario it will work. Am I Correct.

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

Global Moderator


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

PostPosted: Wed Jun 09, 2010 10:37 pm
Reply with quote

venkatatcts wrote:
In this scenario it will work. Am I Correct.
No, just get rid of the INTO clause, then it will work.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Jun 09, 2010 10:39 pm
Reply with quote

01 FILENAME-REC.
COPY T111145.

obviously you did not try to compile,
it would have generated errors in the FD section
since you had 2 record descriptions with the same REFERENCE NAME.

read the link provided

read everybody's comments,
this is not a really difficult concept.

you use the INTO clause of the read statement
to populate a WORKING-STORAGE structure
with the same data that is in the record area,
which is populated (actually pointed to) with a READ without INTO
Back to top
View user's profile Send private message
venkatatcts

New User


Joined: 16 Mar 2009
Posts: 55
Location: India

PostPosted: Wed Jun 09, 2010 10:41 pm
Reply with quote

Ok I got it. Thanks
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 4
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top