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
 

 

To merge a part of repeated records while combining other pa

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

New User


Joined: 13 May 2007
Posts: 14
Location: chennai

PostPosted: Sun Aug 26, 2007 1:07 am    Post subject: To merge a part of repeated records while combining other pa
Reply with quote

Hi,
I have a requirement as follows.
I have a input dataset in which some rows are repeated upto a fixed column. After that fixed column there are four indicator fields which are different in the otherwise repeating rows. Now in the four indicators fields 1 field has some value, while others are blank for a row. similarly in the next row (in which there fields are common upto a fixed column) the indicators have a different combination.

Now in the output,i want the rows which are common upto that fixed column to be merged and the indicators to come in that single row.

For e.g.
Input.
Code:

1000|1|2|3|abc|y| | | |
1000|1|2|3|abc| | |n| |
1000|1|2|3|abc| | | |n|

For the above input, the output should be
Code:

1000|1|2|3|abc|y| |n|n|

As you can see in the input, the last 4 columns are the indicators about which i have mentioned above.

Please help.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sun Aug 26, 2007 8:47 pm    Post subject:
Reply with quote

What is the RECFM and LRECL of the input file?

What is the starting postion, length and format of each field?

Your example shows one input record group (by value) with three records. Can there be a group with two records, four records, etc? Can a group have records with more than one indicator in the same column? If so, what do you want for output in that case?

Please show a better example with more variations, and explain the rules in more detail.
Back to top
View user's profile Send private message
vinay upadhyay

New User


Joined: 13 May 2007
Posts: 14
Location: chennai

PostPosted: Sun Aug 26, 2007 11:08 pm    Post subject:
Reply with quote

Hi Frank,

Thanks for concern.

Record format is fixed block. Starting position,length,format is as follows.

Col 1: 1,4,CH
COl2: 6,1,CH
Col3: 8,1,CH
Col4: 10,1,ZD
Col5: 12,3,CH
Cols6,7,8,9 are CH of length.

I have used '|' as delimiter.

There can be groups with two or three or four (maximum) records. There will be only one indicator in same column for a group.
I am giving another e.g.
Input
Code:

2000|4|8|9|xyz| | | |y|
2000|4|8|9|xyz| |n| | |
2000|4|8|9|xyz|n| | | |
3500|a|3|9|pqr| | | |n|
3500|a|3|9|pqr| | |n| |

Output:
Code:

2000|4|8|9|xyz|n|n| |y|
3500|a|3|9|pqr| | |n|n|

I hope i am making my point clear.

Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Aug 27, 2007 9:37 pm    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB/23)
//OUT DD DSN=...  output file (FB/23)
//TOOLIN   DD    *
SPLICE FROM(IN) TO(OUT) ON(1,14,CH) KEEPNODUPS -
  WITHEACH WITH(29,2) WITH(31,2) WITH(33,2) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(25:SEQNUM,1,ZD,RESTART=(1,14))),
    IFTHEN=(WHEN=(25,1,ZD,EQ,1,AND,16,1,CH,NE,C' '),
      OVERLAY=(27:C'1',16,1),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,ZD,EQ,1,AND,18,1,CH,NE,C' '),
      OVERLAY=(27:C'2',18,1),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,ZD,EQ,1,AND,20,1,CH,NE,C' '),
      OVERLAY=(27:C'3',20,1),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,ZD,EQ,1,AND,22,1,CH,NE,C' '),
      OVERLAY=(27:C'4',22,1),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,ZD,EQ,2,AND,16,1,CH,NE,C' '),
      OVERLAY=(29:C'1',16,1),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,ZD,EQ,2,AND,18,1,CH,NE,C' '),
      OVERLAY=(29:C'2',18,1),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,ZD,EQ,2,AND,20,1,CH,NE,C' '),
      OVERLAY=(29:C'3',20,1),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,ZD,EQ,2,AND,22,1,CH,NE,C' '),
      OVERLAY=(29:C'4',22,1),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,ZD,EQ,3,AND,16,1,CH,NE,C' '),
      OVERLAY=(31:C'1',16,1),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,ZD,EQ,3,AND,18,1,CH,NE,C' '),
      OVERLAY=(31:C'2',18,1),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,ZD,EQ,3,AND,20,1,CH,NE,C' '),
      OVERLAY=(31:C'3',20,1),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,ZD,EQ,3,AND,22,1,CH,NE,C' '),
      OVERLAY=(31:C'4',22,1),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,ZD,EQ,4,AND,16,1,CH,NE,C' '),
      OVERLAY=(33:C'1',16,1),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,ZD,EQ,4,AND,18,1,CH,NE,C' '),
      OVERLAY=(33:C'2',18,1),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,ZD,EQ,4,AND,20,1,CH,NE,C' '),
      OVERLAY=(33:C'3',20,1),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,ZD,EQ,4,AND,22,1,CH,NE,C' '),
      OVERLAY=(33:C'4',22,1))
  OUTFIL FNAMES=OUT,
    IFOUTLEN=23,
    IFTHEN=(WHEN=INIT,OVERLAY=(16:X,18:X,20:X,22:X)),
    IFTHEN=(WHEN=(27,1,CH,EQ,C'1'),OVERLAY=(16:28,1),HIT=NEXT),
    IFTHEN=(WHEN=(27,1,CH,EQ,C'2'),OVERLAY=(18:28,1),HIT=NEXT),
    IFTHEN=(WHEN=(27,1,CH,EQ,C'3'),OVERLAY=(20:28,1),HIT=NEXT),
    IFTHEN=(WHEN=(27,1,CH,EQ,C'4'),OVERLAY=(22:28,1),HIT=NEXT),
    IFTHEN=(WHEN=(29,1,CH,EQ,C'1'),OVERLAY=(16:30,1),HIT=NEXT),
    IFTHEN=(WHEN=(29,1,CH,EQ,C'2'),OVERLAY=(18:30,1),HIT=NEXT),
    IFTHEN=(WHEN=(29,1,CH,EQ,C'3'),OVERLAY=(20:30,1),HIT=NEXT),
    IFTHEN=(WHEN=(29,1,CH,EQ,C'4'),OVERLAY=(22:30,1),HIT=NEXT),
    IFTHEN=(WHEN=(31,1,CH,EQ,C'1'),OVERLAY=(16:32,1),HIT=NEXT),
    IFTHEN=(WHEN=(31,1,CH,EQ,C'2'),OVERLAY=(18:32,1),HIT=NEXT),
    IFTHEN=(WHEN=(31,1,CH,EQ,C'3'),OVERLAY=(20:32,1),HIT=NEXT),
    IFTHEN=(WHEN=(31,1,CH,EQ,C'4'),OVERLAY=(22:32,1),HIT=NEXT),
    IFTHEN=(WHEN=(33,1,CH,EQ,C'1'),OVERLAY=(16:34,1),HIT=NEXT),
    IFTHEN=(WHEN=(33,1,CH,EQ,C'2'),OVERLAY=(18:34,1),HIT=NEXT),
    IFTHEN=(WHEN=(33,1,CH,EQ,C'3'),OVERLAY=(20:34,1),HIT=NEXT),
    IFTHEN=(WHEN=(33,1,CH,EQ,C'4'),OVERLAY=(22:34,1))
/*
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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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