Page 1 of 2

retriving alternate records

PostPosted: Sat Sep 17, 2011 12:02 pm
by mfraj81
Hi,

Could any of you please let me know how to retrive alternative records in a file of 1000 records.

Thank you

Re: retriving alternate records

PostPosted: Sat Sep 17, 2011 12:19 pm
by enrico-sorichetti
... alternative records ...

we would be happy to help You,
but unfortunately we do not understand what You are trying to tell,
explain Your requirement in a better way

Re: retriving alternate records

PostPosted: Sat Sep 17, 2011 6:00 pm
by Robert Sample
Terminology is critical in IT, where similar terms may mean very different things. Your topic title mentions "alternate", which on a mainframe forum generally is referring to the alternate index of a VSAM KSDS file. Your topic mentions"alternative" which is a term that makes absolutely no sense in the context of the question. So start over and restate your question, bearing in mind:

1. if you mention "file", you need to tell us if it is a sequential (flat) file, a VSAM file (and if VSAM, is it RRDS, ESDS, KSDS, linear), or a BDAM file
2. if you really meant VSAM KSDS with alternate index, you'll need to tell us what you are accessing it with -- a system utility or a program you wrote yourself
3. in many cases, you'll need to give us the record format (fixed or variable) as well as the record length (maximum record length for variable)

Re: retriving alternate records

PostPosted: Mon Sep 19, 2011 9:38 pm
by Ed Goodman
Do you mean something like "every other record?" As in, record 1, record 3, record 5...

Re: retriving alternate records

PostPosted: Tue Sep 20, 2011 10:25 am
by mfraj81
It is a sequntial file, and I need to get every other record, means rec1, Rec3, rec5 ....
Please help me on this.

Thank you

Re: retriving alternate records

PostPosted: Tue Sep 20, 2011 1:58 pm
by BillyBoyo
Where are you actually stuck then?

If you have a look at DIVIDE with REMAINDER in the manual you might get an idea.

Re: retriving alternate records

PostPosted: Tue Sep 20, 2011 3:05 pm
by NicC
You probably do not even need DIVIDE and REMAINDER - just the ability to count to 2 whilst coding the program.

Re: retriving alternate records

PostPosted: Tue Sep 20, 2011 6:22 pm
by mfraj81
Can any one of you please give me the code to retrive alternative records from a sequential file.

Re: retriving alternate records

PostPosted: Tue Sep 20, 2011 6:24 pm
by Robert Sample
You read a record, then read a record, then read a record. There is no way to skip reading the second, fourth, etc. records -- sequential means you read every record, period. So write your program to read and process the first record, then read two records and process the second, read two records and process the second, etc.

Re: retriving alternate records

PostPosted: Tue Sep 20, 2011 6:48 pm
by mfraj81
can you tell me the logic to read all the records but write only the odd records to a new file.