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

Where will be the pointer after reading the record


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top