MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SYNC SORT : Count of records at the end of the file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Tue Oct 11, 2005 7:00 am    Post subject: SYNC SORT : Count of records at the end of the file Reply with quote

Hi,
I am facing problem while writing the COUNT of records into o/p file.
There were 2 input files with 714 records length each(FB).I am matching the details and writing them into 2 files on some conditions.

Here is the jCL I used.

Code:


//PS100    EXEC  PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTJNF1 DD DSN=xxx.yyy,DISP=SHR--->i/p file 1     
//SORTJNF2 DD DSN=zzz.kkk,DISP=SHR--->i/p file 2       
//SORTOF01 DD DSN=aaa.bbb,         
//             DISP=(,CATLG,DELETE),                   
//             UNIT=Sysda,                             
//             SPACE=(CYL,(55,55),RLSE),               
//             DCB=(RECFM=FBA,LRECL=133)                 
//SORTOF02 DD DSN=CCC.DDD,         
//             DISP=(,CATLG,DELETE),                   
//             UNIT=SYSDA,                             
//             SPACE=(CYL,(55,55),RLSE),               
//             DCB=(RECFM=FBA,LRECL=133)                 
//SYSIN    DD *                                         
JOINKEYS FILES=F1,FIELDS=(3,10,A)                             
JOINKEYS FILES=F2,FIELDS=(3,10,A)                             
JOIN UNPAIRED,F1                                             
REFORMAT FIELDS=(F1:2,1,3,10,152,1,262,1,                     
                 F2:472,5)                                   
SORT FIELDS=(1,1,BI,A,2,10,CH,A),EQUALS                       
SUM FIELDS=NONE                                               
OUTFIL FILES=01,                                             
INCLUDE=(13,1,CH,NE,C'0'),                                   
OUTREC=(1,1,BI,EDIT=(TT),1X,2,10,1X,13,1,1X,14,5,133:X),     
TRAILER1=('NUMBER',COUNT)                                     
OUTFIL FILES=02,                                             
OMIT=(13,1,CH,NE,C'0'),                                       
OUTREC=(1,1,BI,EDIT=(TT),1X,2,10,1X,13,1,1X,14,5,133:X),     
TRAILER1=('NUMBER',COUNT)                                     
//*                                                     




The sysout after the job got down.

Code:


WER164B  9,828K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B     0 BYTES RESERVE REQUESTED, 428K BYTES USED             
WER146B  20K BYTES OF EMERGENCY SPACE ALLOCATED                   
WER481I  JOINKEYS REFORMAT RECORD LENGTH=   18, TYPE = F           
WER110I  SORTOF01 : RECFM=FBA  ; LRECL=   133; BLKSIZE= 27930     
WER110I  SORTOF02 : RECFM=FBA  ; LRECL=   133; BLKSIZE= 27930     
WER247A  SORTOF01 HAS INCOMPATIBLE LRECL                           
WER247A  SORTOF02 HAS INCOMPATIBLE LRECL                           
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                     
WER482I  JNF1 STATISTICS                                           
WER483B  3,728K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER483B     0 BYTES RESERVE REQUESTED, 488K BYTES USED             
WER108I  SORTJNF1 : RECFM=FB   ; LRECL=   714; BLKSIZE= 27846     
WER482I  JNF2 STATISTICS                                           
WER483B  2,708K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER483B     0 BYTES RESERVE REQUESTED, 488K BYTES USED             
WER108I  SORTJNF2 : RECFM=FB   ; LRECL=   714; BLKSIZE= 27846     
 


My shop is having the Z/os version of SYNCSORT.

Thank you

Back to top

Code:
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Tue Oct 11, 2005 7:16 am    Post subject: Reply with quote

bprasanna,

Code:

WER247A  SORTOF01 HAS INCOMPATIBLE LRECL                           
WER247A  SORTOF02 HAS INCOMPATIBLE LRECL 


This should have given you a clue. Remember that whenever you use reporting features(trailer, header..) then LRECL of the o/p file is increased by 1 as the output will be generated with a carriage control character. You can supress the carriage control character using REMOVECC parameter.

