retriving alternate records



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

retriving alternate records

Postby mfraj81 » Sat Sep 17, 2011 12:02 pm

Hi,

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

Thank you
mfraj81
 
Posts: 7
Joined: Thu Jan 27, 2011 2:03 pm
Has thanked: 0 time
Been thanked: 0 time

Re: retriving alternate records

 

Re: retriving alternate records

Postby enrico-sorichetti » Sat Sep 17, 2011 12:19 pm

... 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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2648
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 132 times

Re: retriving alternate records

Postby Robert Sample » Sat Sep 17, 2011 6:00 pm

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)
Robert Sample
Global moderator
 
Posts: 3376
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 224 times

Re: retriving alternate records

Postby Ed Goodman » Mon Sep 19, 2011 9:38 pm

Do you mean something like "every other record?" As in, record 1, record 3, record 5...
Ed Goodman
 
Posts: 342
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: retriving alternate records

Postby mfraj81 » Tue Sep 20, 2011 10:25 am

It is a sequntial file, and I need to get every other record, means rec1, Rec3, rec5 ....
Please help me on this.

Thank you
mfraj81
 
Posts: 7
Joined: Thu Jan 27, 2011 2:03 pm
Has thanked: 0 time
Been thanked: 0 time

Re: retriving alternate records

Postby BillyBoyo » Tue Sep 20, 2011 1:58 pm

Where are you actually stuck then?

If you have a look at DIVIDE with REMAINDER in the manual you might get an idea.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: retriving alternate records

Postby NicC » Tue Sep 20, 2011 3:05 pm

You probably do not even need DIVIDE and REMAINDER - just the ability to count to 2 whilst coding the program.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2702
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: retriving alternate records

Postby mfraj81 » Tue Sep 20, 2011 6:22 pm

Can any one of you please give me the code to retrive alternative records from a sequential file.
mfraj81
 
Posts: 7
Joined: Thu Jan 27, 2011 2:03 pm
Has thanked: 0 time
Been thanked: 0 time

Re: retriving alternate records

Postby Robert Sample » Tue Sep 20, 2011 6:24 pm

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.
Robert Sample
Global moderator
 
Posts: 3376
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 224 times

Re: retriving alternate records

Postby mfraj81 » Tue Sep 20, 2011 6:48 pm

can you tell me the logic to read all the records but write only the odd records to a new file.
mfraj81
 
Posts: 7
Joined: Thu Jan 27, 2011 2:03 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post