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

Match 2 files and write into a 3rd file with a extra field


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

New User


Joined: 21 Oct 2009
Posts: 7
Location: india

PostPosted: Wed Mar 17, 2010 3:40 pm
Reply with quote

Hi,

i want to match 2 files and write into a 3rd file with a extra field

for example

I have a file

file 1
---------
a;ab;abc
b;bb;abc

and another file like

file2
-------
ab 1 20
bb 1 30

I want to match these files

if position 3,4 in file1 is equal to position 1,2 in file2 my output file
should look like this

file3(output)
-------
a;20;ab;abc
b;30;bb;abc


is it possible to do in DFSORT

Thanks!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Wed Mar 17, 2010 8:26 pm
Reply with quote

Hello,

It would help someone help you if you replace the "alphabet-soup" with more meaningful sample data. . .

What are the recfm and lrecl of the files? What positions within the data are relevant? Are the data potitions fixed or might they vary between the delimiters?
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Mar 17, 2010 9:47 pm
Reply with quote

raj.tumu,

With z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707 (Nov, 2009), DFSORT now supports the JOINKEYS function which will give you the desired results as shown below

Code:

//STEP0100 EXEC PGM=SORT                   
//SYSOUT   DD SYSOUT=*                     
//SORTJNF1 DD *                             
A;AB;ABC                                   
B;BB;ABC                                   
//SORTJNF2 DD *                             
AB 1 20                                     
BB 1 30                                     
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD *                             
  JOINKEYS FILES=F1,FIELDS=(3,2,A)         
  JOINKEYS FILES=F2,FIELDS=(1,2,A)         
  REFORMAT FIELDS=(F1:1,2,F2:6,2,F1:2,7)   
  SORT FIELDS=COPY                         
//*

For complete details on JOINKEYS and the other new functions available with the Nov, 2009 DFSORT PTF, see:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174
Back to top
View user's profile Send private message
raj.tumu

New User


Joined: 21 Oct 2009
Posts: 7
Location: india

PostPosted: Thu Mar 18, 2010 3:45 am
Reply with quote

Hi Skolusu,

I have coded this way

//S010 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTJNF1 DD DSN=BH20P.H205VP01.VP201.G0001V00,DISP=SHR
//SORTJNF2 DD DSN=BH20P.PARAM(H2LNDNEW),DISP=SHR
//SORTOUT DD DSN=BWZ0.K026940.RFS4824.TEST,
// DISP=(,CATLG,DELETE),SPACE=(CYL,(150,50),RLSE)
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(18,2,A)
JOINKEYS FILES=F2,FIELDS=(1,2,A)
REFORMAT FIELDS=(F1:1,3,F2:11,10,F1:4,45)
SORT FIELDS=COPY
//*


and i have the following error. do u have any idea..about this

ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 23:12 ON WED MAR
JOINKEYS FILES=F1,FIELDS=(18,2,A)
Å
ICE005A 0 STATEMENT DEFINER ERROR
JOINKEYS FILES=F2,FIELDS=(1,2,A)
Å
ICE005A 0 STATEMENT DEFINER ERROR
REFORMAT FIELDS=(F1:1,3,F2:11,10,F1:4,45)
Å
ICE005A 0 STATEMENT DEFINER ERROR
SORT FIELDS=COPY
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Mar 18, 2010 3:53 am
Reply with quote

Hi,

Skolusu mentioned this in his reply
Quote:
With z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707 (Nov, 2009), DFSORT now supports the JOINKEYS function which will give you the desired results as shown below


Gerry
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: Thu Mar 18, 2010 4:00 am
Reply with quote

Raj,

You must have z/OS DFSORT V1R5 PTF UK51706 (Nov, 2009) in order to use DFSORT's JOINKEYS function. Ask your System Programmer to install that PTF (it's free). For complete details on the new functions available with that PTF, see:

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Joining files with intermittent heade... SYNCSORT 1
No new posts IGYPG3178-I when compiling a pgm read... COBOL Programming 6
No new posts INPFIL FILES, FNAMES examples SYNCSORT 7
No new posts FileAid move data from two files to o... Compuware & Other Tools 5
No new posts Sorting date into YYYYMMDD, and creat... DFSORT/ICETOOL 13
Search our Forums:


Back to Top