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

READING VSAM RECORDS THRU COBOL PGMS


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
srinathangya

New User


Joined: 19 Dec 2005
Posts: 77

PostPosted: Fri Jan 06, 2006 1:41 pm
Reply with quote

Hi all,
heres my question....
I am having a situation like I want to read a record, process it and if the process is successful, I should delete that record...
and if the process is not successful...I must cpature essential data from the current record and move on to next record and store the captured data here and then delete the unprocessed record(i.e. previous record)...
So, How can I move back and forth when there is N number of records...
Just keep in mind I am doing all these things thru COBOL prgm...
For this I used START verb and READ NEXT....
But I wasnt able to arrive at a solution... So if any of U provide me the solution for the problem???

Thanx,
Srinath
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Fri Jan 06, 2006 2:27 pm
Reply with quote

What do you mean by process....& what if you find two consecutive records UNPROCESSED.

Regards,

Priyesh.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Fri Jan 06, 2006 2:51 pm
Reply with quote

Hi Srinath,

Adding with Priyesh point why should u delete on successfull return??? what is ur exact requirement????? icon_question.gif
Back to top
View user's profile Send private message
srinathangya

New User


Joined: 19 Dec 2005
Posts: 77

PostPosted: Fri Jan 06, 2006 3:22 pm
Reply with quote

Hi frens,
First let me thank U..
and heres the exact problem definition...
Process I meant to say that I am doing say computations or I am moving the record to some other file...
Ok, next... So while I am doing some computation definitely there are chances that U get S0C7 Abend.. So the program will get abend... Now again I am going to rerun the same program...But at this time I would have neither corrected the Abended record nor I have deleted the Abended record... But I will be having the data I captured from previous record(refer to the earlier question) in this abended record... So I will fetch those captured datas and I will store it in the Next record...
i.e. If the abend was caused due to 3rd record, then I will store the essential data of 3rd record and store it in 4th record...
After storing it in 4th record I should delete 3rd record or to be precise I must skip the abened record...
So which means I shall update 4th record first and then delete 3rd record and must again continue from 4th record...

Hope U understand the problem...
If not pls., let me know..
I will give with sample records too..
thanx,
Srinath.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Fri Jan 06, 2006 3:31 pm
Reply with quote

Hi srinath,

First two lines are in understandable manner and going beyond i got full confusion. plz put the sample records so that many will reivew the record and may ur problem will solve..
Back to top
View user's profile Send private message
srinathangya

New User


Joined: 19 Dec 2005
Posts: 77

PostPosted: Fri Jan 06, 2006 3:50 pm
Reply with quote

Sorry for confusing U people

example records

S.No Name Salary Cumulative-Salary

1001 arun 1500 1500

1002 balaji 1500 3000

1003 chandru @$% 3000


Now see what happened, first two records are Ok

So at the end of my program run, I will be left with the follwing record only


1003 chandru @$% 3000

This is b'cos since my first two records r error free, I processed it and I deleted it and since 3rd is with error, I havent...

So for my next run, I will fetch the cumulative-total from rec. 1003
and store or rewite it in 4th record before 4th record gets processed(i.e)

1004 Dany 1800 3000

Then I will delete 3rd record and process fourth record and arrive at 4th record value as


1004 Dany 1800 4800


Then I shall I continue the process....

Now did U got it????



Any more clarification...
Pls., without hesitation pls., write...
Srinath.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Fri Jan 06, 2006 3:57 pm
Reply with quote

Hi Srinath,

Yes.. ur problem is understood.. U might have done this earlier.. any way.. on processing 3rd record ur program might have abended na?

1002 balaji 1500 3000

1003 chandru @$% 3000

ie., 3000+@$% = Abend

Since u might have deleted 1001 and 1002 i think it will be easy to search for the 1003 record which abended... If abend occurs in ur program u should have not proceeded furthur bcz ur data is interdepended with previous data.. so what u think?
Back to top
View user's profile Send private message
srinathangya

New User


Joined: 19 Dec 2005
Posts: 77

PostPosted: Fri Jan 06, 2006 4:32 pm
Reply with quote

Yes Khamurudeen Ur right, I should not and I cant.. thats why,
I will run the program again, Now since the successful records are deleted, the abended record will be the first record in my cluster., got it...
So from this record I will collect the value of Cumulative salary and delete the abended record and I will continue with 4th record...
But.. after deleting the abended record there will be a time gap b'fore I am going to rewrite this collected data into 4th record , by which time there is 1% chance of Power failure or in general, some sort of system crash, So the collected data is losed now. So, when I again restart I cant get back the collected data as it is already freed from memory...
So I must first update 4th record only then I must delete 3rd record..
Now I refer to my question and reply...

Again, any misunderstandability pls., do write...
Thanx a lot Khamurudeen...
Srinath.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Fri Jan 06, 2006 5:09 pm
Reply with quote

Hi Srinath,

What Type of VSAM file using?

By considering 1% problem.. i think can write the captured value to one file deleting it or else can have an extra record or column to store the previous record data ie., cummulative salary deleting. i think it will do...
Back to top
View user's profile Send private message
srinathangya

New User


Joined: 19 Dec 2005
Posts: 77

PostPosted: Fri Jan 06, 2006 5:41 pm
Reply with quote

I am using KSDS.. and I didnt get U...
Srinath.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Fri Jan 06, 2006 5:54 pm
Reply with quote

Hi srinath,
It's very easy na... after reading the record u can specify the previous Key value such that it will get deleted??? i think there wont b any difficulty in that... If u think it is not understood then u just write the data ie., cumulative salary in the another file for reference b4 deleting.. got it?
Back to top
View user's profile Send private message
srinathangya

New User


Joined: 19 Dec 2005
Posts: 77

PostPosted: Thu Jan 12, 2006 9:58 am
Reply with quote

Hi Khamurudeen,
Yes.. its working...
Thanx,
Srinath.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top