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
 

 

Join the data between two files using DFSORT

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

New User


Joined: 28 Jan 2010
Posts: 47
Location: India

PostPosted: Mon Oct 08, 2012 9:06 pm    Post subject: Join the data between two files using DFSORT
Reply with quote

Hi,

I have a requirement to combine the data from 2 files and create a new file. For e.g., I have the following data from 2 files.

File 1:-

ABCD 0001002

File 2:-

PQRS 1001 MAINFRAMEUSER 0009999

Now, I have to replace column - 0009999 from File 2 with the content of File 1 (00010002) and write it into another new file as shown below.

PQRS 1001 MAINFRAMEUSER 0001002

Please let me know how we can do it through DFSORT.

Thank you.
Back to top
View user's profile Send private message

Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 785
Location: Chennai, India

PostPosted: Mon Oct 08, 2012 9:46 pm    Post subject:
Reply with quote

Is this one-to-one record merging? I mean first record value 0001002 should be overlaid to 0009999 value of File 2' first record and so on.

Or there are rules to merge?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Mon Oct 08, 2012 10:20 pm    Post subject: Reply to: Join the data between two files using DFSORT
Reply with quote

the info provided is not enough to provide any help
Back to top
View user's profile Send private message
maki_psg

New User


Joined: 28 Jan 2010
Posts: 47
Location: India

PostPosted: Mon Oct 08, 2012 10:23 pm    Post subject:
Reply with quote

There will be only 1 record in each file. I would like to merge the record from each file into a new file as I mentioned above.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Mon Oct 08, 2012 11:21 pm    Post subject: Reply to: Join the data between two files using DFSORT
Reply with quote

if the problem is exactly as described and the two files have the same lrecl

this should work

Code:
 000004 //S1      EXEC PGM=ICEMAN
 000005 //SYSOUT    DD SYSOUT=*
 000006 //SORTIN    DD *
 000007 ABCD 0001002
 000008 //          DD *
 000009 PQRS 1001 MAINFRAMEUSER 0009999
 000010 //SORTOUT   DD SYSOUT=*,
 000011 //             DCB=(RECFM=FB,LRECL=80)
 000012 //SYSIN     DD *
 000013   SORT   FIELDS=COPY
 000014   INREC  IFTHEN=(WHEN=GROUP,
 000015                  BEGIN=(01,04,CH,EQ,C'ABCD'),PUSH=(25:06,7))
 000016   OUTFIL OMIT=(01,04,CH,EQ,C'ABCD')


output
Code:
********************************* TOP OF DATA **********************************
PQRS 1001 MAINFRAMEUSER 0001002
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue Oct 09, 2012 12:00 am    Post subject:
Reply with quote

Alternatively you can use the following DFSORT's JOINKEYS job to get the desired results
Code:

//STEP0100 EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//INA      DD *                                   
ABCD 0001002                                       
//INB      DD *                                   
PQRS 1001 MAINFRAMEUSER 0009999                   
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                                   
  OPTION COPY                                     
  JOINKEYS F1=INA,FIELDS=(81,1,A),SORTED,NOSEQCK   
  JOINKEYS F2=INB,FIELDS=(81,1,A),SORTED,NOSEQCK   
  REFORMAT FIELDS=(F2:1,24,F1:6,7,32,49)           
//*                                               
//JNF1CNTL DD *                                   
  OPTION STOPAFT=1                                 
  INREC OVERLAY=(81:C'A')                         
//*                                               
//JNF2CNTL DD *                                   
  OPTION STOPAFT=1                                 
  INREC OVERLAY=(81:C'A')                         
//*
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 in SQL Query vickey_dw DB2 0 Tue Jan 17, 2017 12:15 am
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 0 Mon Jan 02, 2017 11:16 am
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm


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