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
 

 

Regarding deleting and appending records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Vishal Trehan

New User


Joined: 21 Apr 2008
Posts: 5
Location: Mysore

PostPosted: Sun Apr 27, 2008 5:27 pm    Post subject: Regarding deleting and appending records
Reply with quote

hi all,
i have three flat files.
first file has records:

0001
0002
0003
0004
0005
0006
0007
0023
0056

another file has records:

0023
0056

And the third file has records:

0008
0009
0010

I need to create a file which will delete records from file 1 which are present in file 2 and add records whcih are present in file 3 . thus the output would be:

0001
0002
0003
0004
0005
0006
0007
0008
0009
0010

Can somebody help me regarding this?
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sun Apr 27, 2008 9:18 pm    Post subject:
Reply with quote

What if a record is present in all 3 files?
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: Sun Apr 27, 2008 11:30 pm    Post subject: Reply to: Regarding deleting and appending records
Reply with quote

And how should duplicates in any/all of the files be handled?
Back to top
View user's profile Send private message
Vishal Trehan

New User


Joined: 21 Apr 2008
Posts: 5
Location: Mysore

PostPosted: Mon Apr 28, 2008 10:20 am    Post subject: Reply to: Regarding deleting and appending records
Reply with quote

records present in file 2 will be present in file 1 but records presnt in file 3 will not be present in file 1.
Its simple deletion and addition of records to the file 1.
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

PostPosted: Mon Apr 28, 2008 12:12 pm    Post subject:
Reply with quote

Here is the SORT control card which you have asked for

Code:
//STEP0100  EXEC  PGM=ICETOOL
//TOOLMSG   DD SYSOUT=*
//DFSMSG    DD SYSOUT=*
//IN1       DD *
0001
0002
0003
0004
0005
0006
0007
0023
0056
//IN2       DD *
0023
0056
/*
//T1      DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(5,5)),
//           DISP=(MOD,PASS)
//FILEA     DD SYSOUT=*
//OUT12   DD SYSOUT=*
//OUT1    DD DSN=&&TEMP1,UNIT=SYSDA,SPACE=(TRK,(5,5)),
//           DISP=(MOD,PASS)
//OUT2    DD SYSOUT=*
//TOOLIN  DD *
  COPY FROM(IN1) TO(T1) USING(CTL1)
  COPY FROM(IN2) TO(T1) USING(CTL2)
  SPLICE FROM(T1) TO(OUT12) ON(1,4,CH) WITH(81,1) -
  USING(CTL3) KEEPNODUPS
/*
//CTL1CNTL DD *
  INREC OVERLAY=(80:C'11')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(80:C'22')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT1,INCLUDE=(80,2,CH,EQ,C'11'),BUILD=(1,80)
/*
//STEP2    EXEC PGM=SORT
//SYSOUT   DD   SYSOUT=*
//SYSPRINT DD   SYSOUT=*
//SORTIN    DD DSN=&&TEMP1,DISP=OLD
//          DD DSN=SB9642.TEMP.TEST,DISP=SHR
//SORTOUT   DD SYSOUT=*
//SYSIN     DD *
  SORT FIELDS=(1,4,CH,A)
/*
Back to top
View user's profile Send private message
Vishal Trehan

New User


Joined: 21 Apr 2008
Posts: 5
Location: Mysore

PostPosted: Mon Apr 28, 2008 1:53 pm    Post subject: Reply to: Regarding deleting and appending records
Reply with quote

Thanks.
but u havent mentioned how to append the records from the third file.
and i dont want to give the input from the JCl. i has to be from the flat file.
Please let me know that too. The question might be trivial for u but i am stilla novice. So would like to know that in details.
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

PostPosted: Mon Apr 28, 2008 3:30 pm    Post subject:
Reply with quote

The Step2 is doing the 3rd file appending to the output of 1st and Second
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Apr 28, 2008 10:29 pm    Post subject: Reply to: Regarding deleting and appending records
Reply with quote

Vishal Trehan,

The following DFSORT JCL will give you the desired results. I assumed that all files are of the same record length and file1 and file 2 does not have duplicates. The first step concatenates file 1 and file 2 and removes the dupes from them which means that any matching record is deleted. And step0200 concatenates the output from step 1 to file3 and creates 1 single file.

Code:

//STEP0100 EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN       DD DSN=your file 1,DISP=SHR
//         DD DSN=your file 2,DISP=SHR
/*                                             
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)   
//TOOLIN   DD *                                             
  SELECT FROM(IN) TO(T1) ON(1,4,CH) NODUPS                   
/*
//STEP0200 EXEC PGM=ICEMAN       
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD DSN=&&T1,DISP=SHR   
//         DD DSN=your file 2,DISP=SHR
//SORTOUT  DD SYSOUT=*           
//SYSIN    DD *                   
  OPTION EQUALS                   
  SORT FIELDS=(1,4,CH,A)         
/*     


Hope this helps...

Cheers
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
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
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


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