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 

Trailer count without any duplicates

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


Joined: 14 Jul 2006
Posts: 5
Topics: 3

PostPosted: Thu Sep 13, 2007 6:26 am    Post subject: Trailer count without any duplicates Reply with quote

Hi,

I have a file with Header, Detail and Trailer records. The file is having a length of 200 and is fixed block

The records looks as below:
A20070810
B12343567
B23456789
B34567890
B12343567
C2007081000004

The record starting with 'A' represents Header, B represents the detail records and C represents the Trailer.

The C record is having the number of count of detail records.

Using sort we need to remove the duplicates in detail records. After the duplicates are removed, the C records should be updated with the new count of detail records.

Please suggest, if this can be achieved using sort
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Thu Sep 13, 2007 6:31 am    Post subject: Reply with quote

check the below link

http://www.mvsforums.com/helpboards/viewtopic.php?t=4342&highlight=update+record+count
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Sep 13, 2007 11:12 am    Post subject: Reply with quote

king,

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

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/200)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  INCLUDE COND=(1,1,CH,EQ,C'C')
  INREC BUILD=(C'TRL,''',1,9,C'''',80:X)
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file (FB/200)
//SORTOUT DD DSN=...  output file (FB/200)
//SYSIN    DD    *
  OMIT COND=(1,1,CH,EQ,C'C')
  SORT FIELDS=(1,9,CH,A)
  SUM FIELDS=NONE
  OUTFIL REMOVECC,
    TRAILER1=(TRL,COUNT-1=(M11,LENGTH=5))
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort


Last edited by Frank Yaeger on Thu Sep 13, 2007 1:35 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Sep 13, 2007 12:36 pm    Post subject: Reply with quote

kingmakerofindia,

The following 1 step DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD *                                   
A20070810                                         
B12343567                                         
B23456789                                         
B34567890                                         
B12343567                                         
C2007081000004                                   
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *
 OPTION EQUALS                                   
 SORT FIELDS=(1,9,CH,A)                           
                                                 
 SUM FIELDS=NONE                                 
                                                 
 OUTREC IFTHEN=(WHEN=(1,1,SS,EQ,C'B,C'),         
       OVERLAY=(201:SEQNUM,5,ZD,START=0,INCR=1)) 
                                                 
 OUTFIL IFOUTLEN=200,                             
        IFTHEN=(WHEN=(1,1,CH,EQ,C'C'),           
       OVERLAY=(10:201,5))                       
/*                       


Hope this helps...

Cheers

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


Joined: 14 Jul 2006
Posts: 5
Topics: 3

PostPosted: Tue Sep 18, 2007 3:59 am    Post subject: Reply with quote

Thanks kolusu and Frank. With your help the solution is established. Smile

Thanks Again,
Kingmakerofindia
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