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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Match 2 files and write into a 3rd file with a extra field
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

Site Director


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

PostPosted: Wed Mar 17, 2010 8:26 pm    Post subject:
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    Post subject:
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:

http://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    Post subject:
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: 1703
Location: Australia

PostPosted: Thu Mar 18, 2010 3:53 am    Post subject:
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 Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Mar 18, 2010 4:00 am    Post subject:
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:

http://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    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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 3 Tue Jan 17, 2017 4:26 pm
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 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 Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm


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