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

Syncsort - Remove Duplicates until encountering a '('


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

New User


Joined: 08 Aug 2008
Posts: 19
Location: Chennai

PostPosted: Tue Sep 16, 2008 3:17 am
Reply with quote

Hi All,

I am using the following JCL to remove the duplicates.

//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=TST01.TUSER.INFILE
//SORTOUT DD DSN= TST01.TUSER.OUTFILE,
// UNIT=DISK,DISP=(,CATLG,DELETE),
// DCB=(RECFM=FB,LRECL=133,BLKSIZE=0),
// SPACE=(CYL,(1,5),RLSE)
//SORTWK01 DD UNIT=DISK,SPACE=(CYL,100)
//SORTWK02 DD UNIT=DISK,SPACE=(CYL,100)
//SYSIN DD *
SORT FIELDS=(10,25,A),FORMAT=CH
INCLUDE COND=(3,5,CH,EQ,C'TSTIN')
SUM FIELDS=NONE
/*


SortIn / SortOut file definition’s for the above JCL:

Organization . . . : PS
Record format . . . : FB
Record length . . . : 133
Block size . . . . : 27930


ON THE BELOW EXAMPLES THE EACH ASTRIC ‘*’ IS A BLANK SPACE. JUST FOR READABILITY I HAD PUT IT DOWN.

Input file:

123456789012345678901234567890123456789012345678901234567890
__3___7__0_________0_________0____5______________________133
**TSTIN**TEST01.FEED.FILE(-1)
**TSTIN**TEST01.FEED.FILE(-8)
**TSTIN**TEST01.FEED.FILE(0)
**TSTIN**TEST01.FEED.FILE(-4)
**TSTIN**TEST01.OUT1.FILE001(-1)
**TSTIN**TEST01.OUT1.FILE001(-1)
**TSTIN**TEST01.OUT2.FILE(-1)

Required Output:

123456789012345678901234567890123456789012345678901234567890
__3___7__0_________0_________0____5______________________133
**TSTIN**TEST01.FEED.FILE(-4)
**TSTIN**TEST01.OUT1.FILE001(-1)
**TSTIN**TEST01.OUT2.FILE(-1)


As according to the sysin parameters supplied on the above JCL the syncsort considers the version limit like (-1), (-8) etc., after every dataset and the present output file looks like below.

123456789012345678901234567890123456789012345678901234567890
__3___7__0_________0_________0____5______________________133
**TSTIN**TEST01.FEED.FILE(-1)
**TSTIN**TEST01.FEED.FILE(-8)
**TSTIN**TEST01.FEED.FILE(0)
**TSTIN**TEST01.FEED.FILE(-4)
**TSTIN**TEST01.OUT1.FILE001(-1)
**TSTIN**TEST01.OUT2.FILE(-1)

But the first 4 records has a redundant datasets, irrespective of the different values in ‘()’. My requirement is sort the input file for all rows between columns 10+25, for each column position, the sort should consider the text before '(' only.


This way i can exclude redundant datasets. I welcome any suggestions.


Regards,
Jai
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Sep 16, 2008 10:51 am
Reply with quote

vjai6977,

If you have Syncsort for z/OS Release 1.3 , you could use the PARSE statement to achieve this. Do a forum Search for more examples.

http://ibmmainframes.com/viewtopic.php?t=25044

Thanks,
Arun
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Tue Sep 16, 2008 12:17 pm
Reply with quote

Quote:

If you have Syncsort for z/OS Release 1.3 ,

Hi Arun, am not aware of but is PARSE is available for Syncsort you mentioned as PARSE doesnt work on Syncsort i have icon_question.gif icon_question.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Sep 16, 2008 1:01 pm
Reply with quote

Hello,

PARSE will definitely work if you have Syncsort for z/OS Release 1.3 which is the latest release of Syncsort.

Thanks,
Arun
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Tue Sep 16, 2008 1:18 pm
Reply with quote

HI,

The following sort card will give u solution. And i assumed that maximum length of file name including '**TSTIN**' is 50. U can change as ur requirement.

Code:

//JSTP0010 EXEC PGM=SORT                                               
//SORTIN   DD  DSN=DEV2.RK.TEST(@@CASE),                               
//             DISP=SHR                                               
//SORTOUT  DD  DSN=DEV2.RK.TEST(@@CASE1),                             
//             DISP=SHR                                               
//SORTWK01 DD  UNIT=SYSDA,SPACE=(CYL,20)                             
//SYSOUT   DD SYSOUT=*                                                 
//SYSUDUMP DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
    INCLUDE COND=(3,5,CH,EQ,C'TSTIN')                                 
    INREC PARSE=(%01=(ENDBEFR=C'(',FIXLEN=50)), 
      BUILD=(%01)                                                     
    SORT FIELDS=(1,20,CH,A)                                           
    SUM FIELDS=NONE                                                   
//*                                                                   


Input file:
Code:

**TSTIN**TEST01.FEED.FILE(-1)         
**TSTIN**TEST01.FEED.FILE(-8)         
**TSTIN**TEST01.FEED.FILE(0)         
**TSTIN**TEST01.FEED.FILE(-4)         
**TSTIN**TEST01.OUT1.FILE001(-1)     
**TSTIN**TEST01.OUT1.FILE001(-1)     
**TSTIN**TEST01.OUT2.FILE(-1)         


Output file:
Code:

**TSTIN**TEST01.FEED.FILE       
**TSTIN**TEST01.OUT1.FILE001     
**TSTIN**TEST01.OUT2.FILE           


Regards
R KARTHIK
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Tue Sep 16, 2008 1:20 pm
Reply with quote

Hi,

Change

SORT FIELDS=(1,20,CH,A)

to

SORT FIELDS=(1,50,CH,A)

Regards
R KARTHIK
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Sep 16, 2008 1:33 pm
Reply with quote

karthikr44,

Did you have a look at the output records posted in the original requirement. I believe you need to modify he card to something like this.
I cant test this now as I dont have the recent version of SYNCSORT icon_sad.gif
Code:
//SYSIN    DD *                                                       
    INCLUDE COND=(3,5,CH,EQ,C'TSTIN')                                 
    INREC PARSE=(%01=(ENDBEFR=C'(',FIXLEN=50)), 
      BUILD=(1,133,%01)                                                     
    SORT FIELDS=(134,50,CH,A)                                           
    SUM FIELDS=NONE
    OUTREC BUILD=(1,133)       

Thanks,
Arun
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Tue Sep 16, 2008 2:32 pm
Reply with quote

HI Arun,

Thanks for spotting the mistake. Ur code provides the following output....

Code:

**TSTIN**TEST01.FEED.FILE(-1)       
**TSTIN**TEST01.OUT1.FILE001(-1)     
**TSTIN**TEST01.OUT2.FILE(-1)       


Regards
R KARTHIK
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Sep 16, 2008 3:13 pm
Reply with quote

Quote:
If you have DFSORT installed at your shop

If I read it correctly, the OP is using SYNCSORT and NOT DFSORT.

Thanks,
Arun
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Tue Sep 16, 2008 3:35 pm
Reply with quote

Yes read correctly..
thats why i wrote "IF..." otherwise i wouldnt have icon_smile.gif icon_smile.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Sep 16, 2008 8:12 pm
Reply with quote

Hello,

There is no reason (even with qualification) to post a DFSORT code suggestion/reply to a Syncsort topic.

It has been removed. . .
Back to top
View user's profile Send private message
vjai6977

New User


Joined: 08 Aug 2008
Posts: 19
Location: Chennai

PostPosted: Tue Sep 16, 2008 10:24 pm
Reply with quote

Hi,

Thanks for the reply posts.

I tried to execute the solutions proposed by Karthik and sambhaji, either of resulted me on the following error message.

When Used for SORT:
SYSIN :
INCLUDE COND=(3,5,CH,EQ,C'TESTIN')
INREC PARSE=(%01=(ENDBEFR=C'(',FIXLEN=80)),
*
BUILD=(%01)
SORT FIELDS=(1,80,CH,A)
SUM FIELDS=NONE
WER901I **WARNING** SYNCSORT 1.2.3.1 WILL EXPIRE IN 77 DAYS
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


When Used for ICETOOL:

CTL1CNTL :
SORT FIELDS=COPY
INREC PARSE=(%00=(ABSPOS=10,FIXLEN=25,ENDBEFR=C'('),
*
%01=(FIXLEN=2,ENDBEFR=C')')),
BUILD=(1,9,%00,35:C'(',%01,JFY=(SHIFT=RIGHT),C')')
WER428I CALLER-PROVIDED IDENTIFIER IS "0001"
WER901I **WARNING** SYNCSORT 1.2.3.1 WILL EXPIRE IN 77 DAYS
WER268A INREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


Not too sure about this stuffs, I am using ICETOOL SPLICE for another operation and it works fine for me even now.

Any other suggestions for making the duplicate removal successful.

Regards,
Jai
Back to top
View user's profile Send private message
vjai6977

New User


Joined: 08 Aug 2008
Posts: 19
Location: Chennai

PostPosted: Tue Sep 16, 2008 10:42 pm
Reply with quote

my shop uses SYNCSORT for z/os version 1.2.3 , instead of using a parse stement is there any way to achieve the result.

Regars,
Jai
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 17, 2008 12:56 am
Reply with quote

Hello,

When your system renews the license that will expire soon, it might be a good time to upgrade to the current release of Syncsort. . . icon_wink.gif
Back to top
View user's profile Send private message
vjai6977

New User


Joined: 08 Aug 2008
Posts: 19
Location: Chennai

PostPosted: Wed Sep 17, 2008 4:49 am
Reply with quote

Hi,

I appreciate and recommend for that, but now I would like to get a solution on the current version issues. Any ideas that i can solve it for now. And latter can use the above mentioned solution if we our shop is installed with release 1.3 of syncsort icon_smile.gif

Regards,
Jai
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Sep 17, 2008 7:40 am
Reply with quote

Hi,

you can try something like this
Code:
 INCLUDE COND=(3,5,CH,EQ,C'TSTIN')                         
 SORT FIELDS=(81,44,BI,A)                                   
 SUM FIELDS=NONE                                           
 INREC IFTHEN=(WHEN=(11,1,CH,EQ,C'('),OVERLAY=(81:10,01)), 
       IFTHEN=(WHEN=(12,1,CH,EQ,C'('),OVERLAY=(81:10,02)), 
       IFTHEN=(WHEN=(13,1,CH,EQ,C'('),OVERLAY=(81:10,03)), 
       IFTHEN=(WHEN=(14,1,CH,EQ,C'('),OVERLAY=(81:10,04)), 
       IFTHEN=(WHEN=(15,1,CH,EQ,C'('),OVERLAY=(81:10,05)), 
       IFTHEN=(WHEN=(16,1,CH,EQ,C'('),OVERLAY=(81:10,06)), 
       IFTHEN=(WHEN=(17,1,CH,EQ,C'('),OVERLAY=(81:10,07)), 
       IFTHEN=(WHEN=(18,1,CH,EQ,C'('),OVERLAY=(81:10,08)), 
       IFTHEN=(WHEN=(19,1,CH,EQ,C'('),OVERLAY=(81:10,09)), 
       IFTHEN=(WHEN=(20,1,CH,EQ,C'('),OVERLAY=(81:10,10)), 
       IFTHEN=(WHEN=(21,1,CH,EQ,C'('),OVERLAY=(81:10,11)), 
       IFTHEN=(WHEN=(22,1,CH,EQ,C'('),OVERLAY=(81:10,12)), 
       IFTHEN=(WHEN=(23,1,CH,EQ,C'('),OVERLAY=(81:10,13)), 
       IFTHEN=(WHEN=(24,1,CH,EQ,C'('),OVERLAY=(81:10,14)), 
       IFTHEN=(WHEN=(25,1,CH,EQ,C'('),OVERLAY=(81:10,15)), 
       IFTHEN=(WHEN=(26,1,CH,EQ,C'('),OVERLAY=(81:10,16)),   
       IFTHEN=(WHEN=(27,1,CH,EQ,C'('),OVERLAY=(81:10,17)),   
       IFTHEN=(WHEN=(28,1,CH,EQ,C'('),OVERLAY=(81:10,18)),   
       IFTHEN=(WHEN=(29,1,CH,EQ,C'('),OVERLAY=(81:10,19)),   
       IFTHEN=(WHEN=(30,1,CH,EQ,C'('),OVERLAY=(81:10,20)),   
       IFTHEN=(WHEN=(31,1,CH,EQ,C'('),OVERLAY=(81:10,21)),   
       IFTHEN=(WHEN=(32,1,CH,EQ,C'('),OVERLAY=(81:10,22)),   
       IFTHEN=(WHEN=(33,1,CH,EQ,C'('),OVERLAY=(81:10,23)),   
       IFTHEN=(WHEN=(34,1,CH,EQ,C'('),OVERLAY=(81:10,24)),   
       IFTHEN=(WHEN=(35,1,CH,EQ,C'('),OVERLAY=(81:10,25)),   
       IFTHEN=(WHEN=(36,1,CH,EQ,C'('),OVERLAY=(81:10,26)),   
       IFTHEN=(WHEN=(37,1,CH,EQ,C'('),OVERLAY=(81:10,27)),   
       IFTHEN=(WHEN=(38,1,CH,EQ,C'('),OVERLAY=(81:10,28)),   
       IFTHEN=(WHEN=(39,1,CH,EQ,C'('),OVERLAY=(81:10,29)),   
       IFTHEN=(WHEN=(40,1,CH,EQ,C'('),OVERLAY=(81:10,30)),   
       IFTHEN=(WHEN=(41,1,CH,EQ,C'('),OVERLAY=(81:10,31)),   
       IFTHEN=(WHEN=(42,1,CH,EQ,C'('),OVERLAY=(81:10,32)),   
       IFTHEN=(WHEN=(43,1,CH,EQ,C'('),OVERLAY=(81:10,33)),   
       IFTHEN=(WHEN=(44,1,CH,EQ,C'('),OVERLAY=(81:10,34)),   
       IFTHEN=(WHEN=(45,1,CH,EQ,C'('),OVERLAY=(81:10,35)),       
       IFTHEN=(WHEN=(46,1,CH,EQ,C'('),OVERLAY=(81:10,36)),       
       IFTHEN=(WHEN=(47,1,CH,EQ,C'('),OVERLAY=(81:10,37)),       
       IFTHEN=(WHEN=(48,1,CH,EQ,C'('),OVERLAY=(81:10,38)),       
       IFTHEN=(WHEN=(49,1,CH,EQ,C'('),OVERLAY=(81:10,39)),       
       IFTHEN=(WHEN=(50,1,CH,EQ,C'('),OVERLAY=(81:10,40)),       
       IFTHEN=(WHEN=(51,1,CH,EQ,C'('),OVERLAY=(81:10,41)),       
       IFTHEN=(WHEN=(52,1,CH,EQ,C'('),OVERLAY=(81:10,42)),       
       IFTHEN=(WHEN=(53,1,CH,EQ,C'('),OVERLAY=(81:10,43)),       
       IFTHEN=(WHEN=(54,1,CH,EQ,C'('),OVERLAY=(81:10,44))       
       OUTREC BUILD=(1,80)                                       
/*                                                               



Gerry
Back to top
View user's profile Send private message
vjai6977

New User


Joined: 08 Aug 2008
Posts: 19
Location: Chennai

PostPosted: Fri Oct 10, 2008 5:18 pm
Reply with quote

For the above SYSIN parameters i am able to get the result. Thanks for the suggestions.

--> One issue I am facing is I am not getting the results as given in the below example post sort results.

--> The result i am obtaining is not maintaining the input order and the rows gets jumbled, this is because we use the sort card
SORT FIELDS=(81,44,BI,A) I tried altering the sort parameter and was not able to achieve the required result. This result i need for cross mapping purpose, and if the post sort is jumbled (not as mentioned in the below required output) the next match step fails for me.

Kindly suggest any changes on the above SYSIN parameters to obtain the below required outputs.


ON THE BELOW EXAMPLES THE EACH ASTRIC ‘*’ IS A BLANK SPACE. JUST FOR READABILITY I HAD PUT IT DOWN.

Input file:

123456789012345678901234567890123456789012345678901234567890
__3___7__0_________0_________0____5______________________133
**TSTIN**TEST01.FEED.F1
**TSTIN**TEST01.FEED.F2
**TSTIN**TEST01.FEED.F3
**TSTIN**TEST01.FEED.F4
**TSTIN**TEST01.FEED.FILE(-1)
**TSTIN**TEST01.FEED.P1
**TSTIN**TEST01.FEED.P2
**TSTIN**TEST01.FEED.P3
**TSTIN**TEST01.FEED.FILE(-8)
**TSTIN**TEST01.FEED.FILE(0)
**TSTIN**TEST01.FEED.FILE(-4)
**TSTIN**TEST01.OUT1.FILE001(-1)
**TSTIN**TEST01.FEED.K1
**TSTIN**TEST01.FEED.K2
**TSTIN**TEST01.FEED.K3
**TSTIN**TEST01.OUT1.FILE001(-1)
**TSTIN**TEST01.OUT2.FILE(-1)
**TSTIN**TEST01.FEED.M1
**TSTIN**TEST01.FEED.M2
**TSTIN**TEST01.FEED.M3


Required Output:

123456789012345678901234567890123456789012345678901234567890
__3___7__0_________0_________0____5______________________133
**TSTIN**TEST01.FEED.F1
**TSTIN**TEST01.FEED.F2
**TSTIN**TEST01.FEED.F3
**TSTIN**TEST01.FEED.F4
**TSTIN**TEST01.FEED.FILE(-4)
**TSTIN**TEST01.FEED.P1
**TSTIN**TEST01.FEED.P2
**TSTIN**TEST01.FEED.P3
**TSTIN**TEST01.OUT1.FILE001(-1)
**TSTIN**TEST01.FEED.K1
**TSTIN**TEST01.FEED.K2
**TSTIN**TEST01.FEED.K3
**TSTIN**TEST01.OUT2.FILE(-1)
**TSTIN**TEST01.FEED.M1
**TSTIN**TEST01.FEED.M2
**TSTIN**TEST01.FEED.M3
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Oct 10, 2008 5:34 pm
Reply with quote

How about a REXX solution that calls SORT from within.

Tried & tested - but this shop uses DFSORT but should not make a difference on so simple a sort request.

JCL
Code:

//STEP0020 EXEC PGM=IKJEFT01,PARM='ZZZZTEMP'               
//SYSEXEC  DD DSN=whatever..REXX,DISP=SHR                         
//DDNAME   DD DSN=input dataset,DISP=SHR               
//SORTIN   DD DSN=&&TEMP01,DISP=(,PASS),RECFM=FB,LRECL=80 
//SORTOUT  DD DSN=output dataset,and attributes
//SYSOUT   DD SYSOUT=*                                     
//SYSTSPRT DD SYSOUT=*                                     
//SYSTSIN  DD DUMMY                                       
//SYSIN    DD *                                           
  SORT  FIELDS=(1,44,CH,A)                                 
  SUM   FIELDS=NONE                                       
/*                                                         
//                                                         


REXX
Code:

/* REXX *** FIND AND REMOVE (NN) FROM INPUT FILE                     */
                                                                       
"EXECIO * DISKR DDNAME ( STEM INP. FINIS"                             
DO AA = 1 TO INP.0                                                     
  POSIT = POS('(',INP.AA)                                             
  IF POSIT > 0 THEN
    INP.AA = OVERLAY('            ',INP.AA,POSIT)                       
END                                                                   
                                                                       
"EXECIO * DISKW SORTIN ( STEM INP. FINIS"                             
"CALL *(SORT)"                                                         
EXIT                                                                   
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 Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Remove leading zeroes SYNCSORT 4
No new posts How to remove block of duplicates DFSORT/ICETOOL 8
This topic is locked: you cannot edit posts or make replies. Compare files with duplicates in one ... DFSORT/ICETOOL 11
Search our Forums:

Back to Top