Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Merge data from record pairs

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ashokakash

New User


Joined: 15 Nov 2006
Posts: 21
Location: Chennai

PostPosted: Tue Oct 16, 2018 7:02 pm    Post subject: Merge data from record pairs
Reply with quote

Hello all,
Suppose, I want some value from 2nd record being brought to 1st record, how could I do that? Can somebody help me in this? Thank you!

Input
Code:

XXXXXXXXXXXXXXXX  12/31/18 ABCD123
                                 15:15:43               
YYYYYYYYYYYYYYYYYY 12/31/18 ABCD123
                                 15:16:33               
ZZZZZZZZZZZZZZZZ  12/31/18 ABCD123
                                 15:17:23               
AAAAAAAAAAAAAAAA  12/31/18 ABCD123
                                 15:18:13               


Desired output
first 4 chars of 1st record, date of first record and time stamp of 2nd record are pushed to the right of first 2 records and this process should go on for every 2 records.
Code:

XXXXXXXXXXXXXXXX  12/31/18 ABCD123 XXXX 12/31/18 15:15:43
                                 15:15:43                XXXX 12/31/18 15:15:43
YYYYYYYYYYYYYYYYYY 12/31/18 ABCD123  YYYY 12/31/18 15:16:33
                                 15:16:33                YYYY 12/31/18 15:16:33
ZZZZZZZZZZZZZZZZ  12/31/18 ABCD123 ZZZZ 12/31/18 15:17:23
                                 15:17:23                ZZZZ 12/31/18 15:17:23
AAAAAAAAAAAAAAAA  12/31/18 ABCD123 AAAA 12/31/18 15:18:13
                                 15:18:13                AAAA 12/31/18 15:18:13
Edited Title
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8732
Location: Welsh Wales

PostPosted: Wed Oct 17, 2018 11:43 am    Post subject:
Reply with quote

@ashokakash

Learn to use the code tags yourself, it saves myself and other moderators from having to do YOUR work for you.
Code:
[code]
Your stuff
goes in here
[/code]
- Pretty easy isn't it.

Learn to start a new thread, posting on the back of a five year old thread which was totally unrelated is just plain idle laziness.

I have put this into the DFSORT section as your previous effort was tagged onto a SORT product question. But hey ho, as YOU HAVE NOT bothered to say which language you would like help in, how the hell can I possibly know, or anyone else that may wish to help you.

So, you need to tell us -
1) A lot more about your request.
2) Which languages or utilities you are looking for a solution with.
3) Some information regarding the RECFM / LRECL of your datasets.
4) Relative positions and lengths of field being manipulated.
5) Any other conditions / checks that may exist.
6) Most important What you have tried so far and the failing results.

Please, learn to help yourself and those that may want to help you, you have been a member of the forum for 12 years now.
Back to top
View user's profile Send private message
ashokakash

New User


Joined: 15 Nov 2006
Posts: 21
Location: Chennai

PostPosted: Wed Oct 17, 2018 12:12 pm    Post subject:
Reply with quote

I regret the inconvenience. I refined the input/output below. The problem is date and time stamp is split and the date comes in first record and in the 2nd record same position comes the time stamp.

Input
Code:

XXXXXXXXXXXXXXXX 12/31/18 ABCD123
                 15:15:43
YYYYYYYYYYYYYYYY 12/31/18 ABCD123
                 15:16:33
ZZZZZZZZZZZZZZZZ 12/31/18 ABCD123
                 15:17:23
AAAAAAAAAAAAAAAA 12/31/18 ABCD123
                 15:18:13


Output
Code:

XXXXXXXXXXXXXXXX 12/31/18 ABCD123 XXXX 12/31/18 15:15:43
                 15:15:43         XXXX 12/31/18 15:15:43
YYYYYYYYYYYYYYYY 12/31/18 ABCD123 YYYY 12/31/18 15:16:33
                 15:16:33         YYYY 12/31/18 15:16:33
ZZZZZZZZZZZZZZZZ 12/31/18 ABCD123 ZZZZ 12/31/18 15:17:23
                 15:17:23         ZZZZ 12/31/18 15:17:23
AAAAAAAAAAAAAAAA 12/31/18 ABCD123 AAAA 12/31/18 15:18:13
                 15:18:13         AAAA 12/31/18 15:18:13


I need SORT utility to get the desired output. Every two records are related and the both must be affixed with first 4 characters of 1st record, 8 chars from position 18 of 1st record and 8 chars from position 18 of 2nd record.

I hope I made my requirement clear. If it is not sufficient, please let me know. Thank you!
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8732
Location: Welsh Wales

PostPosted: Wed Oct 17, 2018 12:19 pm    Post subject:
Reply with quote

Which SORT product are you using - DFSORT or SYNCSORT - and it's release level.

RECFM / LRECL of the records - as requested above

Positions of the added output fields - as requested above

What you have tried yourself and the failing results

Not having used SORT for ages but you can create an intermediate record by appending the second record to the first, and then working with the newly created record - two passes of the data will be needed I think.

Or you could wait for a suggested possible one pass solution from "one of the better sorts" on the forum icon_rolleyes.gif

However, until we see what you have already tried ...................................
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1027
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Wed Oct 17, 2018 1:54 pm    Post subject:
Reply with quote

There may be a better way but you could, in three passes:

Add sequence numbers (INREC) and, (OUTREC) for the the groups of 2 records, PUSH the fields from the 1st record into the required positions in both records of the pair.

Sort descending on the sequence numbers and PUSH the timestamp from what is now the first record of a group of two into both records of the pair.

Sort ascending on the sequence number dropping the sequence numbers.

Garry.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Oct 17, 2018 6:58 pm    Post subject:
Reply with quote

Here is a version of expat's idea above assuming FB/LRECL=80 input/output data. Push the first record onto the second record and then use the 'merged' second record to write two output records with the required fields in OUTFIL
Code:
//SYSIN     DD *                                         
 OPTION COPY                                             
 OUTREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:SEQ=1,1,80))
 OUTFIL INCLUDE=(81,1,CH,EQ,C'2'),                       
        BUILD=(82,34,82,4,X,99,8,X,18,8,80:X,/,           
               01,34,82,4,X,99,8,X,18,8)                 
/*                                                       
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DFSORT output in CSV for data spans i... hiravibk DFSORT/ICETOOL 0 Tue Nov 13, 2018 7:55 pm
No new posts Process Last Key of a record based on... naveen katkuri DFSORT/ICETOOL 5 Mon Nov 12, 2018 9:54 am
No new posts REFORMATTING WITH JFY CLOBBERING OUTP... speermb DFSORT/ICETOOL 10 Thu Nov 08, 2018 7:20 pm
No new posts Migrating AS400 to HIVE; Data type ma... sindhu.jose All Other Mainframe Topics 1 Tue Nov 06, 2018 1:06 pm
This topic is locked: you cannot edit posts or make replies. Get value from 2nd record and PUSH it... ashokakash JCL & VSAM 1 Wed Oct 17, 2018 11:41 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us