Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Merging 2 lines in one on conditional basis

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

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Tue Jun 25, 2013 11:00 pm    Post subject: Merging 2 lines in one on conditional basis
Reply with quote

This is my requirement -

Input data - FB 80

It has multiple lines, but only few pairs as shown below -

Code:

AAAAAA 123456-1234567-123
AAAAAA 123456-1234567-123
AAAAAA 123456-1234567-123
AAAAAA 123456-1234567-777
    04/13     03/14     Z3  00000
AAAAAA 123456-1234567-123
AAAAAA 123456-1234567-123
AAAAAA 123456-1234567-888
    03/13     02/14     L3  00000
AAAAAA 123456-1234567-123


Output expected - FB 160

I need to get only pairs in the output. Like this -

Code:

AAAAAA 123456-1234567-777    04/13     03/14     Z3  00000
AAAAAA 123456-1234567-888    03/13     02/14     L3  00000
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue Jun 25, 2013 11:52 pm    Post subject:
Reply with quote

What is your sort product?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7224

PostPosted: Tue Jun 25, 2013 11:53 pm    Post subject: Reply to: Merging 2 lines in one on conditional basis
Reply with quote

So, from the data you have shown you can just ignore everything that is "-123"?

Or any other way to know which ones you want?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jun 26, 2013 12:11 am    Post subject:
Reply with quote

Hello,

I suspect incomplete test data . . .
Back to top
View user's profile Send private message
abdul.faras

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Wed Jun 26, 2013 1:32 am    Post subject: Re: Reply to: Merging 2 lines in one on conditional basis
Reply with quote

Pandora-Box wrote:
What is your sort product?


It is DFSORT.

Bill Woodger wrote:
So, from the data you have shown you can just ignore everything that is "-123"?

Or any other way to know which ones you want?


-123 is just a sample data, it could be any value.
What I need is a pair of records as shown in example:
for record having -777 paired record has values -
04/13 03/14 Z3 00000
similarly record having -888 paired record is-
03/13 02/14 L3 00000

I just need these paired records in output to be merged in to one line.

I hope its clear now!
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jun 26, 2013 1:58 am    Post subject: Reply to: Merging 2 lines in one on conditional basis
Reply with quote

How do you define "paired" records?

Do you mean the last record of the group has spaces in the first 3 bytes and you need to pick the record prior to that as a pair?

If that is indeed true

1. Use ICETOOL SELECT operator with LASTDUP on the sequence number
2. Use when=init to append a sequence number at position 161.
3. Use when=group with END=(1,3,CH,EQ,C' ') and RECORDS=2 and push the contents on to pos 81.
4. Use When=(1,3,CH,EQ,C' ') subtract 1 from the sequence number to make it a duplicate record.
5. Using OUTFIL build the first 160 bytes removing the sequence number
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Jun 26, 2013 12:30 pm    Post subject:
Reply with quote

Kolusu,

Instead of this why cant we just do something like this

1.GROUP 1,3 when not equal to space and adding SEQ and pushing data
2.OUTFIL INCLUDE only for number 2 and BUILD to reformat
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7224

PostPosted: Wed Jun 26, 2013 12:47 pm    Post subject: Reply to: Merging 2 lines in one on conditional basis
Reply with quote

Well, experiment.

Remember to turn off the SORT for SELECT. OPTION COPY in the USING(xxxx) xxxxCNTL file.

Give yourself 50m input records.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Jun 26, 2013 8:17 pm    Post subject:
Reply with quote

Bill & Kolusu,

Code:
//S1      EXEC PGM=SORT
//SYSPRINT  DD SYSOUT=*
//SYSOUT    DD SYSOUT=*
//SORTIN    DD *
AAAAAA 123456-1234567-123
AAAAAA 123456-1234567-123
AAAAAA 123456-1234567-123
AAAAAA 123456-1234567-777
    04/13     03/14     Z3  00000
AAAAAA 123456-1234567-123
AAAAAA 123456-1234567-123
AAAAAA 123456-1234567-888
    03/13     02/14     L3  00000
AAAAAA 123456-1234567-123
//SORTOUT   DD SYSOUT=*
//SYSIN     DD *
  SORT   FIELDS=COPY
  INREC  IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,NE,C'   '),
                 PUSH=(35:SEQ=1,1,25))
  OUTFIL INCLUDE=(35,1,ZD,EQ,02),BUILD=(1:36,25,26:1,33)


This will give the output

Code:
AAAAAA 123456-1234567-777    04/13     03/14     Z3  00000
AAAAAA 123456-1234567-888    03/13     02/14     L3  00000


I am not sure what is the disadvantage of this method
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jun 26, 2013 9:09 pm    Post subject:
Reply with quote

pandora,

There are "n" different ways to get the desired results. My choice was to use SELECT to pick the Last Duplicate via ICETOOL and you chose the traditional method. There wouldn't be a difference in performance either method.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Jun 26, 2013 9:51 pm    Post subject:
Reply with quote

Ok fine :-)

Thanks
Back to top
View user's profile Send private message
abdul.faras

New User


Joined: 29 Feb 2008
Posts: 49
Location: Pune

PostPosted: Thu Jun 27, 2013 9:14 am    Post subject:
Reply with quote

Kolusu, Pandora...

Thanks a lot to both of you for providing the solution. I really do appreciate. icon_smile.gif
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 syncsort: copy lines after the keyword shreya19 SYNCSORT 2 Fri Dec 02, 2016 9:47 am
No new posts Insert Lines in JCL with Rexx after a... Willy Jensen CLIST & REXX 3 Tue Aug 30, 2016 4:18 pm
No new posts Merging of two files siva102 DFSORT/ICETOOL 3 Fri Feb 19, 2016 12:36 pm
No new posts DFSORT split long VB lines efficiently BridgetBrackenbury DFSORT/ICETOOL 2 Fri Feb 12, 2016 5:10 am
No new posts DFSORT VB File make 2 lines from 1 BridgetBrackenbury DFSORT/ICETOOL 2 Fri Feb 12, 2016 3:48 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us