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 

SORT Utility to save excluded records to a different dataset
Goto page Previous  1, 2
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Mon Jul 14, 2008 11:56 am    Post subject: Reply with quote

Kolusu,

Thanks for your help.Yes you are correct , if the SORT card has only
Code:

SORT FIELDS=(541,10,CH,A,1,41,CH,A)   

which means there are no Include conditions and whatever is there in SORTIN should go to OUT1 and OUT2 would be an empty dataset.

If SORTIN contained:
Code:

    SORT FIELDS=(541,10,CH,A,1,41,CH,A)     
    INCLUDE COND=(541,3,CH,NE,C'111',AND,   
                  541,3,CH,NE,C'123',AND,   
                  541,3,CH,NE,C'126')       

SORTOUT would contain:
Code:

    SORT FIELDS=(541,10,CH,A,1,41,CH,A)         
   OUTFIL FNAMES=OUT1,                           
         INCLUDE=(541,3,CH,NE,C'111',AND,       
                  541,3,CH,NE,C'123',AND,       
                  541,3,CH,NE,C'126')           
  OUTFIL FNAMES=OUT2,SAVE           

In this case all NE conditions will go to OUT1 and remaining will go to OUT2.Hope I am clear in my query.
Back to top
View user's profile Send private message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Mon Jul 14, 2008 8:01 pm    Post subject: Reply with quote

Kolusu / Frank,

Can you please help me with the solution . Thanks.
Back to top
View user's profile Send private message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Tue Jul 15, 2008 5:32 am    Post subject: Reply with quote

Members,

Can anybody help me with the solution , i have tried but could not get the desired results.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jul 15, 2008 12:31 pm    Post subject: Reply with quote

I think this DFSORT job will do what you want:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,IFOUTLEN=80,
    IFTHEN=(WHEN=(5,13,CH,EQ,C'INCLUDE COND='),
      BUILD=(3:C'OUTFIL FNAMES=OUT2,SAVE',/,
             3:C'OUTFIL FNAMES=OUT1,',/,
        10:C'INCLUDE',17,50))
