cobol program



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

cobol program

Postby jvinoth » Fri Jan 06, 2012 4:05 pm

Hi,

I have a request
I have a vsam file in that it has many records and one column is name field. my request is that i want find out the records which are the names starting letter is 'S' how to retrive only those records from a flat file. please give me the logic and if can the sample code also.
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: cobol program

Postby Robert Sample » Fri Jan 06, 2012 4:25 pm

Your "requirement" is so poorly defined that nobody could possibly help you much. When you say "VSAM file", do you mean an ESDS or KSDS or RRDS or LDS VSAM file? If KSDS, is the name field the key? If not, you must read the entire file sequentially and find each record having the required letter in the required column. What does a "flat file" (I assume you mean a sequential file) have to do with the VSAM file -- the two are not related? Sequential files have to be read one record at a time, anyway.

Furthermore, be aware that asking for logic and program code on this forum is asking professionals for their work product. This typically requires that you pay them for their time and expertise -- and rates are typically 1000 U.S. dollars (or euros) per day, although there are occasional offers as low as 500 per day.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: cobol program

Postby jvinoth » Fri Jan 06, 2012 5:49 pm

sorry that is sequential file in that i need to retrive the records which has the name starting with 's' letter how to find out.
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: cobol program

Postby BillyBoyo » Fri Jan 06, 2012 5:52 pm

Robert already answered this above. If the name is not a/the key, you have to read your data sequentially. With each record, you test the first character of the name (various ways to do that, I'd defining the data to aid the operation) to see if it equal to "S" and do whatever when it is, and read the next record when it isn't.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: cobol program

Postby jvinoth » Fri Jan 06, 2012 6:04 pm

can you please give me one logic to perform this operation.
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: cobol program

Postby BillyBoyo » Fri Jan 06, 2012 6:17 pm

I don't know what you are asking. Robert already gave you the "logic" to do it. I basically repeated that because I thought you hadn't read Robert's post properly.

That is "the logic" to do it. You read a record. You test one byte, which happens to be defined as the first character of the name. If that is "S", do what you want when it is S, else read another record. Continue until end of file.

Have I got code for it? Take any sample program which reads a file. Copy that. Define your record, including one byte representing the first character of the name. Put the "logic" into the main body of the program. Compile/link/run.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: cobol program

Postby jvinoth » Fri Jan 06, 2012 6:37 pm

i asked sample code as well if can please post ..
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Re: cobol program

Postby BillyBoyo » Fri Jan 06, 2012 6:42 pm

I know what you asked, but if you read through these fora here you'll know it was unrealistic of you to do so. Sometimes life is tough.

All you need is a program which reads a file and to write a few lines yourself (around six, depending on what you want to do when you find an "S"). If you can't manage that from books, manuals, google etc, then I don't know what to suggest.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: cobol program

Postby Robert Sample » Fri Jan 06, 2012 6:52 pm

i asked sample code as well if can please post ..
Should we discuss arrangements for you to PAY for this code? If you are not willing to pay for the code, then do not ask for code. If you're willing to pay for the code, I'll even give you a flat rate discount -- $1000 (U.S.) for the program.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: cobol program

Postby jvinoth » Fri Jan 06, 2012 6:55 pm

ha ha ....great price i dont need your code at all thanks.... :D
jvinoth
 
Posts: 132
Joined: Fri Nov 18, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 1 time

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post