Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us