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

Join the data between two files using DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 792
Location: Chennai, India

PostPosted: Mon Oct 08, 2012 9:46 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Oct 08, 2012 10:20 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Oct 08, 2012 11:21 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top