Need Help about SYNCTOOL

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
zouzoucoiffure
Member
Posts: 6
Joined: Mon Mar 15, 2010 8:19 pm

Need Help about SYNCTOOL

Post by zouzoucoiffure » Mon Mar 15, 2010 8:26 pm

Hi,

Here is my problem :

From theses files :

#FILE 1 (FB/80)
AAAAAAA-10-20
BBBBBBB-10-20
CCCCCCC-10-20

#FILE 2 (FB/80)
AAAAAAA-10-20
BBBBBBB-15-25
CCCCCCC-10-20
DDDDDDD-15-30

i want to obtain :

#RESULT (FB/80)
BBBBBBB-15-25
DDDDDDD-15-30


How can i get only datas from FILE 2 which are not in FILE 1 or modified in FILE 2 ?

Thank you for your Help !

skolusu
Member
Posts: 43
Joined: Sat Jul 26, 2008 12:38 am

Post by skolusu » Mon Mar 15, 2010 9:03 pm

zouzoucoiffure,


The following DFSORT JCL will give you the desired results. Since both files are of the same lrecl and recfm we concatenate them with a header record $$$ which will differentiate the records from each file.

Code: Select all

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                      
$$$                                                                  
//         DD DSN=Your input file1,DISP=SHR
//         DD *                                                      
$$$                                                                  
//         DD DSN=Your input file2,DISP=SHR                          
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                      
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(81:ID=1))  
  SORT FIELDS=(1,7,CH,A),EQUALS                                      
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(83:SEQNUM,1,ZD,RESTART=(1,7))),  
  IFTHEN=(WHEN=GROUP,BEGIN=(83,1,ZD,EQ,1),PUSH=(82:81,1,84:1,80))    
  OUTFIL BUILD=(1,80),                                               
  INCLUDE=(81,2,ZD,EQ,22,OR,(81,2,ZD,EQ,21,AND,1,13,CH,NE,84,13,CH)) 
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

zouzoucoiffure
Member
Posts: 6
Joined: Mon Mar 15, 2010 8:19 pm

Post by zouzoucoiffure » Tue Mar 16, 2010 2:46 pm

Thank you skolusu for your quick answer,

but i didnt succeed to adapt your sample to my real script.

i gave you wrong informations because i thought it was easier to understand for you and also for me.
the real files are FB LRECL=3941, with an ID of 9 digits.

Code: Select all

#FILE 1 (FB/3941)
----+----1----+----2----+----3----+--
000000001 aaaaaaaaaaaaaaaaaaaaaaaaa...
000000002 bbbbbbbbbbbbbbbbbbbbbbbbb...
000000003 ccccccccccccccccccccccccc...

#FILE 2 (FB/3941)
----+----1----+----2----+----3----+--
000000001 aaaaaaaaaaaaaaaaaaaaaaaaa...
000000002 xxxxxxxxxxxxxxxxxxxxxxxxx...
000000003 ccccccccccccccccccccccccc...
000000004 ddddddddddddddddddddddddd...

#RESULT (FB/3941)
----+----1----+----2----+----3----+--
000000002 xxxxxxxxxxxxxxxxxxxxxxxxx...
000000004 ddddddddddddddddddddddddd...

This is your code i tried to modify as i thought :

Code: Select all

//STEP0100 EXEC PGM=SORT                                                
//SYSOUT   DD SYSOUT=*                                                  
//SORTIN   DD *                                                         
$$$                                                                     
//         DD DSN=Input file 1,DISP=SHR                         
//         DD *                                                         
$$$                                                                     
//         DD DSN=Input file 2,DISP=SHR                         
//SORTOUT DD DSN=Output file,DISP=(NEW,CATLG,DELETE),       
//            UNIT=SYSDA,SPACE=(CYL,(400,50),RLSE),                     
//           DCB=(RECFM=FB,LRECL=3941,BLKSIZE=27587)                    
//SYSIN    DD *                                                         
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(3942:ID=1))   
  SORT FIELDS=(1,9,CH,A),EQUALS                                         
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(3944:SEQNUM,1,ZD,RESTART=(1,9))),   
  IFTHEN=(WHEN=GROUP,BEGIN=(3944,1,ZD,EQ,1),                            
                     PUSH=(3943:3942,1,3945:1,3941))                    
  OUTFIL BUILD=(1,3941),                                                
  INCLUDE=(3942,2,ZD,EQ,22,OR,                                  
                   (3942,2,ZD,EQ,21,AND,1,13,CH,NE,3945,13,CH)) 
