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

Laterallly Merge Two Files using Sort


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

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Mon Jun 09, 2014 4:19 pm
Reply with quote

Hi,

I have the following requirement.

FB,LRECL=20
File 1 : YYYY1-MM1-DD1YYYY2-MM2-DD2
FB, LRECL=8
File 2 : YYYY3MM3DD3 (There is no hyphen unlike File1)

Output:
FB, LRECL=20
YYYY2-MM2-DD2YYYY3-MM3-DD3

Assumptions: 1. There are no common keys in the two input files.
2. Both the input files would have only 1 record respectively.
Thus Output also would be of 1 record.

Please advise.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Tue Jun 10, 2014 8:00 pm
Reply with quote

Sourean,

Did you try JOINKEY's options? and that can be found below?

ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf
Back to top
View user's profile Send private message
ksouren007

New User


Joined: 30 Jun 2010
Posts: 85
Location: Toronto, ON

PostPosted: Tue Jun 10, 2014 8:18 pm
Reply with quote

Rohit,

As there are no common keys in between the two files doing a cartesian join won't bring the resultant output in a single row (Lateral Merge) I think.

I was trying with ICETOOL copy and sorting by SEQNUM also tried with SPLICE but not achieving the desired result.

May be bcoz some arguments which I'm mentioning in the TOOLIN are not correct.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Tue Jun 10, 2014 8:37 pm
Reply with quote

This seems like a perfect use for a Rexx program.

A very small one in fact.

However, none of your LRECL and actual data match.
You would need to correct that in your requirement.

Quote:
FB,LRECL=20
File 1 : YYYY1-MM1-DD1YYYY2-MM2-DD2
FB, LRECL=8
File 2 : YYYY3MM3DD3 (There is no hyphen unlike File1)

Output:
FB, LRECL=20
YYYY2-MM2-DD2YYYY3-MM3-DD3
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Tue Jun 10, 2014 8:51 pm
Reply with quote

Souren,

did you see the page # 19 "Cartesian join"? it should work.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Tue Jun 10, 2014 9:10 pm
Reply with quote

This is untested, but should work.

You will need Batch JCL to run this Rexx.

Code:
/* REXX */

"EXECIO 1 DISKR FILE1 (FINIS)"
PULL DATA1
DATE2 = SUBSTR(DATA1,11,10)

"EXECIO 1 DISKR FILE2 (FINIS)"
PULL DATA2
YYYY = SUBSTR(DATA2,1,4)
MM   = SUBSTR(DATA2,5,2)
DD   = SUBSTR(DATA2,7,2)

NEW_RECORD = DATE2||YYYY||'-'||MM||'-'||DD
DATAB.1 = NEW_RECORD
"EXECIO 1 DISKW FILE3 (STEM DATAB. FINIS)"

EXIT
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jun 11, 2014 12:19 pm
Reply with quote

If you don't have a key, you make one in the JNFnCNTL files. The same value, and then you have a match for JOINKEYS.

Fewer resources is to use the smaller file to generate a DFSORT Symbol on SYMNAMES in one small step, then a second step (equally small) to use the symbol generated to update the second file.
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 split large record length file... DFSORT/ICETOOL 7
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 JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top