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

How to solve this requirement using SYNCSORT...


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

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Mon Dec 08, 2008 12:24 pm
Reply with quote

Hi,

I will explain my requirement.

Here if u see the input file, there are
4 users belongs to #1RTRTA
3 users belongs to #1RTRTB
2 users belongs to #1RTRTC
1 user belongs to #1RTRTD
1 user belongs to #1RTRTE

I want o/p file with the records for the #1RTRTA, #1RTRTB, #1RTRTC. Since these are
the top most 3 groups with maximum number of users.

Code:

                                 Default           
 Userid         User Name         Group     Owner 
--------   --------------------  --------  --------
#123       ABCD                #1RTRTA   ##BG   
#455       FRUSC               #1RTRTA   ##BG   
#44334     BISS                #1RTRTB   ##BG   
#3230      FRT                 #1RTRTA   ##BG   
#322       DATA                #1RTRTA   ##BG   
#5456      CORP                #1RTRTB   ##BG   
#6775      DBC                 #1RTRTB   ##BG   
#5646      DBC                 #1RTRTC   ##BG   
#366456    DBC                 #1RTRTD   ##BG   
#235       DBC                 #1RTRTC   ##BG   
#336456    DBC                 #1RTRTE   ##BG


Expected o/p file:

Code:

                                 Default           
 Userid         User Name         Group     Owner 
--------   --------------------  --------  --------
#123       ABCD                #1RTRTA   ##BG   
#455       FRUSC               #1RTRTA   ##BG   
#3230      FRT                 #1RTRTA   ##BG   
#322       DATA                #1RTRTA   ##BG   
#44334     BISS                #1RTRTB   ##BG   
#5456      CORP                #1RTRTB   ##BG   
#6775      DBC                 #1RTRTB   ##BG   
#5646      DBC                 #1RTRTC   ##BG   
#235       DBC                 #1RTRTC   ##BG   


I/p and o/p:
Record format . . . : FBA
Record length . . . : 133

User ID field: (3,8) This field is unique.
Default Group field: (36,8)

Thanks in advance
R KARTHIK
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Mon Dec 08, 2008 2:39 pm
Reply with quote

Karthik,

Quote:
Since these are
the top most 3 groups with maximum number of users.


Do you want this to be checked dynamically and retain only the records for the top 3 groups?
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Mon Dec 08, 2008 2:49 pm
Reply with quote

Hi,

I want to retain only the records for the top 3 groups.

Regards
R KARTHIK
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Mon Dec 08, 2008 4:30 pm
Reply with quote

karthikr44,

Please check with the following code for your requirment.

Code:
// EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CTL3JNF1 DD DSN=&&T2,DISP=(,DELETE)
//CTL3JNF2 DD DSN=FBA133.IN,DISP=SHR
//T1 DD DSN=&&T1,DISP=(,DELETE)
//OUT DD DSN=FBA133.OUT,DISP=SHR
//TOOLIN DD *
 SORT FROM(CTL3JNF2) TO(T1) USING(CTL1)
 COPY FROM(T1) TO(CTL3JNF1) USING(CTL2)
 SORT FROM(CTL3JNF1) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
 OPTION EQUALS
 SORT FIELDS=(36,8,CH,A)
 OUTFIL REMOVECC,NODETAIL,SECTIONS=(36,8,TRAILER3=(36,8,X,COUNT=(M11)))
