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

To Merge mutliple records into a single record


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

New User


Joined: 03 Mar 2016
Posts: 14
Location: India

PostPosted: Wed Feb 22, 2017 8:49 am
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2453
Location: Hampshire, UK

PostPosted: Wed Feb 22, 2017 2:35 pm
Reply with quote

Quote:
using JCL or REXX

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Thu Feb 23, 2017 12:01 am
Reply with quote

How do you decide where the "blank" column is in your example? (;;)

A maximum of five values per key? Or more?
Back to top
View user's profile Send private message
anandgbe

New User


Joined: 03 Mar 2016
Posts: 14
Location: India

PostPosted: Thu Feb 23, 2017 9:20 am
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Feb 23, 2017 8:49 pm
Reply with quote

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
View user's profile Send private message
anandgbe

New User


Joined: 03 Mar 2016
Posts: 14
Location: India

PostPosted: Fri Mar 10, 2017 12:20 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 931
Location: Maryland

PostPosted: Sun Mar 12, 2017 1:37 am
Reply with quote

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
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 Merging more than two records DFSORT/ICETOOL 15
No new posts Matching and non matching records usi... DFSORT/ICETOOL 11
No new posts Record count of RECFM=U tape file DFSORT/ICETOOL 17
No new posts REMOVE DUPLICATE RECORDS BASED ON A S... DFSORT/ICETOOL 4
No new posts Checking the total counts inside a re... JCL & VSAM 5
Search our Forums:

Back to Top