//*                                                             

This is the result i got :
ABEND=S000 U0016 REASON=00000000 307
POTENTIALLY INEFFICIENT USE OF INREC

Do you have an idea ?


skolusu wrote:zouzoucoiffure,


The following DFSORT JCL will give you the desired results. Since both files are of the same lrecl and recfm we concatenate them with a header record $$$ which will differentiate the records from each file.

Code: Select all

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                      
$$$                                                                  
//         DD DSN=Your input file1,DISP=SHR
//         DD *                                                      
$$$                                                                  
//         DD DSN=Your input file2,DISP=SHR                          
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                      
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(81:ID=1))  
  SORT FIELDS=(1,7,CH,A),EQUALS                                      
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(83:SEQNUM,1,ZD,RESTART=(1,7))),  
  IFTHEN=(WHEN=GROUP,BEGIN=(83,1,ZD,EQ,1),PUSH=(82:81,1,84:1,80))    
  OUTFIL BUILD=(1,80),                                               
  INCLUDE=(81,2,ZD,EQ,22,OR,(81,2,ZD,EQ,21,AND,1,13,CH,NE,84,13,CH)) 
//*

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Tue Mar 16, 2010 5:38 pm

Code: Select all

//SORTIN   DD *                                                          
$$$                                                                      
//         DD DSN=Input file 1,DISP=SHR                          
//         DD *                                                          
$$$                                                                      
//         DD DSN=Input file 2,DISP=SHR 
Are you attempting to concatenate a file that's FB,80 with a file that's FB,3941 with a file that's FB,80 with a file that's FB,3941?

zouzoucoiffure
Member
Posts: 6
Joined: Mon Mar 15, 2010 8:19 pm

Post by zouzoucoiffure » Tue Mar 16, 2010 6:08 pm

Hello MrSpock ,

My both Input files are FB/3941, and i try to get also an output file in FB/3941.

Dont look back after my first messages with FB/80, it was just for the example, but it was not i was waiting for.

Thank you for your help.

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Tue Mar 16, 2010 6:38 pm

The reason I asked is because if I try what your code shows I also abend with:

ABEND=S000 U0063 REASON=00000000

unless I make sure that the two separator files with "$$$" match my two input files that are FB,3941.

skolusu
Member
Posts: 43
Joined: Sat Jul 26, 2008 12:38 am

Post by skolusu » Tue Mar 16, 2010 8:38 pm

zouzoucoiffure wrote:Thank you skolusu for your quick answer,

but i didnt succeed to adapt your sample to my real script.

i gave you wrong informations because i thought it was easier to understand for you and also for me.
the real files are FB LRECL=3941, with an ID of 9 digits.

This is the result i got :
ABEND=S000 U0016 REASON=00000000 307
POTENTIALLY INEFFICIENT USE OF INREC
Do you have an idea ?
zouzoucoiffure,

Yep I do have an idea. Your Error messages indicate you are using syncsort's SYNCTOOL, not DFSORT's ICETOOL. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort/SYNCTOOL.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

zouzoucoiffure
Member
Posts: 6
Joined: Mon Mar 15, 2010 8:19 pm

Post by zouzoucoiffure » Wed Mar 17, 2010 2:36 pm

I tried with ICETOOL (=SYNCTOOL).

Code: Select all

