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

Access mode is Dynamic


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

New User


Joined: 27 Nov 2008
Posts: 20
Location: India

PostPosted: Wed Jan 28, 2009 6:34 pm
Reply with quote

Hi friends,

Can anyone help me on correcting the below code.
will not be executed.

The program statement is mentioned below:

READ INP-FILE INTO INP-REC0
AT END MOVE 1 TO W1-IN-FILE-STATUS
END-READ.

The error message is below:

The "NEXT" phrase was not specified on a "READ" statement with
the "AT END" phrase for a file with "ACCESS MODE DYNAMIC". The "AT END" phrase

I tried giving various formats of NEXT statements along with READ. But the error is not resolved.

Can anyone guide me on what is the correct format.

----farnear----
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Jan 28, 2009 6:40 pm
Reply with quote

And what does the COBOL Language Reference manual (link at the top of the page) say? I'm not sure why
Code:
READ <file name> NEXT
is quite so hard to get right, though.
Back to top
View user's profile Send private message
farnear
Currently Banned

New User


Joined: 27 Nov 2008
Posts: 20
Location: India

PostPosted: Wed Jan 28, 2009 6:47 pm
Reply with quote

Sir,

I followed your suggestion.

It is working perfectly

Thanks so much for your help .

I have just forgotten to check the manual.

--farnear--
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Jan 28, 2009 6:48 pm
Reply with quote

Glad to hear it's working.

Manual searches for syntax are probably a lot quicker than posting and waiting for replies.
Back to top
View user's profile Send private message
beruoist

New User


Joined: 14 Nov 2007
Posts: 70
Location: mumbai

PostPosted: Thu Jan 29, 2009 3:51 pm
Reply with quote

It looks like an Natural code...which is Incorrectly written.Havent seen COBOL code like this before.

Read File-name ..
..
..
End-read
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Jan 29, 2009 5:10 pm
Reply with quote

Hi,
Quote:
Havent seen COBOL code like this before.

From the manual
Quote:
>>-READ--file-name-1--+------+--+--------+---------------------->
'-NEXT-' '-RECORD-'

>--+--------------------+--------------------------------------->
'-INTO--identifier-1-'


INTO identifier-1
identifier-1 is the receiving field.
identifier-1 must be a valid receiving field for the selected sending record description entry in accordance with the rules of the MOVE statement.

The record areas associated with file-name-1 and identifier-1 must not be the same storage area.

When there is only one record description associated with file-name-1 or all the records and the data item referenced by identifier-1 describe an elementary alphanumeric item or an alphanumeric group item, the result of the execution of a READ statement with the INTO phrase is equivalent to the application of the following rules in the order specified:

The execution of the same READ statement without the INTO phrase.
The current record is moved from the record area to the area specified by identifier-1 according to the rules for the MOVE statement without the CORRESPONDING phrase. The size of the current record is determined by rules specified for the RECORD clause. If the file description entry contains a RECORD IS VARYING clause, the implied move is a group move. The implied MOVE statement does not occur if the execution of the READ statement was unsuccessful. Any subscripting or reference modification associated with identifier-1 is evaluated after the record has been read and immediately before it is moved to the data item. The record is available in both the record area and the data item referenced by identifier-1.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Fri Jan 30, 2009 11:44 am
Reply with quote

Scope terminators (END-READ) have been around since COBOL II.
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 HILITE on Browse mode? TSO/ISPF 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts How to access web services/website? Mainframe Interview Questions 4
No new posts Calling Java method from batch COBOL ... COBOL Programming 5
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
Search our Forums:

Back to Top