View previous topic :: View next topic
|
Author |
Message |
raviprabhu
New User
Joined: 20 Oct 2006 Posts: 29
|
|
|
|
Hi,
I have written program to read a file and write to KSDS file, after writing each record to KSDS file the record should be read and write to another flat file and delete the records from KSDS file.
process should be like this
input file
1st rec
2nd rec
3rd rec
4th rec
5th rec
6th rec
I have to read the input file from 1st to 3rd rec and write to KSDS file and as soon as I write to KSDS, the same records should be read from 1st to 3rd rec and write to flat file and delete from KSDS file.
While doing this in my program, I am able to write records to KSDS file but after reading KSDS only the 3rd rec is getting written to flat file and getting deleted from KSDS
How do I process this ?
Regards |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You are writing records to a KSDS just to write them to a sequential file and delete them from the KSDS? Why? |
|
Back to top |
|
|
raviprabhu
New User
Joined: 20 Oct 2006 Posts: 29
|
|
|
|
I am actually resorting the records |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
Why not simply sort the input and create the output. Am I missing something? |
|
Back to top |
|
|
raviprabhu
New User
Joined: 20 Oct 2006 Posts: 29
|
|
|
|
using sort will have performance issues..since the records processing are more that 40 million
So need to do through program |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Really? Do you know how much time it is going to waste writing a record to a KSDS just for you to delete it later? And you think SORT is going to be slower? If that were so, then that is how SORT would do a sort, don't you think?
Try it. Try SORTing 40m records. Try just writing 40m records to a KSDS, let alone deleting them, or writing them anywhere else. Let us know. |
|
Back to top |
|
|
raviprabhu
New User
Joined: 20 Oct 2006 Posts: 29
|
|
|
|
I need the solution for my program, sorry I do not have time.. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You don't have time to find out if your approach is reasonable?
Do you have time to set out fully and exactly what it is that you are doing? If not, I'm not sure how anyone can help.
Note: SORT is very, very good at IO. A KSDS through a COBOL program is not so hot. If you don't believe that, then your "performance" issue will bite you once you get to volume testing at the latest. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
raviprabhu wrote: |
I need the solution for my program, sorry I do not have time.. |
Do you want someone to write program for you free???
by the way I have many sort applications processing over 600 million records everyday and they do quite smoothly... |
|
Back to top |
|
|
raviprabhu
New User
Joined: 20 Oct 2006 Posts: 29
|
|
|
|
I just need after as soon as the records (1st to 3rd rec) written to KSDS file I need to read the record from 1st rec from KSDS file and then again read the flat file from 4th rec.
I just need to know how to read the KSDS file from 1st rec as of now it is reading the 3rd rec.
Sorry but my client has given instructions to write the program instead of SORT |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, which is it?
Quote: |
using sort will have performance issues |
or
Quote: |
my client has given instructions to write the program instead of SORT |
or
"my client has given instructions to write the program instead of SORT because using sort will have performance issues"?
Has your client also told you not to use WORKING-STORAGE? Why the KSDS? To write records to it, read them, then delete them, is "overhead" and you will have 40,000,000 chunks of overhead.
Read all the records which make up a "group", storing them. At the end of the "group", do your processing, outputting what you want.
You may be able to do this as a "sub-group" and not need to store all the records. We don't know.
Storing them on a KSDS is a waste of resources. OK, Client pays. But will it run well enough? For what you want to do (use file IO on a KSDS) vs what you could do (just use memory) there is going to be a pretty big difference in performance.
How do you read the first record you wrote on the KSDS? With its key. You have READ with a key, which needs a full key, and START which can take a partial key which will allow a sequential READ to get the first record which matches the partial key. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
Many shops, to accomplish a simple file copy, translate an IEBGENER step to SORT because of its speed. That should tell you something. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Also, many shops run Sort "under the covers" when IEBGENER is invoked. Sort is exponentially faster.
For giggles try to run a COBOL program to insert only 1 million random records into the VSAM file. Then sort the same 1 million records into the VSAM file.
Look at the difference in the cpu used and the I/o needed.
Just because the client pays the bill, does not mean they have knowledge. . . The trick is demonstrating this to them without making them look bad. |
|
Back to top |
|
|
|