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

SYNCSORT to replace Comparex


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

New User


Joined: 22 Jun 2007
Posts: 22
Location: Connecticut

PostPosted: Mon Jun 25, 2007 10:35 am
Reply with quote

I have a requirement to replace Comparex utility in a job step with SYNCSORT. The comparex did the following..

There are 2 input files with 252 LRECL & FB format.. Any records that are added this month, (not in file1 but in file2) will be added to output file3. Any records that are deleted this month, (in file1 but not in file2) will not, repeat not, be added to output file3. Any records that is changed this month (in file1 & also in file2) will be added to output file3 unless the only field to change is Data field in the record (POS. 200-207).

With comparex, Mask command has been used for that date field condition.

Now i need to implement the above logic with the help of any sort commands.. I tried with Joinkeys command.. Wud say worked out 50%.
Few records which i was expecting didn't come in the output file... And also order was not the same compared to old output file.(though im not that much worried about it right now)..

Can any of you let me know what is the correct sort command to be used in this place or how to solve this????

Let me know if i have missed quoting anything.
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Mon Jun 25, 2007 10:56 am
Reply with quote

See the Smart DFSORT Tricks at:

www.ibm.com/servers/storage/support/software/sort/mvs/tricks/
Back to top
View user's profile Send private message
rabindranathtawker

New User


Joined: 22 Jun 2007
Posts: 22
Location: Connecticut

PostPosted: Mon Jun 25, 2007 7:08 pm
Reply with quote

Hello,

Thanks for the PDF. But it didn't have example with regard to my requirement.. In my case, a field needs to be masked off before comparing. At the same time, it should be there in the output records.

Any other suggestions?

Cheers....Rabin
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: Mon Jun 25, 2007 7:20 pm
Reply with quote

Hello,

Also, the original question is about Syncsort and the posted link is for DFSORT. Many of the DFSORT "tricks" are not available with Syncsort. . .
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Tue Jun 26, 2007 11:46 am
Reply with quote

you can use ICETOOL, with SPLICE, SELECT and other few more options to get this desired output.
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 Jun 26, 2007 6:03 pm
Reply with quote

Hello,

If you use "ICETOOL" you will actually invoke Synctool which has some, but not all of the features of ICETOOL.

It may be worth a shot, but do not be surprised if it gets a syntax error or does not create the exact output you expect.
Back to top
View user's profile Send private message
student_mf

New User


Joined: 15 Jun 2007
Posts: 23
Location: pune

PostPosted: Tue Jun 26, 2007 6:21 pm
Reply with quote

hi
i have used superc in one step and compared 2 files and get the output in third file and in next step you can strip the prefixes D OR I using syncsort .you will find the example jcl in tso forum just search .probably it may work for ur case.still iam looking for other options like splice option of icetool .workin on it.
Back to top
View user's profile Send private message
rabindranathtawker

New User


Joined: 22 Jun 2007
Posts: 22
Location: Connecticut

PostPosted: Tue Jun 26, 2007 9:08 pm
Reply with quote

As an update, I tried with PGM=ICETOOL but i didn't get any matched records.. Im still working on it.. As Dick Quoted, PGM=ICETOOL did invoke syncsort.. i could see that in job output.

SYT000I SYNCTOOL RELEASE 1.5.1 - COPYRIGHT 2004 SYNCSORT INC.
SYT001I INITIAL PROCESSING MODE IS "STOP"
SYT002I "TOOLIN" INTERFACE BEING USED

* ADD '11' IDENTIFIER FOR FILE1 RECORDS.
COPY FROM(IN1) TO(T1) USING(CTL1)
SYT020I SYNCSORT CALLED WITH IDENTIFIER "0001"
SYT030I OPERATION COMPLETED WITH RETURN CODE 0

* ADD '22' IDENTIFIER FOR FILE2 RECORDS.
COPY FROM(IN2) TO(T1) USING(CTL2)
SYT020I SYNCSORT CALLED WITH IDENTIFIER "0002"
SYT030I OPERATION COMPLETED WITH RETURN CODE 0
Back to top
View user's profile Send private message
rabindranathtawker

New User


Joined: 22 Jun 2007
Posts: 22
Location: Connecticut

PostPosted: Wed Jun 27, 2007 2:21 am
Reply with quote

Hi,

I almost got the answer for my question except for the following scenario.

File 1:
aabbbcccc 0300030320060304 wert


File2:
aabbbcccc 0300030320060304 wert
aabbbcccc 0300030320060502 wert
aabbbcccc 0300030320060304 wert
aabbbcccc 0300030320060502 wert
aabbbcccc 0300030320060502 wert

In the above example, the bolded data fields are the fields to be masked acc to my requirement. As i was trying with syncsort - Joinkeys, i skipped giving this field pos (200-207 in my case) in the joinkey command...

So if you imagine masking that field in both the files, the result would be duplicate records in file 2 as against the record in file1.

