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

To merge a part of repeated records while combining other pa


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Sun Aug 26, 2007 8:47 pm
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
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 Developer


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

PostPosted: Mon Aug 27, 2007 9:37 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top