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

update the trailer count while eliminating duplicates


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sant532

New User


Joined: 02 Jun 2008
Posts: 48
Location: India

PostPosted: Thu Aug 25, 2011 1:34 pm
Reply with quote

I have requirement to delete the duplicates from a file and while deleting duplicates we need to update the trailer record count.

Below is the input file before eliminating dups

AISCDCHNG2011-08-24 -----header
D010004M
D010004M
D010004M
D010004M
D010004M
D010005A
D010006M
D010007M
D010008M
D010008M
D010008M
D010008M
D010008M
D010008M
D010009M
Z0000000015 ----trailer with count as 15 records


after sort my expected results should be as

***************************** Top
AISCDCHNG2011-08-24
D010004M
D010005A
D010006M
D010007M
D010008M
D010009M
Z0000000006
**************************** Bott
header shoul come as it is, and triler should update with new count.
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: Thu Aug 25, 2011 1:39 pm
Reply with quote

Have a look through the forum, there are many trailer-update examples and dropping-duplicate examples.

While you are "dropping" them, is anything "catching" them, or do they just disappear off to some recycle-bing in the sky? If the data on the duplicate records doesn't mean anything, why were the records generated in the first place?
Back to top
View user's profile Send private message
THINKSRINIII
Warnings : 1

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Thu Aug 25, 2011 2:45 pm
Reply with quote

Can you please provide the details whether the file is FB/VB and RECFM etc.
Back to top
View user's profile Send private message
sant532

New User


Joined: 02 Jun 2008
Posts: 48
Location: India

PostPosted: Thu Aug 25, 2011 2:55 pm
Reply with quote

input/output both are FB only,

Record formate is FB
Record length is 50 bytes
Structure is

Header record stat with 'H' and 49 bytes data
Details record start with 'D' and 49 bytes data
trailer record start with 'Z' and 10 byte count and 39 byte spaces

and eliminated duplicate need not to capture in any file.

I need to achive this requirment in one step only. could you please help me here.
Back to top
View user's profile Send private message
THINKSRINIII
Warnings : 1

New User


Joined: 09 Jan 2009
Posts: 88
Location: India

PostPosted: Thu Aug 25, 2011 3:00 pm
Reply with quote

The following would achieve the same :

Code:

//SORTOUT  DD DSN=&&TEMP,DISP=(,PASS,DELETE)               
//TOOLIN   DD *                                           
  SELECT FROM(SORTIN) TO(SORTOUT) ON(1,8,CH) NODUPS       
//STEP02 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DSN=&&TEMP,DISP=SHR                         
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                           
  OPTION COPY                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY(81:SEQNUM,10,ZD)),       
        IFTHEN=(WHEN=(1,1,CH,EQ,C'Z'),OVERLAY(2:81,10))   
  OUTREC BUILD=(1:1,50)                                   


Use sum fields= none to remove duplicates and convert the job to one step.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 25, 2011 3:06 pm
Reply with quote

Hi,There are several ways and several examples too on this forum doing similar thing...

You can use DFSORTs TRLUPD feature for this
Code:

//STEP0100 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD DSN=yourinputfilehere                                       
//SORTOUT  DD DSN=youroutputfilehere
//SYSIN    DD *                                     
 SORT FIELDS=(1,1,CH,A,2,7,CH,A)                     
 SUM FIELDS=(NONE)                                   
 OUTFIL IFTRAIL=(HD=YES,TRLID=(1,1,CH,EQ,C'Z'),     
 TRLUPD=(2:COUNT=(M11,LENGTH=10)))                   
/*                                             
     

This will give you required output as below...

Code:

AISCDCHNG2011-08-24 -----HEADER   
D010004M                         
D010005A                         
D010006M                         
D010007M                         
D010008M                         
D010009M                         
Z0000000006 ----TRAILER WITH COUNT
Back to top
View user's profile Send private message
sant532

New User


Joined: 02 Jun 2008
Posts: 48
Location: India

PostPosted: Thu Aug 25, 2011 3:09 pm
Reply with quote

Could you please tell me, on your post does it keeps header as it is?

Can you give the complete syntax, with some example.
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: Thu Aug 25, 2011 3:11 pm
Reply with quote

sant532 wrote:
[...]

and eliminated duplicate need not to capture in any file.

I need to achive this requirment in one step only. could you please help me here.


I cannot understand either of these points.

How can you have data in your system which you just leave abandoned on the computer-room floor? What do you do, one day, when someone asks about that particular data? Or a part of it?

Imagine this. You have a bug. You get duplicate records. You fix the bug. Throw away the duplicates. A couple of months later, you get a query. You look at the data, query doesn't seem to make sense. You get another. Same thing. Another few over the next months. Never solved.

Or

Same thing, but you realise the date of the transactions is the same, and that particular date rings a bell. You check further with this extra knowledge, and realise that the "fix" was just not quite right... Now what? Restore and re-run to three months ago to get the data to drop it off, but to a file this time, to check to see if it gives you anything...

Or

Same thing, but you check against your log of data fixes, check the audit trails, files, work out the problem, do a new, more thorough, impact analysis, inform everyone, organise the restoration of the five records which were genuinely "duplicate" etc etc. You even have sign-offs that you were not the only one who missed picking up the different scenario hived-off in error.

For this requirement, I'm sure one step is not a problem. If it were though, what are your "rules" for "one step"? An idiotic "ban" or a "huge input file" or something else reasonable?
Back to top
View user's profile Send private message
sant532

New User


Joined: 02 Jun 2008
Posts: 48
Location: India

PostPosted: Thu Aug 25, 2011 3:43 pm
Reply with quote

This is what in my spool shows.

Code:
********************************* TOP OF DATA **********************************
 SYNCSORT FOR Z/OS  1.3.2.1R    U.S. PATENTS: 4210961, 5117495   (C) 2007 SYNCSO
                                                       z/OS   1.11.0           
 SYSIN :                                                                       
  SORT FIELDS=(1,1,CH,A,2,7,CH,A)                                        0023000
  SUM FIELDS=(NONE)                                                      0024000
  OUTFIL IFTRAIL=(HD=YES,TRLID=(1,1,CH,EQ,C'Z'),                         0025000
         *                                                                     
  TRLUPD=(2:COUNT=(M11,LENGTH=10)))                                      0026000
 WER903I  SYNCSORT 1.3.2.1 IS NOT LICENSED FOR SERIAL B8A36, TYPE 2817 723, LPAR
 WER903I  PRODUCT WILL STOP WORKING IN  43 DAYS UNLESS A VALID KEY IS INSTALLED.
 WER268A  OUTFIL STATEMENT  : SYNTAX ERROR                                     
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Aug 25, 2011 3:44 pm
Reply with quote

See :

www.ibmmainframes.com/viewtopic.php?t=33385&highlight=dss10065e
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: Thu Aug 25, 2011 11:19 pm
Reply with quote

sant532,

IFTRAIL works fine with DFSORT. However, the WER messages indicate you have Syncsort rather than DFSORT. Syncsort does NOT support IFTRAIL.

This Forum is for DFSORT questions. The JCL Forum is for Syncsort questions. I'm moving this topic to the JCL Forum.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Sun Aug 28, 2011 6:24 pm
Reply with quote

sant532,

As Bill had already suggested above, what you're trying to do is definitely doable using Syncsort in one step or 2 steps or whatever.

But it'd would be worth doing a trace back on how this duplicates came into your system and the relevance of duplicate records if there is any.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts Insert trailer for non empty file only DFSORT/ICETOOL 6
Search our Forums:

Back to Top