From: dibalok on
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)

From: on
In article <1131181712.371463.200330(a)g44g2000cwa.googlegroups.com>,
<dibalok(a)gmail.com> wrote:
>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 ?

There are a variety of ways to do so. Do you have any friends in the
Personnel Office?

>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.

Both are possitilities. What is the volume of data you expect to be
dealing with?

Oh... and who designed a file with the same ID for different people?

DD

From: Rick Smith on

<dibalok(a)gmail.com> wrote in message
news:1131181712.371463.200330(a)g44g2000cwa.googlegroups.com...
> 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)

I don't use VSAM myself; but, as I understand it "How"
depends on the sequence data is entered in a VSAM
file: entry, relative, or keyed, with the understanding that,
what is a "key", depends on how the application uses
a field.



From: Andreas Lerch on


>>>>>>>>>>>>>>>>>> Ursprüngliche Nachricht <<<<<<<<<<<<<<<<<<

Am 05.11.05, 09:08:32, schrieb dibalok(a)gmail.com zum Thema Accessing a
VSAM file:


> 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.

Hello

you have to read it like a sequetial file. But you can start at a
point.

Use something like this:
START key 124789 0 0
RAED and check
if key is greater, use previous record.

VSAM KSDS Files are Key Sequential DataSets (kapital letters give the
name). If you want to use it in reverse mode, you must use inverted
data: 99 minus age or better 999 minus age. Something like this:

124789 54 01 9.37
124789 89 55 6.45
124789 99 90 2.32

And then you can calculate the age: 999-current age is thestart key an
one
START and
READ

Einen schoenen Tag
Andreas Lerch



From: Last Boy Scout on
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)

 |  Next  |  Last
Pages: 1 2
Prev: Recursive Call
Next: Cobol books & experiences