For Programmers: Free Programming Magazines  


Home > Archive > Cobol > November 2005 > Re: Accessing a VSAM file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Accessing a VSAM file
Last Boy Scout

2005-11-24, 6:55 pm

Just use Dynamic File access and move the EMP-ID
to the first part of the key and move LOW-VALUES
to the rest of the key and use a start statement.
After that read the file until you find what you want.

I suggest you use DYNAMIC file access.

You should have some kind of programming book
expaining what you can do for each type of file access.
You want a file access where you can both
use the start command and then do sequential
reads. If you have to rewrite any records you
have to use a file access that allows that.

This looks like a homework assignment because
it is too goofy for a real program. If you know the
person's age it looks like you can find a record where
the age is > than the start age and less than the
end age. Most people would use dates or base the
rate on other factors like position years of service, etc.

>Hi,
>I have a VSAM file having 4 fields like this -
>---------------------------------------------
>Emp ID Start Age End Age Rate
>---------------------------------------------
>124789 1 10 2.32
>124789 11 45 6.45
>124789 46 99 9.37
>245696 1 10 0.25
>245696 11 25 1.24
>245696 26 99 7.25
>---------------------------------------------
>The first three fileds are keys. I need to access this VSAM file and
>fetch the rate based on a Emp ID and Age.
>Suppose, I need the rate of the Emp ID 124789 with Age 36 (lies between
>11 and 45 ) and so rate will be 6.45
>
>How can i get the rate based on this data ? Can i get the rate directly
>or I have to fetch all the records with Emp ID 124789 and then check in
>my program to which Age-Range it belongs.
>
>Regards,
>Dib (New to VSAM)


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com