Hence my syncsort considers all the 5 records in file 2 as pair of the single record in file 1.. and doesnot write anything into the output file..

Whereas, the output that im expecting is (plainly what comparex does) - only 1 record in file2 should be considered as pair against file1 and rest 4 records from file2 should be written into output file...

Can anybody now help me for this situation.. Apart from this, i was able to get the solution......

[/b]
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 Jun 27, 2007 2:41 am
Reply with quote

Hello,

Please post all of your jcl and control statements (using the "Code" tabe at the top of the reply panel). Also, please post the sysout information from the execution.

I'm probably mis-understanding something, but it appears to me that either all 5 recordds in file2 match or 2 of the records in file2 match, but i am confused as to why only 1 should "match". If there is to be only a "single match" which should it be?

Referring to what comparex does will probably not help much here as only a few posters seem to have the product installed. . .
Back to top
View user's profile Send private message
rabindranathtawker

New User


Joined: 22 Jun 2007
Posts: 22
Location: Connecticut

PostPosted: Wed Jun 27, 2007 6:50 pm
Reply with quote

Code:
//STEP12B   EXEC PGM=SORT                                       
//SYSPRINT  DD SYSOUT=*                                         
//SYSOUT  DD SYSOUT=*                                           
//SORTJNF1  DD DSN=N482A8.T316238D.PRODDATA.TESTRUN.FILE1,     
//             DISP=SHR                                         
//SORTJNF2  DD DSN=N482A8.T316238D.PRODDATA.TESTRUN.FILE2,     
//             DISP=SHR                                         
//SORTOF03  DD DSN=N482A8.T3162H2.K38DEMP.INF.COMPARE8,         
//       DISP=(OLD,CATLG,CATLG),                               
//       SPACE=(TRK,(20,100)),                                 
//       DCB=(RECFM=FB,LRECL=252,BLKSIZE=0)                     
//SYSIN     DD *                                               
 JOINKEYS FILES=F1,FIELDS=(1,199,A,208,10,A,218,7,D,225,28,A)                             
 JOINKEYS FILES=F2,FIELDS=(1,199,A,208,10,A,218,7,D,225,28,A)                           
 JOIN UNPAIRED,F2,ONLY                                         
 REFORMAT FIELDS=(F2:1,252)                                     
 SORT FIELDS=COPY                                               
  OUTFIL FILES=03                 
 /*                               


[quote]
find below the job output information
Code:
WER164B  5,372K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,             
WER164B     0 BYTES RESERVE REQUESTED, 1,024,008 BYTES USED                   
WER146B  20K BYTES OF EMERGENCY SPACE ALLOCATED                               
WER481I  JOINKEYS REFORMAT RECORD LENGTH=  252, TYPE = F                       
WER110I  SORTOF03 : RECFM=FB   ; LRECL=   252; BLKSIZE= 27972                 
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
WER405I  SORTOF03 :  DATA RECORDS OUT          0; TOTAL RECORDS OUT          0
WER416B  OUTFIL WAS USED FOR SORTOF03                                         
WER054I  RCD IN          0, OUT          0                                     
WER072I  NOEQUALS IN EFFECT                                                   
WER169I  RELEASE 1.2 BATCH 0427 TPF LEVEL 1.1                                 
WER482I  JNF1 STATISTICS                                                       
WER483B  2,548K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,             
WER483B     0 BYTES RESERVE REQUESTED, 1,772K BYTES USED                       
WER108I  SORTJNF1 : RECFM=FB   ; LRECL=   252; BLKSIZE= 27972                 
WER483B  1,516K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,       
WER483B     0 BYTES RESERVE REQUESTED, 1,516K BYTES USED                       
WER483B  G=118                                                                 
 SORTJNF1 : RCD IN= 1,OMITTED= 0,PAIRED= 1,UNPAIRED= 0                 
 SORTJNF1 : EXCP'S=1,UNIT=3390,DEV=39A8,CHP=(9FA7AFB0B2B6,1),VOL=SMS273
 TOTAL OF 1 EXCP'S ISSUED FOR SORTING                                 
 FILESIZE 252 BYTES                                                   
 JNF2 STATISTICS                                                       
 2,548K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,             
    0 BYTES RESERVE REQUESTED, 1,772K BYTES USED                       
 SORTJNF2 : RECFM=FB   ; LRECL=   252; BLKSIZE= 27972                 
 1,516K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,       
    0 BYTES RESERVE REQUESTED, 1,516K BYTES USED                       
 G=118                                                                 
 SORTJNF2 : RCD IN= 5,OMITTED= 0,PAIRED= 5,UNPAIRED= 0                 
 SORTJNF2 : EXCP'S=1,UNIT=3390,DEV=3BD7,CHP=(9FA7AFB0B2B6,2),VOL=SMS220
 TOTAL OF 1 EXCP'S ISSUED FOR SORTING                                 
 FILESIZE 1,260 BYTES                                                 
 END SYNCSORT - N482A8J,STEP12B,,DIAG=8E00,414E,A28C,00EE,C662,68C2,A6C
 DIAG1=EE00,704A,C29C,A4DF,A763,48C3,86C8,8D60                         
 DIAG2=A800,724C,809C,A05D,E163,4CC3,02C8,8F60                         


As you can see, the output file is empty. Dick, with regard to your question, im also struck by the fact why only 1 record should be assumed as match. But tht's the way i have been asked to come up with the result.. icon_sad.gif ... the first pair that the file1 record encounters in file 2 should be considered as match.. and the rest to be written into the output file..

Let me know if i have missed quoting anything.. Thanks.... I tried this concept with ICETOOL too.. but same result..
Back to top
View user's profile Send private message
rabindranathtawker

New User


Joined: 22 Jun 2007
Posts: 22
Location: Connecticut

PostPosted: Wed Jun 27, 2007 9:16 pm
Reply with quote

Hello all,

Today i tried with Superc & Filemaster options.. I got the following result.

input:
File 1:
aabbbcccc 0300030320060304 wert


File2:
aabbbcccc 0300030320060304 wert
aabbbcccc 0300030320060502 wert
aabbbcccc 0300030320060304 wert
aabbbcccc 0300030320060502 wert
aabbbcccc 0300030320060502 wert

output:
aabbbcccc 0300030320060304 wert
aabbbcccc 0300030320060304 wert
aabbbcccc 0300030320060502 wert
aabbbcccc 0300030320060502 wert

if u notice, the 2nd record from file2 was considered match against file1 and the rest were deducted as new records and written into the output file.. (no clue as to why it didn't consider the first record as a pair icon_eek.gif which i was expecting)

Below given is the filemaster logic for this problem...

Code:
//COMPARE EXEC PGM=CAWABATC,REGION=2M                         
//STEPLIB   DD DSN=PZ709RTX.CAFM.CAILIB,                     
//             DISP=SHR                                       
//SYSPRINT  DD DSN=N482A8.COMPARE.RESULT,                     
//             DISP=(NEW,CATLG,CATLG),                       
//             SPACE=(CYL,(100,100),RLSE),                   
//             DCB=(RECFM=FB,LRECL=252,BLKSIZE=0)             
//SYSUDUMP  DD SYSOUT=*                                       
//SYSUT1    DD DSN=N482A8.T316238D.PRODDATA.TESTRUN.FILE1,   
//             DISP=SHR                                       
//SYSUT1N   DD DSN=N482A8.T316238D.PRODDATA.TESTRUN.FILE2,   
//             DISP=SHR                                       
//SYSIN     DD *                                             
COMPARE OLDFILE=SYSUT1,NEWFILE=SYSUT1N,                       
        FORMAT=C,COMPREPORT=M,                               
        FIELDDISPLAY=M                                       
/*                                                           


As one of the members quoted in this thread, both superc & filemaster would return us with the summary details, from which we have to strip out required result.

im trying out various other duplicate scenarios that exists in my case and will keep you people updated with my results..

Thanks a lot for everybody's help on this.. Kindly do update me if you people feel there is any other way we can approach this problem..
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 Jun 27, 2007 9:30 pm
Reply with quote

Helllo,

It may be helpful to add a few more records to file 1 that are of completely "new" content (rather than more like the ones already in file 2) and corresponding new records in file 2. If there are multiple "cases" the result may help understand what exactly is happening and why the second record was the one chosen in your test.
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 Jun 27, 2007 11:59 pm
Reply with quote

Hello,

For this to work consistently
Quote:
the first pair that the file1 record encounters in file 2 should be considered as match.
, wouldn't there need to be a sequence that is the same for each run?

Seems a bit strange that "any old match will do" and whatever is left goes into the output file. . . icon_confused.gif

I guess if all else fails, a bit of programming would give you the flexability to force the result you want.

Personally, i'd be trying to find an understandable business rule that supports the "just grab one" concept.
Back to top
View user's profile Send private message
rabindranathtawker

New User


Joined: 22 Jun 2007
Posts: 22
Location: Connecticut

PostPosted: Thu Jun 28, 2007 1:34 am
Reply with quote

Hi Dick,

You were right.. Today i digged into the thread of this job and after a prolonged discussion, came to know that the current process of filtering the duplicates in the previous step isn't working at all. Due to that, we had this weird concept of "match one , rest into file". Now the duplicate issue will be sorted out and hopefully Syncsort should work out well.

Thanks all for your help.. Will keep posting queries regularly..

Thanks...Rabin
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: Thu Jun 28, 2007 1:41 am
Reply with quote

You're welcome - we'll be here - let us know how it goes icon_smile.gif
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
No new posts To replace jobname in a file with ano... SYNCSORT 12
Search our Forums:

Back to Top