//S1 EXEC PGM=ICETOOL                                         
//TOOLMSG DD SYSOUT=*                                         
//DFSMSG DD SYSOUT=*                                          
//CON DD DSN=input file 1,DISP=SHR                    
//    DD DSN=input file 2,DISP=SHR                    
//OUT DD DSN=output file,DISP=(NEW,CATLG,DELETE), 
//         UNIT=SYSDA,SPACE=(CYL,(40,5),RLSE),                
//         DCB=(RECFM=FB,LRECL=750,BLKSIZE=27750)             
//TOOLIN DD *                                                 
SELECT FROM(CON) TO(OUT) ON(1,750,CH) NODUPS                  
/*                                                            

with theses files :

Code: Select all

#FILE 1 (FB/750)
----+----1----+----2----+----3----+--
000000001 aaaaaaaaaaaaaaaaaaaaaaaaa...
000000002 bbbbbbbbbbbbbbbbbbbbbbbbb...
000000003 ccccccccccccccccccccccccc...

#FILE 2 (FB/750)
----+----1----+----2----+----3----+--
000000001 aaaaaaaaaaaaaaaaaaaaaaaaa...
000000002 xxxxxxxxxxxxxxxxxxxxxxxxx...
000000003 ccccccccccccccccccccccccc...
000000004 ddddddddddddddddddddddddd...
the result is

Code: Select all

#RESULT (FB/750)
----+----1----+----2----+----3----+--
000000002 bbbbbbbbbbbbbbbbbbbbbbbbb...  (from file 1)
000000002 xxxxxxxxxxxxxxxxxxxxxxxxx...  (from file 2)
000000004 ddddddddddddddddddddddddd...  (from file 2)
instead of :

Code: Select all

#RESULT (FB/750)
----+----1----+----2----+----3----+--
000000002 xxxxxxxxxxxxxxxxxxxxxxxxx...  (from file 2)
000000004 ddddddddddddddddddddddddd...  (from file 2) 
Do you have an idea ?

MrSpock
Active Member
Posts: 273
Joined: Wed Jun 27, 2007 5:37 pm

Post by MrSpock » Wed Mar 17, 2010 4:21 pm

The record

Code: Select all

000000002 bbbbbbbbbbbbbbbbbbbbbbbbb...
has no duplicates, so why do you not want it in the output?

Maybe you need to look at selecting only records where the key occurs more than once, and then select the unique keys only once from that subset.

zouzoucoiffure
Member
Posts: 6
Joined: Mon Mar 15, 2010 8:19 pm

Post by zouzoucoiffure » Wed Mar 17, 2010 5:37 pm

Hi MrSpock,

my wish is to compare file 1 and file 2 in order to get only new lines or modified lines from file 2. unique keys is with 9 digits.

in File 1 :

Code: Select all

000000002 bbbbbbbbbbbbbbbbbbbbbbbbb...
in File 2 :

Code: Select all

000000002 xxxxxxxxxxxxxxxxxxxxxxxxx...
so i want to get new value :

Output :

Code: Select all

000000002 xxxxxxxxxxxxxxxxxxxxxxxxx...
am i answering to your question ?

zouzoucoiffure
Member
Posts: 6
Joined: Mon Mar 15, 2010 8:19 pm

Post by zouzoucoiffure » Fri Mar 19, 2010 3:09 pm

This works fine for me :

Code: Select all

//SORT1 EXEC PGM=SORT               
//SORTJNF1 DD *                     
000000001 AAAAAAAAAAAAAAAAAAAAAAAAA 
000000002 BBBBBBBBBBBBBBBBBBBBBBBBB 
000000003 CCCCCCCCCCCCCCCCCCCCCCCCC 
/*                                  
//SORTJNF2 DD *                     
000000001 AAAAAAAAAAAAAAAAAAAAAAAAA 
000000002 XXXXXXXXXXXXXXXXXXXXXXXXX 
000000003 CCCCCCCCCCCCCCCCCCCCCCCCC 
000000004 DDDDDDDDDDDDDDDDDDDDDDDDD 
/*                                  
//SORTOUT  DD SYSOUT=*              
//SYSOUT   DD SYSOUT=*              
//SYSIN    DD *                     
   JOINKEYS FILE=F1,FIELDS=(1,80,A) 
   JOINKEYS FILE=F2,FIELDS=(1,80,A) 
   JOIN  UNPAIRED,F2,ONLY           
   SORT FIELDS=(1,9,CH,A)           
/* FIN                              
Result :

Code: Select all

000000002 XXXXXXXXXXXXXXXXXXXXXXXXX 
000000004 DDDDDDDDDDDDDDDDDDDDDDDDD 
Best Regards.

Alissa Margulies
Member
Posts: 25
Joined: Tue Apr 28, 2009 10:53 pm
Location: USA
Contact:

Post by Alissa Margulies » Fri Apr 16, 2010 1:46 am

The files will get sorted during JOIN processing. Since you are not changing the sort order, you can code SORT FIELDS=COPY.
Alissa Margulies
SyncSort Mainframe Product Services
zos_tech@syncsort.com
201-930-8260

academyindia4

Topic deleted by Admin

Post by academyindia4 » Mon Jan 25, 2016 10:14 pm

<< Content deleted By Admin >>

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others