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
 

 

Reading a file in input-output mode

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Reading a file in input-output mode
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

Senior Member


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

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

OPEN I-O mode ?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Thu Sep 25, 2008 1:11 pm    Post subject:
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

http://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    Post subject:
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

Senior Member


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

PostPosted: Thu Sep 25, 2008 1:54 pm    Post subject:
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    Post subject:
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    Post subject:
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    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
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm


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