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
 

 

Handle I-O file in the cobol program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Vsriram

New User


Joined: 07 Dec 2007
Posts: 4
Location: USA

PostPosted: Sat Apr 05, 2008 3:28 am    Post subject: Handle I-O file in the cobol program
Reply with quote

I need to use one I-O file, which basically has 10 digit number.
Every time need to read and incriment one and rewrite and the same can be done all the way in program.

How can I do this?

-Sriram
Back to top
View user's profile Send private message

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Sat Apr 05, 2008 3:49 am    Post subject:
Reply with quote

I think that others will agree, you need to expand on your request for help....
In my thinking, I can see more than several scenarios that qualify and all are mutually exclusive....
What exactly are you trying to accomplish?
Back to top
View user's profile Send private message
Vsriram

New User


Joined: 07 Dec 2007
Posts: 4
Location: USA

PostPosted: Sat Apr 05, 2008 3:58 am    Post subject:
Reply with quote

Read-para
--------------
Code:
READ IN-OUT-CNTL-FILE
IF WS-INOUT-CNTL-STATUS           = ZEROS
   CONTINUE
ELSE
move statements
end-if


rewrite-para
---------------
Code:
MOVE 'WRITE IO FILE'             TO WS-PARA-NAME
IF WS-INOUT-CNTL-STATUS EQUAL TO ZEROES
   ADD  +1                        TO WS-IN-CNTLF-CNT
   MOVE IN-CNTL-NUM               TO WS-IN-CNTL-NUMBER
   MOVE WS-IN-CNTL-NUMBER(1:1)    TO WS-IN-CNTL-CHAR
   MOVE WS-IN-CNTL-NUMBER(2:9)    TO WS-IN-CNTL-NUM
   ADD  +1                        TO WS-IN-CNTL-NUM
   MOVE WS-IO-NUMBER              TO IN-CNTL-NUM OF
                                     CNTL-CARD-REC
   REWRITE CNTL-CARD-REC
ELSE
   DISPLAY 'ERROR IN OUTPUT CNTL FILE'
END-IF


But rewrite not happening here
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Sat Apr 05, 2008 4:16 am    Post subject:
Reply with quote

Vsriram wrote:
But rewrite not happening here
OK, what is happening? File status, why aren't you testing it?
What does the DD statement, the select and the FD look like?
What was the value of the return code/file status from the rewrite statement that is 'not happening' look like?
Back to top
View user's profile Send private message
Vsriram

New User


Joined: 07 Dec 2007
Posts: 4
Location: USA

PostPosted: Sat Apr 05, 2008 5:00 am    Post subject:
Reply with quote

The first time its reading file properly and taking the value and incrementing onr to it,while rewriting sentence its not happening.Its giving nulls
While expediting a program i found the above.

Here rewrite is not happening and in output it is using,first time incremented one.

Every time I am opeing and doing caluculation and I am trying to rewrite until the program ends
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Sat Apr 05, 2008 5:36 am    Post subject:
Reply with quote

Stupid question, but is there a CLOSE/OPEN between the updates?
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: Sat Apr 05, 2008 7:22 am    Post subject:
Reply with quote

Hello Sriram and welcome to the forums,

Quote:
Every time need to read and incriment one and rewrite and the same can be done all the way in program.
Do you want to increment this control number one time per execution of the program or will you have several updates to this during each run? It sounds like you may want to do this multiple times, but i am unsure.

As CG mentioned, you need to post more details - especially the requested info. What are the SELECT and FD? Seeing the jcl may help also.

Is there some reason you cannot read the record at the start of a run and update it at the end? You could increment the number as processing continues and do one update at the end, but as you've not explained what you are doing with your process, it is difficult for us to know what to suggest.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Sat Apr 05, 2008 4:11 pm    Post subject:
Reply with quote

Hi,

Two mutually exclusive suggestions,

1. Open file in extend mode.

2. In the Read Para, MOVE statetments should follow successful READ, status-code=zero; try this

Code:
READ IN-OUT-CNTL-FILE
IF WS-INOUT-CNTL-STATUS           = ZEROS
    move statements
ELSE
   CONTINUE
end-if
Back to top
View user's profile Send private message
Vsriram

New User


Joined: 07 Dec 2007
Posts: 4
Location: USA

PostPosted: Mon Apr 07, 2008 12:04 am    Post subject:
Reply with quote

IN THE BELOW SITUATIONS,cAN i USE EXTEND?

SELECT IN-OUT-CNTL-FILE
ASSIGN TO CNTLIO
FILE STATUS IS WS-INOUT-CNTL-STATUS

OPEN I-O IN-OUT-CNTL-FILe

IF WS-INOUT-CNTL-STATUS NOT = ZEROS
MOVE WS-PARA-NAME TO WS-ABEND-PARAGRAPH
MOVE WS-INOUT-CNTL-STATUS TO WS-ABEND-FILE-STAT
PERFORM 99999-ABEND THRU 99999-EXIT
END-IF

PROCEDURE DIVISION
----------------------

IF WS-FIRST = WS-SECOND
READ IN-OUT-CNTL-FILE
WRITE IN-OUT-CNTL-FILE

In JCL,I am using as DISP=OLD
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: Mon Apr 07, 2008 3:18 am    Post subject:
Reply with quote

Hello Vsriram,

You have been asked for several items of information. It is time to supply them.

What you are doing now is just flailing away and may or may not hit on some "solution".

I may have missed the answer, but have you yet described to the forum just what you are trying to support? Not a technical description of a solution, but a definition of the process you need to support.

As with many things, there are likely multiple technical solutions to your requirement, but we cannot offer them as we don't know your requirement.

Please re-read your entire topic and provide the requested info as well as a description of what you need to do. With that info, i'm sure someone here will have useful suggestions.
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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