MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Duplicates are not deleted

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Sumathi
Beginner


Joined: 24 Mar 2004
Posts: 13
Topics: 3

PostPosted: Wed Mar 31, 2004 7:18 pm    Post subject: Duplicates are not deleted Reply with quote

Hi,

I have used the piece of jcl found in this forum, for my requirement. (My requirement is 2 files have to merged, duplicates have to be eliminated and results have to written into another dataset ). My jcl is
Code:

//S02  EXEC  PGM=SORT                                 
//SYSPRINT DD SYSOUT=A                                 
//SORTIN   DD DSN=&&VSAMOUT,DISP=(OLD,DELETE,DELETE)   
//              DD DSN=HLQ.INPUT.FILE,DISP=SHR   
//SORTOUT  DD DSN=&&OUT,DISP=(,PASS),                 
//                DCB=(LRECL=80,RECFM=FB,BLKSIZE=0),       
//            SPACE=(TRK,(5,5),RLSE),UNIT=SYSPROD     
//SYSIN    DD *                                       
    INREC FIELDS=(1,80,X'001C')                 & total recl is 80       
    SORT FIELDS=(1,14,CH,A)                     & keys are 1 to 14       
    SUM FIELDS=(81,2,PD)                               
    OUTFIL INCLUDE=(81,2,PD,EQ,1),                     
    OUTREC=(1,80)

The job went through successfully, but the record is not deleted. Is there anything I am making wrong in the jcl?

Thanks, Sumathi
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Mar 31, 2004 7:38 pm    Post subject: Reply with quote

This DFSORT job is equivalent to using a DFSORT/ICETOOL SELECT statement like the following:

Code:

  SELECT FROM(IN) TO(OUT) ON(1,14,CH) NODUPS


This will keep only those records that have NO duplicates. So if your input had:

Code:

AAA
AAA
BBB
CCC
CCC
CCC
DDD


Your output would be:

Code:

BBB
DDD


If that's the kind of thing you're trying to do, then you have to explain what you mean by "the record is not deleted". What record?

Tell us what you're trying to do and show us an example of your input and what you expect for output. Then we can help you.

Or if you want to be really adventurous, read the following doc on the SELECT operator of DFSORT's ICETOOL and see if you can figure out how to do it yourself:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA00/6.11?DT=20031124143823

Note that there are other options besides NODUPS (FIRST, FIRSTDUP, etc) that might give you what you want.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sumathi
Beginner


Joined: 24 Mar 2004
Posts: 13
Topics: 3

PostPosted: Wed Mar 31, 2004 7:52 pm    Post subject: Reply with quote

Hi Frank,

I tried select with NODUPS option earlier. The error msg what I got was,

SYSIN :
SELECT FROM(SORTIN) TO(SORTOUT) ON(1,14,CH) NODUPS
*
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000

As required the example are given below;

1. VSAM File : lrecl 80 ; keys 1 to 14
2. Input file : lrecl 80 ;

Objective : The keys found in the input file will be used to delete the corresponding records in the vsam file.

To do that, the vsam file records will be repro'ed first and merged with input file and duplicates has to be removed. Then, the remaining records willbe repro'ed back to vsam file. But I could see that the record is not getting deleted. I do not know is there anything needs to be changed in the sort parameter. Please let me know.

Thanks, Sumathi
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Wed Mar 31, 2004 8:53 pm    Post subject: Reply with quote

If anyone wishes me to, I can look up the proper syntax, using Quickref, for the SYNCSORT function when I get to work tomorrow.

Sumathi, it would help if I knew what version of SYNCSORT you are using.
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Wed Mar 31, 2004 11:58 pm    Post subject: Reply with quote

Sumathi,

The problem with your code is that u have used the SORTIN and SORTOUT as your DD names for select statement. They are reserved for other purposes, so try using IN and OUT or any other DD name. I got the same error message and I changed the DD name and it worked for me..

Try using
SELECT FROM(IN) TO(OUT) ON(1,14,CH) NODUPS

Thanks,
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Thu Apr 01, 2004 5:46 am    Post subject: Reply with quote

sumathi,

You need to post more details. Post detailed information on what you're trying to accomplish. Do not make people guess what you mean. This will give you a much better chance of getting a good answer to your questions.show us a sample input and desired output.

Your JCL looks fine and will eliminate duplicates. It is your repro which will not delete the records. when you repro it will not delete the existing contents, but will append new records or replace the contents. check this link to know more about repro

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/dgt1v403/3.25?DT=19990113080956

