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 

Multiple output files in Sort

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


Joined: 07 Apr 2004
Posts: 46
Topics: 29

PostPosted: Thu May 13, 2004 2:02 am    Post subject: Multiple output files in Sort Reply with quote

Hi all,

The requirement is to split an Input in to two different files with 2 different conditions . I have used two SORTOFxx statements(output files)
and 1 SYSIN which contains the following statements....

SYSIN parameters
-------------------

OUTFIL FILES=01
INREC FIELDS=(1:1,4,5:21,5,10:C'0000000001')
SORT FIELDS=(5,5,CH,A)
SUM FIELDS=(10,10,ZD)
OUTREC FIELDS=(1:5,5,25:10,10),CONVERT

OUTFIL FILES=02
INREC FIELDS=(1:1,4,5:240,9,14:C'0000000001')
SORT FIELDS=(5,9,CH,A)
SUM FIELDS=(14,10,ZD)
OUTREC FIELDS=(1:5,5,25:10,10),CONVERT

The Syncsort abending. Its displaying duplicate INREC,SORT,SUM statements!!!

Is there any alternate way to do this?
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Thu May 13, 2004 3:54 am    Post subject: Reply with quote

Well, indeed.

I hope the following is true for Syncsort as I am a DFSORT user.

INREC processes all records before any COPY/SORT processing. OUTFIL is for after SORT processing. So, your OUTFIL statements must follow the INREC and SORT statements. You cannot have duplicate SORT and INREC statements.

I would suggest you to use SYNCTOOL where you can prepare the datasets in two passes. You can use the two sets of OUTFIL statements separately.
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu May 13, 2004 4:15 am    Post subject: Reply with quote

Krismadras,

You cannot use an inrec,sort,sum on outfil statement. You need two seperate steps to achieve the desired results as you want to find counts on 2 different fields. The following Jobs will give you the desired results.

Code:

//STEP0100  EXEC PGM=SORT                 
//SYSOUT    DD SYSOUT=*                   
//SORTIN    DD DSN=YOUR INPUT VB FILE,
//             DISP=SHR                         
//SORTOUT   DD DSN=YOUR OUTPUT COUNT FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y,),RLSE)   
//SYSIN     DD *
  INREC FIELDS=(1:1,4,               $ RDW
                5:21,5,              $ KEY FROM 21 POS FOR LENGTH OF 5
                10:C'0000000001')    $ CONSTANT OF 1 AT POS 10
  SORT FIELDS=(5,5,CH,A)             $ SORT ON KEY
  SUM FIELDS=(10,10,ZD)              $ SUM ON CONSTANT
  OUTREC FIELDS=(1:5,5,              $ KEY
                 25:10,10),          $ TOTAL COUNT
                 CONVERT             $ CONVERT INPUT VB FILE TO FB FILE


Code:

//STEP0200  EXEC PGM=SORT                 
//SYSOUT    DD SYSOUT=*                   
//SORTIN    DD DSN=YOUR INPUT VB FILE,
//             DISP=SHR                         
//SORTOUT   DD DSN=YOUR OUTPUT COUNT FILE,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(X,Y,),RLSE)   
//SYSIN     DD *
  INREC FIELDS=(1:1,4,               $ RDW
                5:240,9,             $ KEY FROM 240 POS FOR LENGTH OF 9
                14:C'0000000001')    $ CONSTANT OF 1 AT POS 14
  SORT FIELDS=(5,9,CH,A)             $ SORT ON KEY
  SUM FIELDS=(14,10,ZD)              $ SUM ON CONSTANT
  OUTREC FIELDS=(1:5,9,              $ KEY
                 25:10,10),          $ TOTAL COUNT
                 CONVERT             $ CONVERT INPUT VB FILE TO FB FILE


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
kris_madras
Beginner


Joined: 07 Apr 2004
Posts: 46
Topics: 29

PostPosted: Thu May 13, 2004 9:34 am    Post subject: Reply with quote

Intially we had the same thought.... but seems to be too lengthy thats why I posted a question for an alternate solution.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu May 13, 2004 9:49 am    Post subject: Reply with quote

Krismadras,

Quote:

Intially we had the same thought.... but seems to be too lengthy thats why I posted a question for an alternate solution.


Your first post did not mention any thing about alternate solution. your description of the problem when compared to your control cards is quite different. So please follow rule # 4 (Post detailed information on what you're trying to accomplish. Do not make people guess what you mean. This will give you a much better chance of getting a good answer to your question.)

Any way try this
Code:

//STEP0100 EXEC  PGM=SYNCTOOL           
//TOOLMSG  DD SYSOUT=*                 
//DFSMSG   DD SYSOUT=*                 
//IN       DD DSN=YOUR INPUT VB FILE,
//            DISP=SHR                         
//OUT1     DD SYSOUT=*                                             
//OUT2     DD SYSOUT=*                                             
//TOOLIN    DD *                                                   
   OCCURS FROM(IN) LIST(OUT1) HEADER('KEY') HEADER('COUNT') -       
   ON(21,5,CH) ON(VALCNT) BLANK                                       
   OCCURS FROM(IN) LIST(OUT2) HEADER('KEY') HEADER('COUNT') -       
   ON(240,9,CH) ON(VALCNT) BLANK                                       
/*                                                                 


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
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