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
 

 

file description

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: file description
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jun 09, 2010 8:59 pm    Post subject:
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    Post subject: Reply to: file description
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: 6968
Location: porcelain throne

PostPosted: Wed Jun 09, 2010 9:07 pm    Post subject:
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    Post subject: Reply to: file description
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: 3158
Location: Tucson AZ

PostPosted: Wed Jun 09, 2010 10:37 pm    Post subject: Re: Reply to: file description
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: 6968
Location: porcelain throne

PostPosted: Wed Jun 09, 2010 10:39 pm    Post subject:
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    Post subject: Reply to: file description
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    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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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