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

How can i delete records using jcl.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Tue Aug 07, 2007 11:27 am
Reply with quote

Hi All,

i have one PS file have 10 records. in that records i need to delete 5 records. these 5 records are selected randomly from 10 records. below i am giving you the example.

10 records file1:

Code:

 ----+----1----+----2----+----3
 GUHA 43234 DLS AAAAAAAAAAAAAAA
 VIKA 34323 LKS BBBBBBBBBBBBBBB
 IMRA 64534 LDR CCCCCCCCCCCCCCC
 PRBU 35323 LAS DDDDDDDDDDDDDDD
 SURN 93454 PSF EEEEEEEEEEEEEEE
 NIRA 53233 MDS FFFFFFFFFFFFFFF
 SRIN 73484 IOL GGGGGGGGGGGGGGG
 TLSI 83294 JSD HHHHHHHHHHHHHHH
 RMSH 14323 CSL IIIIIIIIIIIIIII
 IRFN 34334 ASL JJJJJJJJJJJJJJJ
**************************** Bottom of Data ****************************


5 records file2(which records are need to delete from above file):

here only we have data upto 20th position. not fully.

Code:

 ----+----1----+----2
 SRIN 73484 IOL GGGGG
 SURN 93454 PSF EEEEE
 VIKA 34323 LKS BBBBB
 NIRA 53233 MDS FFFFF
 RMSH 14323 CSL IIIII
 **************************** Bottom of Data ****************************


And we don't have any unique key value and we don't have any sort field.

the out put should be
Code:


 ----+----1----+----2----+----3
 GUHA 43234 DLS AAAAAAAAAAAAAAA
 IMRA 64534 LDR CCCCCCCCCCCCCCC
 PRBU 35323 LAS DDDDDDDDDDDDDDD
 TLSI 83294 JSD HHHHHHHHHHHHHHH
 IRFN 34334 ASL JJJJJJJJJJJJJJJ
**************************** Bottom of Data ****************************


so i want to delete file2 records from file1. Like this i need to delete 1000 records from 70,000 records. just for example only, i gave you above code. anybody please help me if is there any solution with using jcl.

Thanks in advance,
Guha
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Aug 07, 2007 11:35 am
Reply with quote

Guha,

Are you expecting any duplicate records in file1 in the pos 16-20?
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Tue Aug 07, 2007 11:43 am
Reply with quote

Hi Murali,

Thx for ur response.

i am not expecting any duplicate records from file1. just i want to delete the records with using file2 from file1.

Thx
Guha.
Back to top
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Tue Aug 07, 2007 11:51 am
Reply with quote

Hi Guha,
Quote:
so i want to delete file2 records from file1.

What is the key on which you want file 2 record to be compared with file 1 ?
Also pls provide LRECL and file types of both the files !

--Parag
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Tue Aug 07, 2007 11:56 am
Reply with quote

Hi Parag,

Thx...

Quote:

And we don't have any unique key value and we don't have any sort field.


there is no key field declared for compare. LRECL for three files are 30, and File type is FB.

Thx and Regards
Guha.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Aug 07, 2007 11:58 am
Reply with quote

Guha,


Code:
//SPLIT  EXEC PGM=ICETOOL         
//TOOLMSG  DD SYSOUT=*           
//DFSMSG DD SYSOUT=*             
//*                               
//IN1   DD *                     
GUHA 43234 DLS AAAAAAAAAAAAAAA   
VIKA 34323 LKS BBBBBBBBBBBBBBB   
IMRA 64534 LDR CCCCCCCCCCCCCCC   
PRBU 35323 LAS DDDDDDDDDDDDDDD   
SURN 93454 PSF EEEEEEEEEEEEEEE   
NIRA 53233 MDS FFFFFFFFFFFFFFF   
SRIN 73484 IOL GGGGGGGGGGGGGGG   
TLSI 83294 JSD HHHHHHHHHHHHHHH   
RMSH 14323 CSL IIIIIIIIIIIIIII   
IRFN 34334 ASL JJJJJJJJJJJJJJJ   
/*                               
//IN2   DD *                     
SRIN 73484 IOL GGGGG             
SURN 93454 PSF EEEEE                                       
VIKA 34323 LKS BBBBB                                       
NIRA 53233 MDS FFFFF                                       
RMSH 14323 CSL IIIII                                       
/*                                                         
//T1   DD DSN=&&T1,SPACE=(TRK,(11,1)),DISP=(MOD,PASS)     
//T2   DD DSN=&&T2,SPACE=(TRK,(11,1)),DISP=(MOD,PASS)     
//*                                                       
//OP DD SYSOUT=*                                           
//*                                                       
//TOOLIN DD *                                             
  COPY FROM(IN1) TO(T1) USING(CTL1)                       
  COPY FROM(IN2) TO(T1) USING(CTL2)                       
  COPY FROM(T1) TO(T2) USING(CTL3)                         
  COPY FROM(T2) TO(OP) USING(CTL4)                         
/*                                                         
//CTL1CNTL DD *                       
  INREC OVERLAY=(81:C'1')             
/*                                     
//CTL2CNTL DD *                       
  INREC OVERLAY=(81:C'2')             
/*                                     
//CTL3CNTL DD *                       
  SORT FIELDS=(16,5,CH,A)             
  SUM FIELDS=(81,1,ZD)                 
/*                                     
//CTL4CNTL DD *                       
  INCLUDE COND=(81,1,CH,EQ,C'1')       
  OUTREC BUILD=(1,80)                 
/*                                     



OUTPUT
Code:
GUHA 43234 DLS AAAAAAAAAAAAAAA           
IMRA 64534 LDR CCCCCCCCCCCCCCC           
PRBU 35323 LAS DDDDDDDDDDDDDDD           
TLSI 83294 JSD HHHHHHHHHHHHHHH           
IRFN 34334 ASL JJJJJJJJJJJJJJJ           


Assumptions:

(1) IP and OP file LRECL is 80.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Tue Aug 07, 2007 12:01 pm
Reply with quote

Guha,

Please note that the above step works ONLY, if the FILE1 doesn't have duplicate values between 16&20 columns.

Also, change 81 -> 31 & 80-> 30 in the control cards.
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Tue Aug 07, 2007 2:49 pm
Reply with quote

Hi Murali,

sorry for late reply, i tried it... i got the required output...

many many thx ... murali

Regards,
Guha.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Aug 07, 2007 9:01 pm
Reply with quote

Guha,

Here's another way to do this with DFSORT/ICETOOL.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/30)
//IN2 DD DSN=...  input file2 (FB/30)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/30)
//TOOLIN   DD    *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(16,5,CH) KEEPNODUPS -
  WITH(1,31) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(31:C'BB')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(31:C'VV')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(31,2,CH,EQ,C'VV'),
    BUILD=(1,30)
/*
Back to top
View user's profile Send private message
rguhanath

New User


Joined: 16 Oct 2006
Posts: 81
Location: chennai

PostPosted: Wed Aug 08, 2007 10:24 am
Reply with quote

Hi Frank,

Thanks,

i already use the above logic which is already there in our previous posts asked by Bharathi. i compared with 'VB' insted of 'VV' in CTL3 card. so that i didn't get output. like below.

//CTL3CNTL DD *
OUTFIL FNAMES=OUT1,INCLUDE=(182,2,CH,EQ,C'VB'),
BUILD=(1,181)
/*

Thx for your solution Frank. i put 'VV' insted of 'VB' and i got the result.

Regards,
Guha.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts DELETE SPUFI DB2 1
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts How to delete a user's alias from the... JCL & VSAM 11
Search our Forums:

Back to Top