View previous topic :: View next topic
|
Author |
Message |
ksouren007
New User
Joined: 30 Jun 2010 Posts: 85 Location: Toronto, ON
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
Back to top |
|
|
ksouren007
New User
Joined: 30 Jun 2010 Posts: 85 Location: Toronto, ON
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Souren,
did you see the page # 19 "Cartesian join"? it should work. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|