View previous topic :: View next topic
|
Author |
Message |
anandgbe
New User
Joined: 03 Mar 2016 Posts: 14 Location: India
|
|
|
|
I have some 1000 records in below format.
A1 Date1 Value1
A2 Date1 Value2
A3 Date1 value3
A5 Date1 value4
A1 Date2 Value5
A3 Date2 Value6
A4 Date2 value7
A5 Date2 value8
.
.
.
A1 Date31 value-v
A2 Date31 value-w
A3 Date31 value-x
A4 Date31 value-y
A5 Date31 value-z
I want to merge these records based on date value in the following format
Date1 Value1;value2;Value3; ;value4
Date2 value5; ;value6;value7;value8
.
.
.
Date31 value-v;value-w;value-x;value-y;value-z
Could you please suggest any algorithm to achieve this using JCL or REXX?
Thanks. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
so why post in the DFSort forum? DFSort is neither JCL or Rexx.
JCL cannot do what you want as it only tells the computer what programs you want to run and the resources required. If you are a programmer then you should be easily able to craft logic for doing this task in Rexx. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
How do you decide where the "blank" column is in your example? (;;)
A maximum of five values per key? Or more? |
|
Back to top |
|
|
anandgbe
New User
Joined: 03 Mar 2016 Posts: 14 Location: India
|
|
|
|
Quote: |
How do you decide where the "blank" column is in your example |
If the A2 is unavailable for DATE1, then 2nd value should be empty(i.e. ; ;)
In second case, If the A4 id unavailable for DATE2, then 4the value field should be empty.
Quote: |
A maximum of five values per key? Or more? |
In my case, there will be maximum of 40 values for each key(i.e., for each Date field).
A1 Date1 Value1
A2 Date1 Value2
A3 Date1 value3
A5 Date1 value4 .
.
.
.
A40 Date1 valuex
A1 Date2 Value5
A3 Date2 Value6
A4 Date2 value7
A5 Date2 value8
.
.
.
A40 Date2 valuey
and so on till Date31. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Should your output look like this, for the given example?
Code: |
Date1 Value1;value2;Value3; ;value4; ; ; ; ; ;.....upto 40 entries
Date2 value5; ;value6;value7;value8; ; ; ; ; ;.....upto 40 entries |
|
|
Back to top |
|
|
anandgbe
New User
Joined: 03 Mar 2016 Posts: 14 Location: India
|
|
|
|
Quote: |
Should your output look like this, for the given example?
|
Yes Arunraj, I need exactly in the same format as you mentioned. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2010 Location: USA
|
|
|
|
anandgbe wrote: |
Could you please suggest any algorithm to achieve this using JCL or REXX?
|
Your major problem is: full misunderstanding of the issue, and terminology.
The ALGORITHM is a sort of some abstract description of the process required to achieve the goal. It has absolutely nothing to do with any "language", neither JCL, nor REXX, nor anything else. (BTW, JCL itself cannot be used for these purposes; but utilities like SYNCSORT called from JCL can be used).
When prepared, the algorithm can be IMPLEMENTED using almost any available tool, or programming language.
Since you have demonstrated absolutely no understanding of the task at this level, any advice or explanation "in-general" would be useless. I refuse to provide you with final ready-to-use solution. First of all, RTFM. |
|
Back to top |
|
|
|