/*


If you have an INCLUDE, it will give you:

Code:

     SORT ...
     OUTFIL FNAMES=OUT2,SAVE
     OUTFIL FNAMES=OUT1,INCLUDE=...


It you don't have an INCLUDE, it will give you:

Code:

     SORT ...

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Tue Jul 15, 2008 10:37 pm    Post subject: Reply with quote

Frank,

Thanks a lot for your support.Now based on your new code there is again a new problem which is coming up. After executing the ICEMAN step when there are include conditions ,the formatted sort card is created fine and the next step of extract also works fine and the code below:
Code:

//STEP010  EXEC PGM=ICEMAN                                             
//SORTIN   DD DSN=INPUT SORT CARD FILE,DISP=SHR,BUFNO=10       
//SORTOUT  DD DSN=FORMATTED SORT CARD FILE,                 
//            DISP=(NEW,CATLG,DELETE),                                 
//            BUFNO=10,                                                 
//            UNIT=SYSDA,                                               
//            SPACE=(CYL,(50,25),RLSE),                                 
//            DCB=(MODDCB,RECFM=FB,LRECL=80,BLKSIZE=800)               
//SYSOUT   DD SYSOUT=*                                                 
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(125,100),RLSE)                     
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(125,100),RLSE)                     
//SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(125,100),RLSE)                     
//SYSIN    DD *
  OPTION COPY
  OUTFIL REMOVECC,IFOUTLEN=80,
    IFTHEN=(WHEN=(5,13,CH,EQ,C'INCLUDE COND='),
      BUILD=(3:C'OUTFIL FNAMES=OUT2,SAVE',/,
             3:C'OUTFIL FNAMES=OUT1,',/,
        10:C'INCLUDE',17,50))
/*
//STEP020  EXEC PGM=SORT,PARM=ABEND                                     
//SORTIN   DD DSN=INPUT DATASET
//OUT1     DD DSN=X,                           
//            DISP=(NEW,CATLG,DELETE),                                 
//            BUFNO=10,                                                 
//            UNIT=SYSDA,                                               
//            SPACE=(CYL,(50,25),RLSE),                                 
//            DCB=(MODDCB,RECFM=FB,LRECL=250,BLKSIZE=28000)             
//OUT2     DD DSN=Y,                           
//            DISP=(NEW,CATLG,DELETE),                                 
//            BUFNO=10,                                                 
//            UNIT=SYSDA,                                               
//            SPACE=(CYL,(50,25),RLSE),                                 
//            DCB=(MODDCB,RECFM=FB,LRECL=250,BLKSIZE=28000)             
//SORTOUT  DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(125,100),RLSE)                     
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(125,100),RLSE)                     
//SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(125,100),RLSE)                     
//SYSIN    DD DSN=FORMATTED SORT CARD FILE,DISP=SHR

Both OUT1 and OUT2 are created as per the desired requirement.

Now the problem is when there are no includes in the Input Sort card File what is happening is both OUT1 & OUT2 are coming to be empty datasets and the SORTOUT is having the desired copy of SORTIN which is not my requirement. When there are no includes OUT1 should have the the data exactly copy of the SORTIN and OUT2 should be empty.If i take out SORTOUT i get error as SORTOUT dataset is not defined.If i take out SORTIN and gave a name as IN then also i get an error SORTIN not defined.

Please help me further how to solve the problem.Thanks a lot.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Jul 16, 2008 6:51 am    Post subject: Reply with quote

Oops. We have to change the SORTOUT default to OUT1. This DFSORT job should do it:

Code:

//STEP010  EXEC PGM=ICEMAN
//SORTIN   DD DSN=INPUT SORT CARD FILE,DISP=SHR       
//SORTOUT DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSOUT   DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  OUTFIL REMOVECC,IFOUTLEN=80,
    IFTHEN=(WHEN=(5,13,CH,EQ,C'INCLUDE COND='),
      BUILD=(3:C'OUTFIL FNAMES=OUT2,SAVE',/,
             3:C'OUTFIL FNAMES=OUT1,',/,
        10:C'INCLUDE',17,50))
/*
//STEP020  EXEC PGM=SORT,PARM=ABEND
//SORTIN   DD DSN=INPUT DATASET
//OUT1     DD DSN=X,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(50,25),RLSE),
//            DCB=(MODDCB,RECFM=FB,LRECL=250,BLKSIZE=28000)
//OUT2     DD DSN=Y,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(50,25),RLSE),
//            DCB=(MODDCB,RECFM=FB,LRECL=250,BLKSIZE=28000)
//SYSOUT   DD SYSOUT=*
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(125,100),RLSE)
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(125,100),RLSE)
//SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(125,100),RLSE)
//DFSPARM  DD *
  OPTION SORTOUT=OUT1
//  DD DSN=&&C1,DISP=(OLD,PASS)


BTW, DFSORT ignores BUFNO for SORTIN and SORTOUT, and you don't need SORTWKdd DDs for STEP010 since its a COPY.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Wed Jul 16, 2008 10:18 am    Post subject: Reply with quote

Frank,

Thanks a lot for all your support for which you have helped me.It is working fine in both the conditions :

a) when no includes
b) when includes

But there is a small problem which i guess is happening, when there are no includes ,the SORTIN should be exactly copied to OUT1 and OUT2 should be empty which is happening as per the logic .But when i compare the datasets SORTIN and OUT1 in case of no includes there are some comparisions / changes in records, what i am assuming it is because of the the SORT FIELDS which is creating the mismatches , the count of both SORTIN and OUT1 are same records but there are some changes between SORTIN and OUT1, can you please let me know why SORTIN is exactly not copied to OUT1 , should we take care of SORT FIELDS.

Please help me out.Thanks.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Jul 16, 2008 12:29 pm    Post subject: Reply with quote

I don't understand. The SORT statement changes the order of the records.
Are you saying that if you have a SORT statement and INCLUDEs, you want the records sorted, but if you have a SORT statement and no INCLUDEs, you don't want the records sorted? Why would you have a SORT statement in the original control cards if you don't want the records sorted?

I thought you wanted to change the INCLUDE to OUTFIL statements, or not have the OUTFIL statements if there's no INCLUDE. I don't remember seeing anything about ignoring the SORT statement in some cases. I'm now thoroughly confused about what you're trying to do and what output you expect for each case.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Thu Jul 17, 2008 8:00 am    Post subject: Reply with quote

Frank,

Thanks a lot for your help.I am all set with your code and i was wrong in my understanding and i am clear now.Once again thanks for your overall support.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Jul 17, 2008 10:18 am    Post subject: Reply with quote

Ok, good. Glad I could help.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
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
Goto page Previous  1, 2
Page 2 of 2

 
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