View previous topic :: View next topic
|
Author |
Message |
venkatatcts
New User
Joined: 16 Mar 2009 Posts: 55 Location: India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
The code is redundant. . . The READ will automatcally put the data into filename-rec. No need for INTO. . . |
|
Back to top |
|
|
venkatatcts
New User
Joined: 16 Mar 2009 Posts: 55 Location: India
|
|
|
|
Thank U..Will post u once i do the change and get it resolved.
Thanks for responding..
Have a nice Day |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
venkatatcts
New User
Joined: 16 Mar 2009 Posts: 55 Location: India
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
venkatatcts
New User
Joined: 16 Mar 2009 Posts: 55 Location: India
|
|
|
|
Ok I got it. Thanks |
|
Back to top |
|
|
|