Removing Dups, select last date/time



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Re: Removing Dups, select last date/time

Postby BillyBoyo » Fri Jan 13, 2012 2:47 am

Peter,

Tested with your sample, plus did lots of Rs of the lines in the editor, only got the right ones coming out (only one 7 appears).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Re: Removing Dups, select last date/time

 

Re: Removing Dups, select last date/time

Postby Peter_Mann » Fri Jan 13, 2012 3:14 am

Billy, Very cool!, I do the same RR RR while testing, thanks so much, I got your code, didn't get time to test yet, I'll let you know how it works, again thanks
Peter
Peter_Mann
 
Posts: 139
Joined: Fri Jun 24, 2011 7:37 pm
Location: Lowell,AR
Has thanked: 14 times
Been thanked: 3 times

Re: Removing Dups, select last date/time

Postby BillyBoyo » Fri Jan 13, 2012 4:46 am

This is another way to do the Sort cards, using symbols.
//SORTJOB EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYMNOUT  DD SYSOUT=*
//SYMNAMES DD *
INPUT-RECORD,1,80,CH
FIRST-BYTE-AFTER-INPUT,*,1,CH
EXTENDED-SEQUENCE-NO,=,5,ZD
JOB-NAME,11,8,CH
START-DATE-TIME,29,14,CH
POSITION,START-DATE-TIME
START-DATE-DD,*,2,CH
SKIP,1
START-DATE-MM,*,2,CH
SKIP,1
START-DATE-YY,*,2,CH
SKIP,1
START-TIME,*,5,CH
VALUE-INDICATING-FIRST-OF-SEQUENCE,1
//SYSIN   DD *
 SORT FIELDS=(JOB-NAME,A,
              START-DATE-YY,D,
              START-DATE-MM,D,
              START-DATE-DD,D,
              START-TIME,D),
              EQUALS
                                             
  OUTREC IFTHEN=(WHEN=INIT,
                 OVERLAY=(FIRST-BYTE-AFTER-INPUT:SEQNUM,5,ZD,
                          RESTART=(JOB-NAME)))
                                             
  OUTFIL INCLUDE=(EXTENDED-SEQUENCE-NO,
                   EQ,VALUE-INDICATING-FIRST-OF-SEQUENCE),
                  BUILD=(INPUT-RECORD)
//SORTIN  DD *
 DSUT1000 DSUT1000 0003908 01/01/12-00:01  01/01/12-00:01 CTM-CONTROL
 DSUT1001 DSUT1001 0003909 01/01/12-00:01  01/01/12-00:01 CTM-CONTROL
 DSUT1002 DSUT1002 0003914 01/01/12-00:01  01/01/12-00:01 CTM-CONTROL
 DSUT1003 DSUT1003 0003915 01/01/12-00:01  01/01/12-00:01 CTM-CONTROL
 DSUT1007 DSUT1007 0003912 01/01/12-00:01  01/01/12-00:01 CTO-CONTROL
 DSUT1007 DSUT1007 0003913 01/01/12-00:01  01/01/12-00:01 CTO-CONTROL
 DSUT1008 DSUT1008 0003910 01/01/12-00:01  01/01/12-00:01 IOA-CONTROL
 DSUT1004 DSUT1004 0003911 01/01/12-00:01  01/01/12-00:01 IOA-CONTROL
//SORTOUT DD SYSOUT=*
//SYSOUT  DD SYSOUT=*



There are multiple advantages of the symbols defined on the SYMNAMES DD. With the symbols, you can make the logic much clearer. If you have a date like that on a similar report/file you don't have to code out the individual parts each time, just use the symbols and change the start position of the 14-byte date. When "extending" a record, you don't have to think of the positions, just code like above, etc.

The SYMNOUT DD will show the original symbols and how they have been expressed as a SYMBOL TABLE. The SYMBOL TABLE is used to replace the symbols in all the sort cards. The sort output messages includes the sort cards converted to the "classic" annotation.

The is the SYMNOUT output:

------- ORIGINAL STATEMENTS FROM SYMNAMES -------
INPUT-RECORD,1,80,CH                             
FIRST-BYTE-AFTER-INPUT,*,1,CH                     
EXTENDED-SEQUENCE-NO,=,5,ZD                       
JOB-NAME,11,8,CH                                 
START-DATE-TIME,29,14,CH                         
POSITION,START-DATE-TIME                         
START-DATE-DD,*,2,CH                             
SKIP,1                                           
START-DATE-MM,*,2,CH                             
SKIP,1                                           
START-DATE-YY,*,2,CH                             
SKIP,1                                           
START-TIME,*,5,CH                                 
VALUE-INDICATING-FIRST-OF-SEQUENCE,1             
                                                 
------------------ SYMBOL TABLE -----------------
INPUT-RECORD,1,80,CH                             
FIRST-BYTE-AFTER-INPUT,81,1,CH                   
EXTENDED-SEQUENCE-NO,81,5,ZD                     
JOB-NAME,11,8,CH                                 
START-DATE-TIME,29,14,CH                         
START-DATE-DD,29,2,CH                             
START-DATE-MM,32,2,CH                             
START-DATE-YY,35,2,CH                             
START-TIME,38,5,CH                               
VALUE-INDICATING-FIRST-OF-SEQUENCE,1             


And the translated sort cards:

  SORT FIELDS=(11,8,CH,A,35,2,CH,D,32,2,CH,D,29,2,CH,D,38,5,CH,D),EQUALS*
                                                                       
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,5,ZD,RESTART=(11,8)))     
  OUTFIL INCLUDE=(81,5,ZD,EQ,1),BUILD=(1,80)                             


As well as making your own symbols, you can also find pre-defined symbols for things like SMF, DCOLLECT etc which might be useful to you :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Removing Dups, select last date/time

Postby Peter_Mann » Fri Jan 13, 2012 8:12 pm

Billy, after I tried your code with my data, and it worked so well, I wanted to follow up and ask you this exact question about the field names(SYMBOLS) and how to use them, I found these in another post, but since I didn't understand the code, I figured I'd use what I know. your last post, is right on :) you've made the code very easy to understand.
All I need to do now is remove some fields from the output and add my header statements back in, again thanks so much for your time and efforts, I really appriciate it.
Peter
Peter_Mann
 
Posts: 139
Joined: Fri Jun 24, 2011 7:37 pm
Location: Lowell,AR
Has thanked: 14 times
Been thanked: 3 times

Re: Removing Dups, select last date/time

Postby BillyBoyo » Fri Jan 13, 2012 8:39 pm

No problem, glad it helped. I really like the symbols. Once defined (which takes longer than just typing 11,8,CH) they save time and reduce errors, as well as improving the understanding.

As you know, if you have further questions, there's usually someone around.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Previous

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post