Btw you DON'T have to code DCB parameters for sort. Sort automatically calculates the DCB parameters.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Tue Oct 11, 2005 8:19 am    Post subject: Reply with quote

Thank you Kolusu.It worked fine without the DCB parm.

Thank you

Bprasanna
Back to top
View user's profile Send private message
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Tue Oct 11, 2005 9:11 am    Post subject: Reply with quote

Hi,
One more question on the same topic.Once I generate the report I am sorting the o/p files on (14,5,CH,D) in another step to have the records on decending order.
Is there any chance that we can club this condition as well in the first step?

SORT FIELDS=(1,1,BI,A,2,10,CH,A),EQUALS
SUM FIELDS=NONE

Here I am elimanating the duplicates from file.Once I finish this one,I need to sort the file on 472,5 (of F2,Which will be in the 14 th position of the REFORMAT).

Thank you
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Tue Oct 11, 2005 9:16 am    Post subject: Reply with quote

Bprasanna,

Using JOIN feature, you can have 3 levels of SORTING.

1. Sort input file 1 on key field
2. Sort input file 2 on key field.
3. After matching (joining) records, sort the merged file on some order (Using SORT FIELDS).

Since you have already used all these options, you can have your 4th sort (14,5,CH,D) only in a new Step/Pass. You cannot club them together. If you want to avoid a JCL step, you can include it as a Pass (Use SYNCTOOL and have 2 passes 1 for join and the other for Re-arranging the output).

Thanks,
Phantom
Back to top
View user's profile Send private message
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Tue Oct 11, 2005 9:37 am    Post subject: Reply with quote

Thank you Phantom.Could you please post a dummy jcl for this if possible.Should I need to use any alias for the SORTJNF1 and JNF2 files?


Thnak you
_________________
----------------
Thanks&Regards
Bprasanna
Back to top
View user's profile Send private message
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Wed Oct 12, 2005 7:00 am    Post subject: Reply with quote

Quote:

Use SYNCTOOL and have 2 passes 1 for join and the other for Re-arranging the output).


Can any body tell me ,is the above is possible?I am able to see this one is possible only with the SPLICE operator of DFSORT.

Thank you
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Oct 12, 2005 9:55 am    Post subject: Reply with quote

Quote:

Can any body tell me ,is the above is possible?I am able to see this one is possible only with the SPLICE operator of DFSORT.


bprasanna,

Here is a sample synctool step which uses join as well as use another sort operation in a single step. The first SORT operator performs the JOIN operation and the 2nd sort operator sorts the sortof01 to out1 using ctl2cntl control card. The 3rd sort operaotor sorts the sortof02 to out2 using the same ctl2cntl. I also added the removecc parameter on the output files to supress the carriage control character.

Code:

//STEP0100 EXEC PGM=SYNCTOOL
//TOOLMSG  DD SYSOUT=*       
//DFSMSG   DD SYSOUT=*       
//CTL1JNF1 DD DSN=YOUR INPUT JOIN FILE1,
//            DISP=SHR
//CTL1JNF2 DD DSN=YOUR INPUT JOIN FILE2,
//            DISP=SHR
//SORTOF01 DD DSN=aaa.bbb,         
//            DISP=(,CATLG,DELETE),                   
//            UNIT=Sysda,                             
//            SPACE=(CYL,(55,55),RLSE)
//SORTOF02 DD DSN=CCC.DDD,         
//            DISP=(,CATLG,DELETE),                   
//            UNIT=SYSDA,                             
//            SPACE=(CYL,(55,55),RLSE),               
//OUT1     DD DSN=aaa.bbb.sorted,         
//            DISP=(,CATLG,DELETE),
//            UNIT=Sysda,
//            SPACE=(CYL,(55,55),RLSE)
//OUT2     DD DSN=ccc.ddd.sorted,         
//            DISP=(,CATLG,DELETE),
//            UNIT=Sysda,
//            SPACE=(CYL,(55,55),RLSE)
//TOOLIN    DD *
  SORT FROM(CTL1JNF1) USING(CTL1)
  SORT FROM(SORTOF01) TO(OUT1) USING(CTL2)
  SORT FROM(SORTOF02) TO(OUT2) USING(CTL2)
