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
 

 

Where will be the pointer after reading the record

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

New User


Joined: 28 Nov 2005
Posts: 12
Location: New Delhi

PostPosted: Fri May 19, 2006 2:48 pm    Post subject: Where will be the pointer after reading the record
Reply with quote

I have records like below in VASM KSDS file.
1 ....
2 ....
3 .....
4 ....
6 .....
7 .....
9 .....
.
I am reading records in sequence and if it passes one condition(not required here) it will write a new record as a next record. For example it the 4th record passes the conditon it will write new record i.e. 5th. After writing the record it has a READ stmnt. But what actually happening in my results is the values in the read stmnt are of 7th. Here I am expecting values of 6th record. Can anybody please explain the reason.
Back to top
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Sat May 20, 2006 5:08 am    Post subject: Re: Where will be the pointer after reading the record
Reply with quote

This is what I think is happening.

Several years ago, I had a similar experience and this is the way it was explained to me.

You have the file open in IO mode. You start to read the file sequentially; there is only one pointer to the current record. When you read the first record the pointer is on entry 1 key 1, when you read the next record, the current record pointer is incremented by 1 and you read the next entry 2 key 2, and so on? After you read entry 4 key 4, the current record pointer is set at entry 4. You now write key 5, and since there is only 1 current record pointer it is now set at entry 5. (this is where the problems come in) The index you have in storage has not been updated with the new record key at this time, so when you read next, it takes the current record pointer (5), increments by 1 to 6 and reads the 6th entry from the index, or key 7. Whenever you do a write, you need to re-position yourself in the file.

I probably stated this badly, Is it clear enough?

Dave
Back to top
View user's profile Send private message
srrao_kilari

New User


Joined: 28 Nov 2005
Posts: 12
Location: New Delhi

PostPosted: Sat May 20, 2006 9:52 am    Post subject: Re: Where will be the pointer after reading the record
Reply with quote

It looks appropriate answer. Thank u very much.
Back to top
View user's profile Send private message
sharda

New User


Joined: 13 Sep 2006
Posts: 7

PostPosted: Wed Oct 18, 2006 4:13 pm    Post subject:
Reply with quote

Hi ,

I am not getting ur explaination . Why u r telling that problem comes only at 6 th record and not on 3 rd record ?
Back to top
View user's profile Send private message
srrao_kilari

New User


Joined: 28 Nov 2005
Posts: 12
Location: New Delhi

PostPosted: Wed Oct 18, 2006 4:44 pm    Post subject:
Reply with quote

I gave an example where 4th record is satisfying the condition and should write 5th record not 3rd or any.
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 How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Reading data from PS file and send it... rajatbagga All Other Mainframe Topics 18 Fri Sep 23, 2016 12:51 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


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