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

Reading a file in input-output mode


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

New User


Joined: 21 Jul 2008
Posts: 19
Location: Mumbai

PostPosted: Thu Sep 25, 2008 12:10 pm
Reply with quote

In cobol,do we have any option of reading a file in input-output mode.If yes means,please help me out with syntax.
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 Sep 25, 2008 12:25 pm
Reply with quote

OPEN I-O mode ?
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 Sep 25, 2008 1:11 pm
Reply with quote

Hi again,

I think in my previous reply I went lil stubborn..per me, we should start such thing from Manuals, they are available on every page of this portal -top of page second link from left.

I-O mode permits opening the file for both input and output operations. The I-O phrase can be specified only for files assigned to direct access devices.

Here is a ready link for you, please get familiar with manuals - they'll stay with you forever.. Good Luck..icon_smile.gif

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/IGYLR105/6.2.26.3?SHELF=&DT=19981109163611&CASE=
Back to top
View user's profile Send private message
swathiravichandran

New User


Joined: 21 Jul 2008
Posts: 19
Location: Mumbai

PostPosted: Thu Sep 25, 2008 1:22 pm
Reply with quote

Thanks for ur valuable reply..may i use Read I-O file name in my program
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 Sep 25, 2008 1:54 pm
Reply with quote

Hi,

No, it's OPEN I-O in PROCEDURE-DIVISION.

Below code might help you to understand this, this code searches the file for a record with a certain address, and then changes that address (note : RECORD-FOUND & WS-END-OF-DATA-FILE must first be declared in Working-Storage section) :
Code:
PROCEDURE DIVISION.
PARA-1.
        OPEN  I-O DATA-FILE-1.
        READ DATA-FILE-1
          AT END
                MOVE "E" TO WS-END-OF-DATA-FILE
             DISPLAY "DATA NOT FOUND"
        END-READ
        PERFORM UNTIL END-OF-DATA-FILE OR RECORD-FOUND
          IF ADDRESS = "New Zealand"
             THEN
                    MOVE "Australia" TO ADDRESS
                 REWRITE PERSON-REC
                 MOVE "Y" TO WS-RECORD-FOUND
          ELSE
                READ DATA-FILE-1
             AT END
                    MOVE "E" TO WS-END-OF-DATA-FILE
                 DISPLAY "DATA NOT FOUND"
             END-READ
            END-IF
        END-PERFORM
        CLOSE DATA-FILE-1
        STOP RUN.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Sep 25, 2008 2:11 pm
Reply with quote

read file
write record
Back to top
View user's profile Send private message
umasankarmf

New User


Joined: 08 Sep 2008
Posts: 43
Location: india

PostPosted: Thu Sep 25, 2008 5:59 pm
Reply with quote

Hi,
Most probably I-O mode is used for rewrite the records. i.e. first read and then write.(for reading it acts as input mode and for writing it acts as output mode).

If any corrections welcome.....
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 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 HILITE on Browse mode? TSO/ISPF 2
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top