/*
//CTL2CNTL DD *
 OPTION STOPAFT=3
/*
//CTL3CNTL DD *
 OPTION EQUALS
 JOINKEYS FILE=F1,FIELDS=(1,8,A)
 JOINKEYS FILE=F2,FIELDS=(36,8,A)
 REFORMAT FIELDS=(F2:1,133,F1:10,15)
 SORT FIELDS=(81,15,CH,D)
 OUTFIL OUTREC=(1,133)
/*
//


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

Moderator


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

PostPosted: Mon Dec 08, 2008 5:04 pm
Reply with quote

shankar.v,

The job you posted might work for this particular example but I think it may not produce the desired results for all the cases. (say #1RTRTD occurs 5 times)
Back to top
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Mon Dec 08, 2008 5:47 pm
Reply with quote

arcvns,
Quote:
The job you posted might work for this particular example but I think it may not produce the desired results for all the cases. (say #1RTRTD occurs 5 times)

Yes, You are correct. The code has been modified as follows:

Code:
// EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//CTL3JNF2 DD DSN=FBA133.IN,DISP=SHR
//T1 DD DSN=&&T1,DISP=(,DELETE)
//CTL3JNF1 DD DSN=&&T2,DISP=(,DELETE)
//OUT DD DSN=FBA133.OUT,DISP=SHR
//TOOLIN DD *
 SORT FROM(CTL3JNF2) TO(T1) USING(CTL1)
 SORT FROM(T1) TO(CTL3JNF1) USING(CTL2)
 SORT FROM(CTL3JNF1) TO(OUT) USING(CTL3)
/*
//CTL1CNTL DD *
 OPTION EQUALS
 SORT FIELDS=(36,8,CH,A)
 OUTFIL REMOVECC,NODETAIL,SECTIONS=(36,8,TRAILER3=(36,8,X,COUNT=(M11)))
/*
//CTL2CNTL DD *
 SORT FIELDS=(10,15,CH,D)
 OUTFIL REMOVECC,STARTREC=1,ENDREC=3
/*
//CTL3CNTL DD *
 OPTION EQUALS
 JOINKEYS FILE=F1,FIELDS=(1,8,A)
 JOINKEYS FILE=F2,FIELDS=(36,8,A)
 REFORMAT FIELDS=(F2:1,133,F1:10,15)
 SORT FIELDS=(134,15,CH,D)
 OUTFIL OUTREC=(1,133)
/*
//


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

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Mon Dec 08, 2008 6:14 pm
Reply with quote

HI shankar.v,

Thanks for ur solution, i will check and let u know the results.

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: Mon Dec 08, 2008 7:01 pm
Reply with quote

Quote:
4 users belongs to #1RTRTA
3 users belongs to #1RTRTB
2 users belongs to #1RTRTC
1 user belongs to #1RTRTD
1 user belongs to #1RTRTE
2 users belongs to #1RTRTF
karthikr44,

Just in case, if you have multiple groups with 3rd rank as shown above, do you want only one group in output or both?
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Mon Dec 08, 2008 8:49 pm
Reply with quote

Hi arcvns,

I want both..

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: Mon Dec 08, 2008 10:28 pm
Reply with quote

karthikr44,

The below SYNCTOOL job does what you're trying to achieve. Goodluck icon_smile.gif
Code:
//STEP1    EXEC PGM=SYNCTOOL                                   
//IN       DD DSN= Input  file - FBA/133                       
//OUT      DD DSN= Output file - FBA/133                       
//DFSMSG   DD SYSOUT=*                                         
//TOOLMSG  DD SYSOUT=*                                         
//T1       DD DSN=&&T1,DISP=(,PASS)                           
//C1       DD DSN=&&C1,DISP=(,PASS)                           
//TOOLIN   DD *                                               
  SORT FROM(IN) TO(T1) USING(CTL1)                             
  SORT FROM(T1) TO(C1) USING(CTL2)                             
  SELECT FROM(IN) TO(OUT) ON(36,8,CH) -                       
//         DD DSN=*.C1,VOL=REF=*.C1,DISP=(OLD,PASS)           
//CTL1CNTL DD *                                               
  SORT FIELDS=(36,8,CH,A)                                     
  OUTFIL REMOVECC,NODETAIL,                                   
         SECTIONS=(36,8,TRAILER3=(COUNT=(M11,LENGTH=8)))       
//CTL2CNTL DD *                                               
  SORT FIELDS=(1,8,ZD,D)                                       
  SUM FIELDS=NONE                                             
  OUTFIL STARTREC=4,ENDREC=4,BUILD=(3:C'HIGHER(',1,8,C')',80:X)
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Wed Dec 10, 2008 2:14 pm
Reply with quote

Hi arun,

I am getting MAXCC 12 with ur code. Kindly clarify me how to solve this.

Code:

SYT000I  SYNCTOOL RELEASE 1.6.1 - COPYRIGHT 2007  SYNCSORT INC.           
SYT001I  INITIAL PROCESSING MODE IS "STOP"                               
SYT002I  "TOOLIN" INTERFACE BEING USED                                   
                                                                         
           SORT FROM(IN) TO(T1) USING(CTL1)                               
SYT020I  SYNCSORT CALLED WITH IDENTIFIER "0001"                           
SYT030I  OPERATION COMPLETED WITH RETURN CODE 0                           
                                                                         
           SORT FROM(T1) TO(C1) USING(CTL2)                               
SYT020I  SYNCSORT CALLED WITH IDENTIFIER "0002"                           
SYT030I  OPERATION COMPLETED WITH RETURN CODE 0                           
                                                                         
           SELECT FROM(IN) TO(OUT) ON(36,8,CH) -                         
SYT008E  END OF FILE ENCOUNTERED WHILE PROCESSING STATEMENT CONTINUATION 
SYT030I  OPERATION COMPLETED WITH RETURN CODE 12                         
                                                                         
SYT004I  SYNCTOOL PROCESSING COMPLETED WITH RETURN CODE 12               


Thanks
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: Wed Dec 10, 2008 2:19 pm
Reply with quote

Karthik,

Can you post the DFSMSG output here.
Back to top
View user's profile Send private message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Wed Dec 10, 2008 3:38 pm
Reply with quote

Hi,

DFSMSG:

Code:

CTL1CNTL :                                                                     
  SORT FIELDS=(36,8,CH,A)                                                     
  OUTFIL REMOVECC,NODETAIL,                                                   
         SECTIONS=(36,8,TRAILER3=(COUNT=(M11,LENGTH=8)))                       
PARMLIST :                                                                     
OPTION RESINV=0,ARESINV=0,MSGDDN=DFSMSG,SORTIN=IN,SORTOUT=T1,SORTDD=CTL1,DYNALL
C                                                                             
WER428I  CALLER-PROVIDED IDENTIFIER IS "0001"                                 
WER161B  ALTERNATE PARM USED                                                   
WER276B  SYSDIAG= 278845, 788198, 788198, 1995462                             
WER164B  25,008K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,           
WER164B     0 BYTES RESERVE REQUESTED, 24,448K BYTES USED                     
WER146B  128K BYTES OF EMERGENCY SPACE ALLOCATED                               
WER108I  IN       : RECFM=FBA  ; LRECL=   133; BLKSIZE= 27930                 
WER110I  T1       : RECFM=FBA  ; LRECL=   133; BLKSIZE= 27930                 
WER410B  23,468K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,     
WER410B     0 BYTES RESERVE REQUESTED, 23,444K BYTES USED                     
WER036B  G=840,B=400                                                           
WER045C  END SORT PHASE                                                       
WER418I  DATASPACE(S) AND/OR HIPERSPACE(S) USED                               
WER405I  T1       :  DATA RECORDS OUT          0; TOTAL RECORDS OUT          3
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
WER416B  IN       : EXCP'S=1,UNIT=3390,DEV=B870,CHP=(B4B6B8BAB5B7B9BB,2),VOL=DV
WER416B  OUTFIL WAS USED FOR T1                                               
WER246I  FILESIZE 4,389 BYTES                                                 
WER054I  RCD IN         33, OUT         33                                     
WER072I  NOEQUALS, ELAP IN EFFECT                                             
WER169I  RELEASE 1.3 BATCH 0485 TPF LEVEL 1.0                                 
WER052I  END SYNCSORT - TSDSORT,STEP1,,DIAG=C700,400F,EAB5,E0F7,9E4A,6982,2660,
SYNCSORT FOR Z/OS  1.3.1.0RI   PARMTBLE : VSCORE=1536K,VSCORET=8M                                             
CTL2CNTL :                                                                     
  SORT FIELDS=(1,8,ZD,D)                                                       
  SUM FIELDS=NONE                                                             
  OUTFIL STARTREC=4,ENDREC=4,BUILD=(3:C'HIGHER(',1,8,C')',80:X)               
PARMLIST :                                                                     
OPTION RESINV=0,ARESINV=0,MSGDDN=DFSMSG,SORTIN=T1,SORTOUT=C1,SORTDD=CTL2,DYNALL
C                                                                             
WER428I  CALLER-PROVIDED IDENTIFIER IS "0002"                                 
WER161B  ALTERNATE PARM USED                                                   
WER276B  SYSDIAG= 278855, 788208, 788208, 1995462                             
WER164B  25,008K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,           
WER164B     0 BYTES RESERVE REQUESTED, 24,448K BYTES USED                     
WER146B  128K BYTES OF EMERGENCY SPACE ALLOCATED                               
WER108I  T1       : RECFM=FBA  ; LRECL=   133; BLKSIZE= 27930                 
WER110I  C1       : RECFM=FBA  ; LRECL=    80; BLKSIZE= 27920                 
WER410B  23,468K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,     
WER410B     0 BYTES RESERVE REQUESTED, 23,444K BYTES USED                     
WER036B  G=840,B=394                                                           
WER045C  END SORT PHASE                                                       
WER055I  INSERT          0, DELETE          1                                 
WER418I  DATASPACE(S) AND/OR HIPERSPACE(S) USED                               
WER405I  C1       :  DATA RECORDS OUT          0; TOTAL RECORDS OUT          0
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
WER416B  T1       : EXCP'S=1,UNIT=3390,DEV=B966,CHP=(B0B2B4B6B1B3B5B7,2),VOL=PU
WER416B  OUTFIL WAS USED FOR C1                                               
WER246I  FILESIZE 399 BYTES                                                   
WER054I  RCD IN          3, OUT          2                                     
WER072I  NOEQUALS, ELAP IN EFFECT                                             
WER169I  RELEASE 1.3 BATCH 0485 TPF LEVEL 1.0                                 
WER052I  END SYNCSORT - TSDSORT,STEP1,,DIAG=EF00,6007,C2B5,E85F,A64A,498A,0660,
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Dec 10, 2008 4:47 pm
Reply with quote

karthikr44,

From your joblogs, I see your input data had 33 records and you have only 3 distinct groups which means there's really no need to find the top 3 in this particular case.
The job which I gave you expects a minimum of atleast 4 groups in the input.
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 Compare only first records of the fil... SYNCSORT 7
No new posts how to solve this power failure shutd... ABENDS & Debugging 5
No new posts Count Records with a crietaria in a f... DFSORT/ICETOOL 5
No new posts DFSORT/SYNCSORT/ICETOOL JCL & VSAM 8
No new posts Syncsort "Y2C" Function SYNCSORT 1
Search our Forums:

Back to Top