As frank mentioned about select statement, it can be used with ICETOOL/SYNCTOOL but not along with pgm=sort.

The error you are getting is because you have control statement in pos 1. you need to have all your control statement in pos 2

Your shop has SYNCSORT, so you need to use the following JCL
Code:


//STEP0100 EXEC PGM=SYNCTOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN       DD DSN=&&VSAMOUT,DISP=OLD
//         DD DD DSN=HLQ.INPUT.FILE,DISP=SHR   
//OUT      DD DSN=&&OUT,DISP=(,PASS),                 
//            SPACE=(TRK,(5,5),RLSE),UNIT=SYSPROD     
//TOOLIN   DD *
 SELECT FROM(IN) TO(OUT) ON(1,14,CH) NODUPS
/*


BTW Didn't you get a solution for all your challenges in here?

http://www.mvsforums.com/helpboards/viewtopic.php?t=2014


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sumathi
Beginner


Joined: 24 Mar 2004
Posts: 13
Topics: 3

PostPosted: Thu Apr 01, 2004 12:25 pm    Post subject: Reply with quote

Kolusu,

I have to use IDCAMS and SORT instead of SYNCTOOL. Hence I have been forced to do this way.
Here we go, the detailed information about my assignment.
I have to delete some records from the existing VSAM file(lrecl 80 - keys 1 to 14). The keys of the records to be deleted will be given in seq file(lrecl 80). What I am trying to do is as follows.
1. Do REPRO on a VSAM file to temp dataset(lrecl 80).
For ex the contents of VSAM file is,
AAAAAAAAAAAAAAasdfodfsdfsjfsdfsdjafdjf
BBBBBBBBBBBBBBfadfsdfdsfadsfsdfasdfff
CCCCCCCCCCCCCasdfsdfdasfasdfsdafsd

2. The record to be deleted is BBBBBBBBBBBBBB(will be in input file)
3. Concat the temp dataset with the input file.
After concat the records will be,
AAAAAAAAAAAAAAasdfodfsdfsjfsdfsdjafdjf
BBBBBBBBBBBBBBfadfsdfdsfadsfsdfasdfff
CCCCCCCCCCCCCasdfsdfdasfasdfsdafsd
BBBBBBBBBBBBBB

3. Now I want to delete the duplicates using SORT.
4. After SORT the records should be,
AAAAAAAAAAAAAAasdfodfsdfsjfsdfsdjafdjf
CCCCCCCCCCCCCasdfsdfdasfasdfsdafsd

5. REPRO back the above to VSAM file again.

After the above exercise I could see that the record is not deleted from VSAM file. I used file aid to view the contents of VSAM file.
My goal is to delete the records from VSAM file using IDCAMS and SORT. Please let me know if you have any other ideas as well.
Thanks, Sumathi
Back to top
View user's profile Send private message
Sumathi
Beginner


Joined: 24 Mar 2004
Posts: 13
Topics: 3

PostPosted: Thu Apr 01, 2004 12:53 pm    Post subject: Reply with quote

Hi Kolusu,

Now I found the problem. Though I am using REPRO with REPLACE at step 5, the VSAM file is not getting refreshed. That was the problem. To resolve this I have included 2 more steps. That is delete and create the vsam file before REPRO. Now I could see what I want.

Now my question is: Is that necessary to delete and recreate the VSAM file again? Will it not refreshed by itself?

Thanks, Sumathi
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12377
Topics: 75
Location: San Jose

PostPosted: Thu Apr 01, 2004 1:32 pm    Post subject: Reply with quote

Sumathi,

Please be clear in your requirements. The first time you posted you asked for a JCL solution which was provided to you. Later you started another topic that duplicates are not deleted which is related to the same question.

Before you take up an assignment make sure to ask what exactly needs to be done. Don't waste time of other members with incomplete details.

You are after quick solutions but does not pay attention to read the instructions posted for the solutions. All you do is come up with a post that it is not working. If you had to use repro then you have to delete the vsam cluster and redefine the vsam cluster for the delete to work. Look at the bottom for the deletion and recreation step of the cluster.

Here is a solution with sort.

Insert Solution:

Code:

//******************************************************************
//* THIS STEP COPIES THE VSAM FILE CONTENTS TO A TEMP FILE         *
//******************************************************************
//STEP0100 EXEC PGM=SORT,PARM='VSAMEMT=YES'                         
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=HLQ.IND.VSAMFILE,                                 
//            DISP=SHR                                             
//SORTOUT  DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)           
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                 
/*                                                                 
//******************************************************************
//* THIS STEP WILL INSERT NEW RECS IN A VSAM CLUSTER.              *
//******************************************************************
//STEP0200 EXEC PGM=SORT,PARM='VSAMEMT=YES'                         
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=&T1,DISP=OLD                                     
//         DD *                                                     
AAAA BVT ASDFASFDFADSFASDFA
BBBB BVT BSDFASFDFADSFASDFA                                         
CCCC BVT DAFSDFSDFASDFASDF                                         
//SORTOUT  DD DSN=HLQ.IND.VSAMFILE,DISP=OLD                         
//SYSIN    DD *                                                     
  OPTION VSAMIO,RESET                                               
  SORT FIELDS=(1,14,CH,A)                                           
/*                                                                 


Delete Solution
Code:

//******************************************************************
//* THIS STEP COPIES THE VSAM FILE CONTENTS TO A TEMP FILE         *
//******************************************************************
//STEP0300 EXEC PGM=SORT,PARM='VSAMEMT=YES'                         
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=HLQ.IND.VSAMFILE,                                 
//            DISP=SHR                                             
//SORTOUT  DD DSN=&T2,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)           
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                 
/*                                                                 
//******************************************************************
//* THIS STEP WILL DELETE RECS  IN A VSAM CLUSTER.                 *
//******************************************************************
//STEP0400 EXEC PGM=SORT,PARM='VSAMEMT=YES'                         
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=&T2,DISP=OLD                                     
//         DD *                                                     
BBBB BVT BSDFASFDFADSFASDFA                                         
//SORTOUT  DD DSN=HLQ.IND.VSAMFILE,DISP=OLD                         
//SYSIN    DD *                                                     
  OPTION VSAMIO,RESET                                               
  INREC FIELDS=(1,80,C'01')                                         
  SORT FIELDS=(1,14,CH,A)                                           
  SUM FIELDS=(81,2,ZD)                                             
  OUTFIL INCLUDE=(81,2,ZD,EQ,1),OUTREC=(1,80)                       
/*   


Update Solution:
Code:

//******************************************************************
//* THIS STEP COPIES THE VSAM FILE CONTENTS TO A TEMP FILE         *
//******************************************************************
//STEP0500 EXEC PGM=SORT,PARM='VSAMEMT=YES'                         
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD DSN=HLQ.IND.VSAMFILE,                                 
//            DISP=SHR                                             
//SORTOUT  DD DSN=&T3,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)           
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                 
/*                                                                 
//******************************************************************
//* THIS STEP WILL UPDATE RECS  IN A VSAM CLUSTER.                 *
//******************************************************************
//STEP0600 EXEC PGM=SORT,PARM='VSAMEMT=YES'                         
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                     
AAAA BVT ASDFA                                                     
//         DD DSN=&T3,DISP=OLD                                     
//SORTOUT  DD DSN=HLQ.IND.VSAMFILE,DISP=OLD                         
//SYSIN    DD *                                                     
  OPTION VSAMIO,RESET                                               
  INREC FIELDS=(1,80,C'01')                                         
  SORT FIELDS=(1,14,CH,A)                                           
  SUM FIELDS=(81,2,ZD)                                             
  OUTFIL INCLUDE=(81,2,ZD,EQ,1),OUTREC=(1,80)                       
/*


Code:

//******************************************************************
//* THIS STEP DELETE & RE CREATE THE VSAM CLUSTER.                 *
//******************************************************************
//STEP0700 EXEC PGM=IDCAMS                                 
//SYSPRINT DD SYSOUT=*                                     
//SYSIN    DD *                                           
  DELETE HLQ.IND.VSAMFILE                                 
  DEFINE CLUSTER -                                         
      (NAME(HLQ.IND.VSAMFILE) -                           
       REUSE -                                             
       KEYS(14 0) -                                       
       RECSZ(80 80) -                                     
       FSPC(0 0) -                                         
       VOL(*) -                                           
       SHR(2 3)) -                                         
  DATA -                                                   
       (NAME (HLQ.IND.VSAMFILE.DATA) -                     
        CYL(5 1) -                                         
        CISZ(4096)) -                                     
  INDEX -                                                 
        (NAME (HLQ.IND.VSAMFILE.INDEX))                   
                                                           
/*               


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group