Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
To handle the duplicate keys in SORT Utility

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
sprasannapathy

New User


Joined: 04 Jan 2008
Posts: 42
Location: india

PostPosted: Thu Mar 26, 2009 11:35 pm    Post subject: To handle the duplicate keys in SORT Utility
Reply with quote

Hi,

I am sincerely thankful the mainframe forum and all who helped me in understanding mainframe better.
Now, I have got a quick question for you. If I am using a VSAM file in //SORTOUT (SORT Utility). How to handle the duplicate keys? It is quite easy in IDCAMS by REPLACE parameter. Kindly help me.

Thanking you.
Prasannaa S
Back to top
View user's profile Send private message

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2285
Location: @my desk

PostPosted: Thu Mar 26, 2009 11:44 pm    Post subject:
Reply with quote

sprasannapathy,

It would be better if you could explain your requirement further. You said your output file is a VSAM file, what are its attributes?; what about your input file attributes? If it's quite easy using IDCAMS, why dont you go for it?
Back to top
View user's profile Send private message
sprasannapathy

New User


Joined: 04 Jan 2008
Posts: 42
Location: india

PostPosted: Fri Mar 27, 2009 12:15 am    Post subject: Reply to: To handle the duplicate keys in SORT Utility
Reply with quote

My input file is a PS file and it may contain key values that are found in the VSAM file (duplicates).
Yes, I am sure IDCAMS would do easy but the efficiency of SORT utility is much better than the IDCAMS. Now my question is there any option like REPLACE parameter to handle duplicate keys (as in IDCAMS) in SORT utility.

Thanks
Prasannaa S
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Mar 27, 2009 3:01 pm    Post subject: Re: Reply to: To handle the duplicate keys in SORT Utility
Reply with quote

sprasannapathy wrote:
is there any option like REPLACE parameter to handle duplicate keys (as in IDCAMS) in SORT utility.
Word "handle" is quite generic in this context . . .what do you want to do with the records which comes up with "duplicate key"? Should they be removed, should they be written in seprate file, should they be just counted & represented in a form of report . . .or ..or.. or so on..

Suggest you start over and explain what exactly you are looking for, some one will be around with a better suggestion . . .
Back to top
View user's profile Send private message
sprasannapathy

New User


Joined: 04 Jan 2008
Posts: 42
Location: india

PostPosted: Fri Mar 27, 2009 5:02 pm    Post subject: Reply to: To handle the duplicate keys in SORT Utility
Reply with quote

Thanking you for reply.

While copying the input PS file to output VSAM by SORT Utility, if there are any duplicate keys in the input file then the duplicate key in the input file should replace the keys (data) in output VSAM file (that is what REPRO-REPLACE parameter do in IDCAMS). If you need anything further more please let me know.

Thanks
Prasannaa S
Back to top
View user's profile Send private message
sprasannapathy

New User


Joined: 04 Jan 2008
Posts: 42
Location: india

PostPosted: Sat Mar 28, 2009 2:33 pm    Post subject: Reply to: To handle the duplicate keys in SORT Utility
Reply with quote

Kindly help me........

Thanks
Prasannaa S
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: Sat Mar 28, 2009 7:42 pm    Post subject:
Reply with quote

Hello,

The reason there have been few replies is because what you want to do is not clear.

Suggest you post sample content of the vsam file before your process begins, a sample input ps file, and the content of the vsam file after the process executes. These do not need to be large samples - only enough to show your process clearly. The data might only be the key and some data field.

Keep in mind that your requirement is completely clear to you, but may not be to the others who read the topic.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Sat Mar 28, 2009 9:02 pm    Post subject: Re: To handle the duplicate keys in SORT Utility
Reply with quote

sprasannapathy wrote:
How to handle the duplicate keys?
E38 User Exit?
Back to top
View user's profile Send private message
sprasannapathy

New User


Joined: 04 Jan 2008
Posts: 42
Location: india

PostPosted: Fri Apr 03, 2009 8:21 pm    Post subject: Reply to: To handle the duplicate keys in SORT Utility
Reply with quote

Sorry, for the late response.

Input PS file data

Key1 data1
Key3 data33333
Key5 data5

Output VSAM file

Key2 data2
Key3 data3
Key4 data4


When I am trying to copy the PS input file to output VSAM file using SORT utility job abended with the return code U0016. After the execution of the job when I did, look in to the output VSAM file I could see

