IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Write and read the KSDS file


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
raviprabhu

New User


Joined: 20 Oct 2006
Posts: 29

PostPosted: Sat Dec 28, 2013 1:45 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Dec 28, 2013 1:58 am
Reply with quote

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
View user's profile Send private message
raviprabhu

New User


Joined: 20 Oct 2006
Posts: 29

PostPosted: Sat Dec 28, 2013 2:29 am
Reply with quote

I am actually resorting the records
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Sat Dec 28, 2013 2:49 am
Reply with quote

Why not simply sort the input and create the output. Am I missing something?
Back to top
View user's profile Send private message
raviprabhu

New User


Joined: 20 Oct 2006
Posts: 29

PostPosted: Sat Dec 28, 2013 5:48 am
Reply with quote

using sort will have performance issues..since the records processing are more that 40 million
So need to do through program
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Dec 28, 2013 7:34 am
Reply with quote

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
View user's profile Send private message
raviprabhu

New User


Joined: 20 Oct 2006
Posts: 29

PostPosted: Sat Dec 28, 2013 7:37 am
Reply with quote

I need the solution for my program, sorry I do not have time..
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Dec 28, 2013 7:44 am
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Sat Dec 28, 2013 10:17 am
Reply with quote

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??? icon_eek.gif icon_eek.gif

by the way I have many sort applications processing over 600 million records everyday and they do quite smoothly...
Back to top
View user's profile Send private message
raviprabhu

New User


Joined: 20 Oct 2006
Posts: 29

PostPosted: Sat Dec 28, 2013 8:56 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Dec 28, 2013 9:16 pm
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Sun Dec 29, 2013 7:14 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Dec 29, 2013 10:26 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top