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

How to merge files


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 184
Location: Coimbatore

PostPosted: Tue Nov 24, 2009 12:03 pm
Reply with quote

Hi,

I have a query on merging the files,

I have an input file 1:
123 ABDUL 85

I have an input file 2:
123 ABDUL FIRST

My output after merging needs to look like:
123 ABDUL 85 FIRST

but it look like,
123 ABDUL FIRST

The jcl i am using is,

//H1279CNA JOB ('SORTJCL'),MSGCLASS=O,TIME=(,9),NOTIFY=&SYSUID
//STEP01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=H1279CN.SORT7.IN1,
// DISP=SHR
// DD DSN=H1279CN.SORT7.IN2,
// DISP=SHR
//OUT1 DD DSN=H1279CN.SORT7.OUT1,
// DISP=SHR
//TOOLIN DD *
SPLICE FROM(IN1) TO(OUT1) ON(1,3,CH) WITH(11,5)
/*

Is there any way to get my desired output ?. Can I use dfsort-OUTFIL to get it?
any suggestions?... plz
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Nov 24, 2009 12:42 pm
Reply with quote

This is a link to the DFSORT smart tricks documentation which has examples of splicing records.
Please click HERE to access it.

Because the solution for sort related questions may vary from product to product, please ensure that you state clearly which sort product you are using.

If you are not sure, then by running a simple sort step shown below, you will be able to find out for yourself.

If the messages start with ICE then your product is DFSORT. Please also post the output of the complete line which has a message code ICE201I, as this will enable our DFSORT experts to determine which release of DFSORT that you have installed. This may also affect the solution offered.

If the messages start with WER or SYT then the product is SYNCSORT and should be posted in the JCL forum. Please also post the information telling which version of SYNCSORT is installed, as this may also affect the solution offered.

Thank you for taking your time to ensure that the valuable time of others is not wasted by offering inappropriate solutions which are not relevant due to the sort product being used and/or the release that is installed in you site.

Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY


What is the DSORG, RECFM & LRECL of both File 1 and File 2
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: Tue Nov 24, 2009 10:06 pm
Reply with quote

Abdul,

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//STEP01   EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//IN1      DD DSN=H1279CN.SORT7.IN1,
//            DISP=SHR
//IN2      DD DSN=H1279CN.SORT7.IN2,
//            DISP=SHR
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT1     DD DSN=H1279CN.SORT7.OUT1,
//            DISP=SHR
//TOOLIN   DD *
 COPY FROM(IN1) TO(T1)
 COPY FROM(IN2) TO(T1) USING(CTL2)
 SPLICE FROM(T1) TO(OUT1) ON(1,3,CH) WITH(14,5)
/*
//CTL2CNTL DD *
  INREC OVERLAY(14:11,5)
/*


Alternatively, with z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707 (Nov, 2009), you can use this JOINKEYS job:

Code:

//S2    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//IN1      DD DSN=H1279CN.SORT7.IN1,
//            DISP=SHR
//IN2      DD DSN=H1279CN.SORT7.IN2,
//            DISP=SHR
//SORTOUT  DD DSN=H1279CN.SORT7.OUT1,
//            DISP=SHR
//SYSIN    DD    *
  JOINKEYS F1=IN1,FIELDS=(1,3,A)
  JOINKEYS F2=IN2,FIELDS=(1,3,A)
  REFORMAT FIELDS=(F1:1,13,F2:11,5)
  OPTION COPY
/*
Back to top
View user's profile Send private message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 184
Location: Coimbatore

PostPosted: Wed Nov 25, 2009 11:34 am
Reply with quote

I got the output. Thanks for your kind help.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 4
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
Search our Forums:

Back to Top