//CTL1CNTL  DD *
  JOINKEYS FILES=F1,FIELDS=(3,10,A)                             
  JOINKEYS FILES=F2,FIELDS=(3,10,A)                             
  JOIN UNPAIRED,F1                                             
  REFORMAT FIELDS=(F1:2,1,3,10,152,1,262,1,                     
                   F2:472,5)                                   
  SORT FIELDS=(1,1,BI,A,2,10,CH,A),EQUALS                       
  SUM FIELDS=NONE                                               
  OUTFIL FILES=01,REMOVECC,                                             
  INCLUDE=(13,1,CH,NE,C'0'),                                   
  OUTREC=(1,1,BI,EDIT=(TT),1X,2,10,1X,13,1,1X,14,5,133:X),     
  TRAILER1=('NUMBER',COUNT)                                     
  OUTFIL FILES=02,REMOVECC,                                             
  OMIT=(13,1,CH,NE,C'0'),                                       
  OUTREC=(1,1,BI,EDIT=(TT),1X,2,10,1X,13,1,1X,14,5,133:X),     
  TRAILER1=('NUMBER',COUNT)                                     
//CTL2CNTL  DD *
  SORT FIELDS=(14,5,CH,D)
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Wed Oct 12, 2005 11:12 am    Post subject: Reply with quote

Hi Kolusu,
Thank you very much for the reply with complete info.

Hi Phantom,
Thank you very much for giving the details about the JOIN feature regarding the 3 sort steps.

Have a great day.

Bprasanna
Back to top
View user's profile Send private message
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Wed Oct 12, 2005 11:20 am    Post subject: Reply with quote

Kolusu and Phantom,
I really wonder how you guys will get the solutions so easily and quickly.I read the the PDF that the SYNCSORT guys provided with the new release.There was no mention of the same stuff there.

Thank you
_________________
----------------
Thanks&Regards
Bprasanna
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Oct 12, 2005 11:49 am    Post subject: Reply with quote

Quote:

I read the the PDF that the SYNCSORT guys provided with the new release.There was no mention of the same stuff there.


bprassana,

Synctool is an undocumented and unsupported tool from syncsort. So you will not find anything related to synctool in the manual.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Oct 13, 2005 12:17 am    Post subject: Reply with quote

Thanks for the quick response Kolusu,

As you know, Yesterday was a holiday in India (Dasera - Durga Pooja) and I didn't have access to my mainframe server.

Btw, you have used CTL1JNF1 and CTL1JNF2 as DD names for the input files. How did you find that ???? Question I believe Synctool takes the first 4 chars from the DD used the Toolin card
Quote:

SORT FROM(CTL1JNF1)


Please correct me if I am wrong. We have Syncsort v 1.1 here and hence I can't test the code with different DDs.

Thanks,
Phantom
Back to top
View user's profile Send private message
bprasanna
Beginner


Joined: 05 Sep 2003
Posts: 119
Topics: 33
Location: Hyderabad

PostPosted: Thu Oct 13, 2005 1:54 am    Post subject: Reply with quote

Kolusu,
I tested the code and is working fine with a little modification.We just need to modify the SORT0F01 and SORTOF02 to CTL1OF01 and CTL1OF02.

Thanks a lot guys.
Bprasanna
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Oct 13, 2005 5:02 am    Post subject: Reply with quote

Quote:
Btw, you have used CTL1JNF1 and CTL1JNF2 as DD names for the input files. How did you find that ????


The default lookup ddname for Synctool must start with CTLxxxxx if you used CTL in your Toolin card. And the join operator looks for JNFx suffix.

Quote:

I tested the code and is working fine with a little modification.We just need to modify the SORT0F01 and SORTOF02 to CTL1OF01 and CTL1OF02.

bprasanna,

I always use FNAMES parm on the OUTFIL which allows me to give more meaningful names to the output files. I overlooked your FILES statement in your control cards. sorry

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Oct 13, 2005 5:16 am    Post subject: Reply with quote

Thanks for the clarification Kolusu.

Regards.
Phantom
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group