Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : When you specified V for RECFM parameter, LRECL value is largest record in the file plus 4 bytes. These four bytes contain the actual length of each variable length record in the file

Google
 
Web mainframegurukul.com

Merge two files

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
meta123
Member


Joined: 07 May 2009
Posts: 3

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu May 07, 2009 12:51 pm    Post subject: Merge two files Reply with quote

Hi everybody,

I have two input-files with following records:

File A (LRECL=55, RECFM=FB, KEY (no duplicate, key field start at 1th column an it's 19 bytes ))
Code:

111111111111111111100004078 M2 51791
222222222222222222200004154 M2 67861
333333333333333333300000096 M2 76481
444444444444444433300000024 M2 43321

File B (LRECL=648, KEY (no duplicate, key field start at 14th column an it's 19 bytes (but not in FH or FT))
Code:
000000001FH..........................................
03460000000021111111111111111111000FPK0420100000 000000000000000000000.........
03460000000032222222222222222222000FPK0420100000 000000000000000000000.........
03460000000043333333333333333333000FPK0420100000 000000000000000000000.........
03460000000054444444444444444333000FPK0420100000 000000000000000000000.........
000000006FT..........................................

Now I want to replace in file B (not FH or FT line), column 44(lenght 5), with column 51(lenght 5)of file A.
Code:

000000001FH..........................................
03460000000021111111111111111111000FPK0420151791 000000000000000000000.........
03460000000032222222222222222222000FPK0420167861 000000000000000000000.........
03460000000043333333333333333333000FPK0420176481 000000000000000000000.........
03460000000054444444444444444333000FPK0420143321 000000000000000000000.........
000000006FT..........................................

Thanks for your help!!
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

Alissa Margulies
Member


Joined: 28 Apr 2009
Posts: 25
Location: USA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu May 07, 2009 7:52 pm    Post subject: Reply with quote

meta123,

Here is a SyncSort for z/OS job that will provide the requested output:
Code:
//SORT1  EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD SYSOUT=*                                             
//SORTJNF1 DD *                                                       
111111111111111111100004078 M2 51791                                 
222222222222222222200004154 M2 67861                                 
333333333333333333300000096 M2 76481                                 
444444444444444433300000024 M2 43321                                 
//SORTJNF2 DD *                                                       
000000001FH..........................................                 
03460000000021111111111111111111000FPK0420100000 000000000000000000000
03460000000032222222222222222222000FPK0420100000 000000000000000000000
03460000000043333333333333333333000FPK0420100000 000000000000000000000
03460000000054444444444444444333000FPK0420100000 000000000000000000000
000000006FT..........................................                 
//SYSIN    DD *                                                         
   JOINKEYS FILES=F1,FIELDS=(1,19,A)                                 
   JOINKEYS FILES=F2,FIELDS=(14,19,A)                                 
   JOIN UNPAIRED,F2                                                   
   REFORMAT FIELDS=(F2:1,43,F1:32,5,F2:49,32)                         
   INREC IFTHEN=(WHEN=(10,2,CH,EQ,C'FH'),OVERLAY=(81:C'1')),       
         IFTHEN=(WHEN=(10,2,CH,EQ,C'FT'),OVERLAY=(81:C'9')),       
         IFTHEN=(WHEN=NONE,OVERLAY=(81:C'5'))                       
   SORT FIELDS=(81,1,CH,A),EQUALS                                   
   OUTREC BUILD=(1,80)                                             
/*                                                                 

PLEASE NOTE: The position and lengths provided in the original post do not match the sample data. This solution is based solely on the sample data. You will need to modify the code to accomodate your actual requirements.
_________________
Alissa Margulies
SyncSort Mainframe Product Services
zos_tech@syncsort.com
201-930-8260
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
meta123
Member


Joined: 07 May 2009
Posts: 3

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri May 08, 2009 9:55 am    Post subject: Reply with quote

Whe I execute this code, I've got this error:
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT P
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5
JOINKEYS FILES=F1, FIELDS=(1,19,A)
Č
ICE005A 0 STATEMENT DEFINER ERROR
JOINKEYS FILES=F2, FIELDS=(14,19,A)
Č
ICE005A 0 STATEMENT DEFINER ERROR

May you help me? Thank you!
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Anuj Dhawan
Moderator


Joined: 09 Aug 2008
Posts: 1625
Location: Mumbai, India

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri May 08, 2009 3:08 pm    Post subject: Reply with quote

Hi,

You are using DFSORT and not SyncSort; solution provided make use of JOINKEYS which is a SyncSort key-word . . .
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
meta123
Member


Joined: 07 May 2009
Posts: 3

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri May 08, 2009 3:48 pm    Post subject: Reply with quote

Any idea, how to do this with DFSORT? Our admin told me, that we don't have this product (SyncSort).
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Anuj Dhawan
Moderator


Joined: 09 Aug 2008
Posts: 1625
Location: Mumbai, India

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri May 08, 2009 5:58 pm    Post subject: Reply with quote

I leave that to Frank or Skolusu, they are much better than me when it comes to DFSORT solutions. Please have patience they will be around soon.

Thanks.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri May 08, 2009 8:27 pm    Post subject: Reply with quote

meta123,

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

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/55)
//IN2 DD DSN=...  input file2 (FB/648)
//IN2 DD DSN=&&I2,DISP=(OLD,PASS)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/648)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(649,1,CH) ON(14,19,CH) KEEPNODUPS -
  WITH(1,43) WITH(49,600) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(14:1,19,44:51,5,649:C'1')
/*
//CTL2CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(649:C'1')),
    IFTHEN=(WHEN=(10,2,CH,EQ,C'FH'),OVERLAY=(649:C'0')),
    IFTHEN=(WHEN=(10,2,CH,EQ,C'FT'),OVERLAY=(649:C'9'))
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,BUILD=(1,648)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
academyindia4
Guest





Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Jan 25, 2016 10:30 pm    Post subject: Topic deleted by Admin Reply with quote

<< Content deleted By Admin >>
Back to top
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities All times are GMT + 5 Hours
Page 1 of 1



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-4051.html