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
 

 

Merge in a file depending upon the key

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

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Wed Dec 26, 2007 5:11 pm    Post subject: Merge in a file depending upon the key
Reply with quote

Hi,
I am having two input file of LRECL - 80 and they are PS.

File-1
------------------------------
Col: 1-15 - Sub ID
Col: 16-8 - Start - Date

File-2
------------------------------
Col: 1-15 - Sub ID
Col: 16-8 - End - Date

But in the output, I want like -

File-3
------------------------------
Col: 1-15 - Sub ID
Col: 16-8 - Start - Date
Col: 25-8 - End Date

But here I want to mention that here I am not having any master file or so. In detail, a subscriber with no start date (so not present in File-1) but with end date (so present in File-2) should come into the output file-File-3. And also true for vice-versa!
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Dec 26, 2007 5:36 pm    Post subject:
Reply with quote

amitava

1. Assuming that the field Sub ID is the KEY field, are there any duplicate records within FILE-1 and FILE-2?
2.
Quote:
a subscriber with no start date (so not present in File-1) but with end date (so present in File-2) should come into the output file-File-3.
So you want all the matching records from FILE-1 and FILE-2 and also the records that are present in FILE-2 only. Am i right?
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Wed Dec 26, 2007 5:36 pm    Post subject:
Reply with quote

Amitava,

Post some examples. And also how do you want this? Using util or prog.
Back to top
View user's profile Send private message
amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Wed Dec 26, 2007 5:50 pm    Post subject:
Reply with quote

krisprems, in regard to ur Qs -
Quote:
1. Assuming that the field Sub ID is the KEY field, are there any duplicate records within FILE-1 and FILE-2?

- No no such duplicate Sub-ID is there!
Quote:
So you want all the matching records from FILE-1 and FILE-2 and also the records that are present in FILE-2 only.

- I tried to mean that matching records from File-1 and File-2, unique records from File-2 and unique records from File-1.
And murmohk1,
Quote:
Post some examples. And also how do you want this? Using util or prog.

- I am giving some example here -

File-1
------
Code:
Sub-ID    Start Dt
123232233  20071213
123232231  20071211
123232234  20071212

File-2
-------
Code:
Sub-ID     End Dt
123232230  20071214
123232231  20071215
123232232  20071216
123232235  20071218


File-3
-------
Code:

Sub-ID        Start Dt   End Dt
123232230                 20071214
123232231  20071211 20071215
123232232                 20071216
123232233  20071213
123232234  20071212
123232235                  20071218


Now obviously murmohk1, I am looking for some utility! If it is possible by utility, who wants to go for a program?
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Dec 26, 2007 6:19 pm    Post subject: Reply to: Merge in a file depending upon the key
Reply with quote

amitava,

Quote:
- I tried to mean that matching records from File-1 and File-2, unique records from File-2 and unique records from File-1.


For matching records you can use SPLICE parameter of ICETOOL to get the reqd output.



Quote:
unique records from File-2 and unique records from File-1.


First remove the duplicates from both the input files and then reformat the first file as

Code:
sub-id   start-date  spaces(end-date)



second file as

Code:
sub-id spaces(start-date)  end-date


The output of SPLICE and the reformat outputs should be put in a single file.
Back to top
View user's profile Send private message
amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Wed Dec 26, 2007 6:21 pm    Post subject:
Reply with quote

If possible, can u pls provide me some sample JCL? It will be helpful for me ...
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Dec 26, 2007 7:05 pm    Post subject:
Reply with quote

Here is the sample ICETOOL JCL. Change as per your requirment. This is a variation of the "Join fields from two files on a key" Smart DFSORT Trick at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/

Also look at z/OS V1R8.0-V1R9.0 DFSORT Getting Started and other DFSORT materials here
Code:
//*******************************************************             
//STEP001  EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                       
123232233  20071213                                                   
123232231  20071211                                                   
123232234  20071212                                                   
/*                                                                     
//IN2      DD *                                                       
123232230  20071214                                                   
123232231  20071215                                                   
123232232  20071216                                                   
----+----1----+----2----+----3----+----4----+----5----+----6----+----7-
123232235  20071218                                                   
/*                                                                     
//TMP1     DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//BOTH     DD SYSOUT=*                                                 
//TOOLIN   DD *                                                       
 COPY FROM(IN1)  TO(TMP1)                         
 COPY FROM(IN2)  TO(TMP1) USING(NKK1)             
 SPLICE FROM(TMP1) TO(BOTH) ON(1,9,CH) WITH(21,8) -
      KEEPNODUPS       WITHALL                     
/*                                                 
//NKK1CNTL DD   *                                 
  OUTREC BUILD=(1,10,21:12,8,80:X)                 
/*                                                 
Back to top
View user's profile Send private message
amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Fri Dec 28, 2007 2:03 pm    Post subject:
Reply with quote

Hey krisprems! Its working man! Thanks a lot ... And obviously thanks for sharing the link.
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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