Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sort to insert an indicator when the key changes.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Sat Sep 11, 2010 12:38 am    Post subject: Sort to insert an indicator when the key changes.
Reply with quote

I have an input file of length 20 bytes. This file has the key in the first 10 bytes and it takes up numeric format [9(10)]. This input file is not sorted in the order of the key and I'm trying to sort the input file and include one extra byte at the end of every record.
This extra byte has to be,
(i) 'Y', if the next record in the file will have the same key as that of the current record.
(ii) 'N', if the next record in the file will have the different key as that of the current record.

Could anyone help me with introducing this new byte at the end of the record ?
Back to top
View user's profile Send private message

gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Mon Sep 13, 2010 11:20 am    Post subject:
Reply with quote

Hi,

can you give an example of input and expected output.


Gerry
Back to top
View user's profile Send private message
jsathishbabu84

New User


Joined: 07 Jun 2007
Posts: 22
Location: India

PostPosted: Mon Sep 13, 2010 1:52 pm    Post subject: Reply to: Sort to insert an indicator when the key changes.
Reply with quote

Hi,

What result you expect when there are multiple duplicate keys?
First record will have "Y", what value should the duplicate records have?

Regards,
Shrek
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Mon Sep 13, 2010 7:20 pm    Post subject:
Reply with quote

Please find below a sample input with the desired output,

Sample Input:
Code:
1111111111ABCDEFGHIJ
2222222222AFDSFSDAFA
3122332323AFASDFADSF
1111111111AASDFDSFAD
3243431412DFADSFAASD
9999999999ASFADSFASF
3122332323AFASDFADSH
8888888888AFDSFASDFF
5666666666ASFDAFDSFA
9999999999ADFSDAFDFA
3122332323AFASDFADSG
3122332323AFASFDSFDD


Desired Output:
Code:
1111111111ABCDEFGHIJY
1111111111AASDFDSFADN
2222222222AFDSFSDAFAN
3122332323AFASDFADSFY
3122332323AFASDFADSHY
3122332323AFASDFADSGY
3122332323AFASFDSFDDN
3243431412DFADSFAASDN
5666666666ASFDAFDSFAN
8888888888AFDSFASDFFN
9999999999ASFADSFASFY
9999999999ADFSDAFDFAN


As given above, the 21st byte will have the value 'Y' if the following record will have the same key as that of the current record. And it will have a value 'N' if the following record will have a different key from the current record.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Mon Sep 13, 2010 7:26 pm    Post subject:
Reply with quote

Hello,

And this entire copy of the file is being made so that the next program does not have to determine which is the last of the duplicates. . . icon_confused.gif

None of my clients would permit such a process . . .

fwiw
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Mon Sep 13, 2010 7:37 pm    Post subject:
Reply with quote

Dick, You nailed it perfectly. Thats the reason I was trying to do it. And the reason why I want this to be done is because, this file would be processed as a GSAM database in the next IMS program. And when I have to read the next record to identify if the current record is the last duplicate for the particular key, I was having some problem with my CHKP/XRST. (Though I have overcome this problem by using a RSA) my curiousity dint stopped me from trying to figure out if this is feasible using a sort utility and how simple could it be. And hence I was trying to read some manuals to see if there would be any keyword with which I can achieve this functionality. But my efforts were in vain. When I end up in a confused state finding something, there is always one place where I end up - IBMMainframes.com :-)
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Mon Sep 13, 2010 8:46 pm    Post subject:
Reply with quote

Hello,

Quote:
Thats the reason I was trying to do it.
I don't know about your data volumes, but much of the data we process is in the 10's or 100's of millions of records and the extra dasd space and cpu time would cause problems. . .

Quote:
And when I have to read the next record to identify if the current record is the last duplicate for the particular key, I was having some problem with my CHKP/XRST.
Usually, this is treated as a "control break" and the prior group is "wrapped up" when the key changes.

As this is a batch process, you might consider not using checkpoint/restart. . . With the newer, faster cpu's and dasd, many places have stopped using checkpoint/restart. It is often faster and more reliable to reload (if needed) and rerun. This also eliminates the need to syncronize sequential outputs and reports.
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Mon Sep 13, 2010 8:56 pm    Post subject:
Reply with quote

Hello,

In cases where the total number of records are in millions, I understand the complexity. My job processes about few hundred of thousands of records in the batch process every day.

And regarding your suggestion on CHKP/XRST - it gives me a whole new dimension of looking into the problem now. My shop currently uses IMS 9.1 and would be upgrading shortly. The interesting fact is that our application has been running for years now without the Extended Restart logic provided by IMS and we are currently involved in making changes to the programs so that the IMS XRST can be used. As I read your statement of not to consider checkpoint/restart - I am more than curious to read more on the same. Is there any link/article you can guide me with ? I am still not able to guess how can eliminating the checkpoint be a better solution when it involves having a huge amount of uncommitted data in the buffer waiting to be committed and also the parallel processes waiting for the records to be available for them.
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Mon Sep 13, 2010 8:58 pm    Post subject:
Reply with quote

PS - This topic seems to be taking a deviation from a JCL topic into a IMS topic. Moderators might consider moving this topic to the appropriate place.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Mon Sep 13, 2010 9:06 pm    Post subject:
Reply with quote

Hello,

Quote:
As I read your statement of not to consider checkpoint/restart - I am more than curious to read more on the same. Is there any link/article you can guide me with ?
I'm not aware of any particular links. My suggestion comes from years of exposure to environments that have "unplugged" checkpoint/restart in applications that are undergoing major changes and not using it at all in new applications.

I have seen this done with IMS, DB2, CA-Datacom, and a few others.

Suggest that if there are multiple parallel processes updating the same rows, there will be data "adventures" with checkpoint/restart. . .
Back to top
View user's profile Send private message
rockish

Active User


Joined: 05 Jun 2009
Posts: 185
Location: Planet Earth

PostPosted: Mon Sep 13, 2010 9:36 pm    Post subject:
Reply with quote

Hello,

There are parallel process 'accessing' the same 'databases' but not 'updating' the same 'segments'. The different processes makes use of different fields from the segment and hence the application has been running fine for now.

Anyways, thanks for your inputs on this topic, Dick. I will try to see if the ongoing XRST implementation can be replaced with a better approach..
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Mon Sep 13, 2010 11:37 pm    Post subject: Reply to: Sort to insert an indicator when the key changes.
Reply with quote

Good luck - someone will be here if there are questions icon_smile.gif

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us