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

Need help in sequence number for removing column duplicates


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

New User


Joined: 24 Jul 2006
Posts: 35
Location: india

PostPosted: Mon Jan 23, 2012 6:57 am
Reply with quote

Hi.

I am trying to remove column duplicates by giving sequence number and reformatting based on that.

INREC BUILD=(1,8,X,10,119,X,131:SEQNUM,3,ZD,RESTART=(1,8))
SORT FIELDS=(1,8,CH,A)
OUTREC IFTHEN=(WHEN=(133,1,ZD,EQ,1),BUILD=(1,133)),
IFTHEN=(WHEN=(133,1,ZD,NE,1),OVERLAY=(1:9X,10:10,124))

This is the code I am using.The problem is that the sequence number is not coming properly so the result is not coming as expected.Could anyone help on this?
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Mon Jan 23, 2012 9:26 am
Reply with quote

Hi jemonthomas,

As per you sort card the sequence number starts from 131 position but you are validating only 133 position . Please use below mentioned sort card and validate your result.

Code:

INREC BUILD=(1,8,X,10,119,X,131:SEQNUM,3,ZD,START=1,INCR=1,RESTART=(1,8))
SORT FIELDS=(1,8,CH,A)
OUTREC IFTHEN=(WHEN=(131,3,ZD,EQ,1),BUILD=(1,133)),
IFTHEN=(WHEN=(131,3,ZD,NE,1),OVERLAY=(1:9X,10:10,124))




Thanks
Sai
Back to top
View user's profile Send private message
jemonthomas

New User


Joined: 24 Jul 2006
Posts: 35
Location: india

PostPosted: Mon Jan 23, 2012 11:07 am
Reply with quote

Hi saiprasadh

Thanks.But still I am facing the same issue.The sequence number is getting restarted from 1 eventhough the key is not changed.I need to restart the sequence number only if the key is changed which is first 8 bytes.Could you please help on this?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Mon Jan 23, 2012 1:13 pm
Reply with quote

If you are using INREC to put your sequence number on, then it is the unsorted file that you are using - which is the reason you notice something is not working. Change it so that it is with the OUTREC,

As saiprasadh has pointed out, you are not looking at the whole seqence number. This will cause you to think that every 10th record is a "new" sequence.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon Jan 23, 2012 9:48 pm
Reply with quote

Jemonthomas,

As bill explained your INREC is processed before the SORT. So if your data is unsorted on the Key , then your Sequence number will not be correct.

Check this link which explains how DFSORT process the control cards.

DFSORT Processing

Use the following Control cards which will give you the desired results. I assumed that your input is FB 133 byte

Code:

//SYSIN    DD *                                               
  SORT FIELDS=(1,8,CH,A),EQUALS                               
  OUTREC IFOUTLEN=133,                                         
  IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,3,ZD,RESTART=(1,8))), 
  IFTHEN=(WHEN=(134,3,ZD,GT,1),OVERLAY=(9X))                   
//*
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts How to load to DB2 with column level ... DB2 6
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top