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
 

 

How to keep only those records which r not duplicate of 1st

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

New User


Joined: 10 Jun 2005
Posts: 10
Location: Hyderabad, India

PostPosted: Tue Jun 14, 2005 3:33 pm    Post subject: How to keep only those records which r not duplicate of 1st
Reply with quote

Hi
Please help me to solve the following problem -

My input file record looks like this

01 123 A ** - first record
01 123 B
01 123 A ** - Dup of 1st record
01 123 C
01 123 D
01 123 D
02 456 A ** - 1st record
02 456 A ** - Dup of 1st record
02 456 A ** - Dup of 1st record
02 456 C
02 456 D
03 789 A ** - 1st record
04 123 A ** - 1st record
04 123 B

i need only those records in output file which are neither 1st record not the duplicate of the first.

i.e.
My output file should look like this

01 123 B
01 123 C
01 123 D
01 123 D
02 456 C
02 456 D
04 123 B

I am struggling with this for past 1 hr.. Please provide me the syntex for this at the earliest.

Thanks in Advance icon_smile.gif

Tarun
Back to top
View user's profile Send private message

MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Tue Jun 14, 2005 4:08 pm    Post subject:
Reply with quote

Excuse me... the first record end always in 'A'(I mean... is it fix?)
If is true I'm sure that a simple ICETOOL can help you otherwise try with a simple rexx program.
Back to top
View user's profile Send private message
Tarun Deep
Warnings : 1

New User


Joined: 10 Jun 2005
Posts: 10
Location: Hyderabad, India

PostPosted: Tue Jun 14, 2005 4:50 pm    Post subject: Re: How to keep only those records which r not duplicate of
Reply with quote

Thanks MGIndaco for replying !!
In fact this 'A' is a varibale here. This is not fix. This may vary for different case -
e.g.

'A' in this case -
01 123 A ** - first record
01 123 B
01 123 A ** - Dup of 1st record
01 123 C
01 123 D
01 123 D

could be different from 'A' in -
02 456 A ** - 1st record
02 456 A ** - Dup of 1st record
02 456 A ** - Dup of 1st record


Can this be solved ??

Rgds
Tarun
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Tue Jun 14, 2005 7:07 pm    Post subject:
Reply with quote

I tryed with ICETOOL but to avoid loser time I write for you this Rexx sample.

Rexx PGM:
Code:

/*% NOCOMMENT REXX         */                                 
/* PROGRAMMA: xxxxxxxx     */                                 
/* AUTORE   : MGIndaco     */                                 
/* ENV.     : BATCH        */                                 
Parse Arg WsFr WsTo                                           
 Say '-----------------------------------------'             
 Say '- Begin ---------------------------------'             
 Say '-----------------------------------------'             
 Say ' Argument passed from JCL : ' WsFr ',' WsTo             
 Say '-----------------------------------------'             
 EoF    = 'NO'                                               
 CntInp = 0                                                   
 CntOut = 0                                                   
 KeyOld = ''                                                 
 KeyNew = ''                                                 
 RecOld = ''                                                 
 RecNew = ''                                                 
Address Tso                                                   
 "ExecIO 0 DiskR Input(OPEN"                                 
 "ExecIO 0 DiskW Output(OPEN"                                 
 Do While EoF = 'NO'                                                 
   "ExecIO 1 DiskR Input"                                           
   If Rc = 0 Then Do                                                 
      CntInp = CntInp + 1                                           
      pull RecNew                                                   
      KeyNew = Substr(RecNew,WsFr,WsTo)                             
      If KeyNew = KeyOld Then Do                                     
         If RecNew <> RecOld Then Do                                 
            push RecNew                                             
            CntOut = CntOut + 1                                     
            "ExecIO 1 DiskW Output"                                 
         End                                                         
         Else Do                                                     
            Say '  First record duplicated on row: 'CntInp '- 'RecNew
         End                                                         
      End                                                           
      Else Do                                                       
         Say ' New Key From: 'WsFr ' To: ' WsTo ' -> ' KeyNew       
         KeyOld = KeyNew                                             
         RecOld = RecNew                                             
      End                                       
      DELSTACK                                 
    End                                         
    Else Do                                     
      EoF = 'Yes'                               
    End                                         
 End                                           
 "ExecIO 0 DiskR Input(Finis"                   
 "ExecIO 0 DiskW Output(Finis"                 
 "Free f(Input)"                               
 "Free f(Output)"                               
 Say ' Resume of process:                      '
 Say ' -----------------------------'           
 Say ' Total input record : 'CntInp             
 Say ' Total output record: 'CntOut             
 Say '-----------------------------------------'
 Say '- End -----------------------------------'
 Say '-----------------------------------------'
