MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Remove Duplicates and Update the Trailer Count

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Wed Aug 30, 2017 5:31 pm    Post subject: Remove Duplicates and Update the Trailer Count Reply with quote

Hi,

Example : Modified input after INREC BUILD.

Code:

RDW.AD12345
RDW.BD1234567
RDW.0T1234568


IF i have

Code:

OUTFIL INCLUDE COND=(5,1,CH,NE,C'A'),BUILD=(1,4,6),


If i use Iftrail here, i should consider the position before build, then how do i eleminate the 5th byte in the trailer record ?

Thanks
Magesh
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12357
Topics: 75
Location: San Jose

PostPosted: Thu Aug 31, 2017 11:42 am    Post subject: Reply with quote

Magesh_J,

For IFTRAIL, the trailer record will not be treated as a data record; all other OUTFIL processing (for example, INCLUDE, OMIT, BUILD, OVERLAY, and so on) will be bypassed for the trailer record. The updated count and total values will not include the trailer record.

So in essence IFTRAIL should be referring to the ORIGINAL record.

If you explain what you trying to do with IFTRAIL, then there may be other ways to incorporate what you want to do.
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Thu Aug 31, 2017 12:37 pm    Post subject: Reply with quote

Example :

Code:

00
Magesh
Suresh
Hari
Hari
9(Count is in pos 2 length 4 in PD)


I need to remove duplicate records completly and update the count, it is a vb file.
Code:

00
Magesh
Suresh
9(Count is in pos 2 length 4 in PD)


Code i tried, appears working

Code:

OPTION VLSHRT                                                     
INREC IFTHEN=(WHEN=INIT,
              BUILD=(1,4,9X,5)),
                         
      IFTHEN=(WHEN=(14,1,CH,EQ,C'0'),
              OVERLAY=(5:C'000000001')),
   
      IFTHEN=(WHEN=(14,1,CH,EQ,C'9'),
              OVERLAY=(5:C'200000001')),
   
      IFTHEN=(WHEN=NONE,
              OVERLAY=(5:C'100000001'))
                 
SORT FIELDS=(05,1,CH,A,
             14,9,CH,A)                                   

SUM FIELDS=(6,8,ZD)                                               

OUTREC IFTHEN=(WHEN=(14,1,CH,EQ,C'9'),
               OVERLAY=(5:14,5,9X))
         
OUTFIL INCLUDE=(6,8,ZD,LE,1),
       OUTREC=(1,4,14),                     
       IFTRAIL=(TRLID=(5,1,CH,EQ,C'9'),                           
                TRLUPD=(6:COUNT-1=(PD,LENGTH=4)))                 


If dfsort allow below way of coding, then no need for additinal OUTREC BUILD
Code:

TRLUPD=(5:14,1,6:COUNT-1=(PD,LENGTH=4),10:9X))   


Thanks
Magesh
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12357
Topics: 75
Location: San Jose

PostPosted: Thu Aug 31, 2017 4:20 pm    Post subject: Reply with quote

Magesh_J,

I am not sure as to why you complicate a simple request. If your goal is just to remove duplicate records, then it is quite easy. Use SELECT operator with NODUPS to get unique records. And if you want to retain the header and trailer in their original place, use ALTSEQ to override their values.


Code:

//STEP0100 EXEC PGM=ICETOOL                                     
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//IN       DD DISP=SHR,DSN=Your Input VB file
//OUT      DD SYSOUT=*                                           
//TOOLIN   DD *                                                 
  SELECT FROM(IN) TO(OUT) ON(5,9,CH) NODUPS USING(CTL1)         
//CTL1CNTL DD *                                                 
  ALTSEQ  CODE=(F000,F9FF)  CHANGE '0' TO X'00' AND '9' TO X'FF'

  SORT FIELDS=(5,1,AQ,A,                                         
               6,8,CH,A)                                         
                                                                 
  OUTFIL IFTRAIL=(TRLID=(5,1,CH,EQ,C'9'),                       
                  TRLUPD=(6:COUNT-1=(PD,LENGTH=4)))             
/*


Alternatively if you don't care about the header and trailer simply OMIT them and create them after using header1 and trailer1. Simply change the CTL1CNTL to the following.

Code:

//CTL1CNTL DD *                           
  OMIT COND=(5,2,CH,EQ,C'00',OR,           
             5,1,CH,EQ,C'9')               
                                           
  OUTFIL REMOVECC,                         
  HEADER1=(C'00'),                         
  TRAILER1=(C'9',COUNT=(PD,LENGTH=4))     
/*

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Thu Aug 31, 2017 9:10 pm    Post subject: Reply with quote

Hi Kolusu,

Thanks for the solution.

kolusu wrote:

I am not sure as to why you complicate a simple request.


Code:

ALTSEQ  CODE=(F000,F9FF)  CHANGE '0' TO X'00' AND '9' TO X'FF'


bonk bonk



Regards,
Magesh
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12357
Topics: 75
Location: San Jose

PostPosted: Fri Sep 01, 2017 10:38 am    Post subject: Reply with quote

Magesh_J wrote:
Hi Kolusu,

Thanks for the solution.
bonk bonk

Regards,
Magesh


Magesh_J,

You do realize that ALTSEQ does NOT actually change the data, the change is applied ONLY to the sorting and the input stays the same?
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Sun Sep 03, 2017 11:13 pm    Post subject: Reply with quote

kolusu wrote:
Magesh_J wrote:
Hi Kolusu,

Thanks for the solution.
bonk bonk

Regards,
Magesh


Magesh_J,

You do realize that ALTSEQ does NOT actually change the data, the change is applied ONLY to the sorting and the input stays the same?


Yes.

Thanks
Magesh
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group