KEY1 DATA1
KEY2 DATA2
KEY3 DATA3
KEY4 DATA4

The record Key1 data1 from the input PS file processed well.
I think while processing the record Key3 data33333, job got filed because of duplicate key. Now my question is how to overwrite the value Key3 data3 in the output VSAM file by Key3 data33333 (duplicate key in input PS file)




JCL for SORT
Code:

//*                                                           
//SORT1   EXEC  SORTD                                         
//SYSPRINT  DD  SYSOUT=*                                       
//SYSOUT    DD  SYSOUT=*                                       
//SORTIN    DD  DISP=OLD,DSN=PSINPUT.FILE       
//SORTOUT   DD  DISP=OLD,DSN=VSAM.OUTPUT.FILE             
//SORTWK01  DD  UNIT=SPOOL,SPACE=(CYL,(4,2),RLSE)             
//SORTWK02  DD  UNIT=SPOOL,SPACE=(CYL,(4,2),RLSE)             
//SORTWK03  DD  UNIT=SPOOL,SPACE=(CYL,(4,2),RLSE)             
//SYSIN     DD  *                                             
 SORT FIELDS=COPY                                   
/*                                                           
//

SYSOUT Message

Code:
 WER255A  VSAM LOGICAL ERROR 08 ON OUTPUT


Attribute of input PS file

Code:
Organization  . . . : PS       
Record format . . . : FB       
Record length . . . : 80       
Block size  . . . . : 27920     
1st extent tracks . : 1         
Secondary tracks  . : 5         



Attribute of output VSAM file.
Code:

  Cluster:   VSAM.OUTPUT.FILE                                             
  Data:      VSAM.OUTPUT.FILE.DATA                                       
  Index:     VSAM.OUTPUT.FILE.INDEX                                       
  Catalog:   SYS1.CATLGU01                                                     
  Type:      KSDS                                                             
                        Data   Index                             Data   Index 
 Volume serial:        TEMP93 TEMP93    Allocation % used:         1       3 
 Device type:            3390   3390    Number of extents:         1       1 
 CI size:               18432     512    Physical record size:  18432     512 
 CI % freespace:            0            Records per track:         3      49 
 CA % freespace:            0            CI per CA:                45      49 
 Allocation unit:         CYL     TRK    Tracks per CA:            15       1 
 Primary allocation:        5       1    Number CI splits:          0      0 
 Secondary allocation:      5       1    Number CA splits:          0       0 
 Total allocation           5       1    Buffer space:          37376         
                                                                               
 Key length:                    4        Total records:                  4     
 Relative key position:         0        Records deleted:                0     
 Average record length:         80       Records updated:                0     
 Maximum record length:         80       Records inserted:               1     
                                         Records retrieved:             14



Thanking you for kind support.

Prasannaa S
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: Fri Apr 03, 2009 11:54 pm    Post subject:
Reply with quote

Hello,

A good practice is to resolve the duplicates before interacting with the vsam file.

Which sort product is used on your system?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Sat Apr 04, 2009 12:12 am    Post subject:
Reply with quote

Dick,

It's not dups in the input, it's the occasional already existing records on the output that he needs replaced rather than the more common add.

And why is this thread not in a sort forum?
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: Sat Apr 04, 2009 1:05 am    Post subject:
Reply with quote

Hi CG,

Quote:
it's the occasional already existing records on the output
Yup, my reply probably could have been more explicit. I was thinking of unloading the current entries and getting a proper load file with no duplicates and then reloading the vsam file - assuming this had to be done with some sort/jcl.

Which is why the question about which sort product is being used. . .

If this was my requirement, i'd simply write code to read qsam file and update the vsam file as needed. . .
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Sat Apr 04, 2009 1:17 am    Post subject:
Reply with quote

Yes, but since he can do it with IDCAMS, I wonder why he wants a sort solution.
Never the less, unless one of those who know better says otherwise, I think the only solution for him is an output exit.....
Who knows, maybe this might be a future enhancement......
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 -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts NULLFILE on ICEGENER Utility Ashishpanpaliya DFSORT/ICETOOL 5 Wed Nov 08, 2017 10:45 pm
No new posts JOINKEYS Paired and Unpaired Sort on ... MFwhiz DFSORT/ICETOOL 7 Tue Nov 07, 2017 2:46 am
No new posts Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us