Exit Rc                                         


And this is the JCL:
Code:

//STEP010X EXEC PGM=IKJEFT01,PARM='NameOfRexxPGM 1 6'       
//SYSEXEC  DD DISP=SHR,DSN=LibWhereRexxPgmIsStored
//SYSTSPRT DD SYSOUT=B                                 
//SYSPRINT DD SYSOUT=B                                 
//INPUT    DD *                                         
01 123 A                                               
01 123 B                                               
01 123 A                                               
01 123 C                                               
01 123 D                                               
01 123 D                                               
02 456 A                                               
02 456 A                                               
02 456 A                                               
02 456 C                                               
02 456 D                                               
03 789 A                                               
04 123 A                                               
04 123 B                                               
//OUTPUT   DD SYSOUT=*                                 
//SYSTSIN  DD DUMMY     


When you copy-paste the source and the job use "Renum;Unnum" to avoid errors.
Try it and tell me your opinion.

P.S. = 1 and 6 are the start and length key i.e. "01 123"
Back to top
View user's profile Send private message
Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 464

PostPosted: Tue Jun 14, 2005 7:50 pm    Post subject: Re: How to keep only those records which r not duplicate of
Reply with quote

Hi,

Try following JCL. I hope it will help you.

//STEP0001 EXEC PGM=ICETOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUTX) ON(1,3,CH) ALLDUPS
/*
//IN DD DSN=Input file name, DISP
//OUTX DD DSN=Outfile name ,DISP
//

Regards
Rupesh.Kothari
Back to top
View user's profile Send private message
Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 464

PostPosted: Tue Jun 14, 2005 8:03 pm    Post subject: Re: How to keep only those records which r not duplicate of
Reply with quote

Hi Soory it was not correct.
I thought you want only duplicates records in output file.
Back to top
View user's profile Send private message
Tarun Deep
Warnings : 1

New User


Joined: 10 Jun 2005
Posts: 10
Location: Hyderabad, India

PostPosted: Tue Jun 14, 2005 8:06 pm    Post subject: Re: How to keep only those records which r not duplicate of
Reply with quote

Thanks a lot for your time and help. icon_smile.gif

In fact, I am not using Rexx tool here, however, i have solved this problem by using Easytrieves.

Regards
Tarun
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Jun 14, 2005 9:59 pm    Post subject:
Reply with quote

Tarun,

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your input file had RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG   DD  SYSOUT=*
//IN DD *
01 123 A ** - first record
01 123 B
01 123 A ** - Dup of 1st record
01 123 C
01 123 D
01 123 D
02 456 A ** - 1st record
02 456 A ** - Dup of 1st record
02 456 A ** - Dup of 1st record
02 456 C
02 456 D
03 789 A ** - 1st record
04 123 A ** - 1st record
04 123 B
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
//    DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,PASS)
//OUT DD SYSOUT=*
//TOOLIN   DD    *
 SELECT FROM(IN) TO(T1) ON(1,6,CH) FIRST DISCARD(T2) USING(CTL1)
 SPLICE FROM(CON) TO(OUT) ON(1,8,CH) -
   WITHALL WITH(1,81) KEEPNODUPS KEEPBASE USING(CTL2)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=T1,OUTREC=(1,80,81:C'11')
  OUTFIL FNAMES=T2,OUTREC=(1,80,81:C'22')
/*
//CTL2CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(81,2,CH,EQ,C'22'),
    OUTREC=(1,80)
/*
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 Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am


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