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 

Include on Multiple Conditions in Sort

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


Joined: 02 Sep 2005
Posts: 77
Topics: 10
Location: Cincinnati

PostPosted: Fri Dec 23, 2005 4:48 am    Post subject: Include on Multiple Conditions in Sort Reply with quote

Hi,
I am sorting an input file based on some condition.

I got the required output by executing the following sysin control statements.


Code:
//SYSIN        DD  * *** CONSTANT CONTROL CARDS ***     
  SORT FIELDS=COPY                                       
  INCLUDE COND=(26,2,CH,EQ,C'17',AND,                   
               (212,3,CH,EQ,C'763',OR,                   
                212,3,CH,EQ,C'828',OR,                   
                212,3,CH,EQ,C'836',OR,                   
                212,3,CH,EQ,C'843',OR,                   
                212,3,CH,EQ,C'844',OR,                   
                212,3,CH,EQ,C'846',OR,                   
                212,3,CH,EQ,C'864',OR,                   
                212,3,CH,EQ,C'866',OR,                   
                212,3,CH,EQ,C'7J3',OR,                   
                212,3,CH,EQ,C'7UW',OR,                   
                212,3,CH,EQ,C'84L',OR,                   
                212,3,CH,EQ,C'84W'))
 /*    END OF INPUT


To achieve the same result i had earlier tried sorting with the following SYSIN to reduce the number of lines in JCL.

Code:

//SYSIN        DD  * *** CONSTANT CONTROL CARDS ***             
  SORT FIELDS=COPY                                               
  INCLUDE COND=(26,2,CH,EQ,C'17',AND,                           
               (212,3,CH,EQ,C'763,828,836,843,844,846',OR,       
                212,3,CH,EQ,C'864,866,7J3,7UW,84L,84W'))
/*    END OF INPUT                                               
//*       



With the above control statement the job ran successfully..But the input records with character '846' in 212 position wasn't copied into the output file.

Please advice if i can acheive the same results with less lines of control statements.

Regards,
Jaya
_________________
"Great spirits have always encountered violent opposition from mediocre minds."
-Albert Einstein
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: Fri Dec 23, 2005 5:14 am    Post subject: Reply with quote

Jaya,

When you list more than one value in the INCLUDE card, you need to use the Sub-string operator of Sort (SS) instead of using (CH). CH can handle only one data a time.

Check this code.
Code:

//SYSIN  DD  *
  SORT FIELDS=COPY                                       
  INCLUDE COND=(26,2,CH,EQ,C'17',AND,                   
        (212,3,SS,EQ,C'763,828,836,843,844,846,864,866,7J3,7UW,84L,84W'))
/*


Hope this helps,

Cheers,
Phantom
Back to top
View user's profile Send private message
Jaya
Beginner


Joined: 02 Sep 2005
Posts: 77
Topics: 10
Location: Cincinnati

PostPosted: Fri Dec 23, 2005 5:36 am    Post subject: Reply with quote

Thanks!!! a lot Phantom..It worked great!.
One more question...

Is that possible to continue the substring comparisaon values to the next line in sysin.
I am using seperate OR statements to include more comparison values.

Thanks,
Jaya.
_________________
"Great spirits have always encountered violent opposition from mediocre minds."
-Albert Einstein
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: Fri Dec 23, 2005 5:49 am    Post subject: Reply with quote

Java,

Quote:

Is that possible to continue the substring comparisaon values to the next line in sysin.


Yes, you can do that. Just change your control card like this.
1. Leave the Quote ' open.
2. Enter a non-blank character at position 72 in your sysin card.
Code:

  INCLUDE COND=(26,2,CH,EQ,C'17',AND,                   
                  (212,3,SS,EQ,C'763,828,836,843,844,846,864,866,      -
                 7J3,7UW,84L,84W'))



Hope this helps,

Cheers,

Phantom
Back to top
View user's profile Send private message
Jaya
Beginner


Joined: 02 Sep 2005
Posts: 77
Topics: 10
Location: Cincinnati

PostPosted: Fri Dec 23, 2005 5:56 am    Post subject: Reply with quote

Thank you for your prompt and quick reply.

Jaya.
_________________
"Great spirits have always encountered violent opposition from mediocre minds."
-Albert Einstein
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: Fri Dec 23, 2005 10:54 am    Post subject: Reply with quote

Code:
 INCLUDE COND=(26,2,CH,EQ,C'17',AND,                   
                  (212,3,SS,EQ,C'763,828,836,843,844,846,864,866,      -
                 7J3,7UW,84L,84W'))


Phantom,

Actually that doesn't do what you think it does. The blanks after '866,' will actually be treated as part of the constant, so you'll look for blanks as well as for the numbers. You can't break a quoted string at a comma and go to the next line that way.

The correct syntax is:

Code:

   INCLUDE COND=(26,2,CH,EQ,C'17',AND,                                 
                  (212,3,SS,EQ,C'763,828,836,843,844,846,864,866,7J3,7U-
               W,84L,84W'))                                             


We run the constant all the way up to column 71, put a non-blank in 72 and then continue the constant on the next line in any column up to 16.

If you want to see the difference, try a record with blanks in positions 212-214 - with your constant, that record will be included, whereas with my constant, it won't.
_________________
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
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


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

PostPosted: Sat Dec 24, 2005 6:06 am    Post subject: Reply with quote

Thanks a lot for the clarification, Frank. I never knew this - didn't experience such a situation till now.

Quote:

If you want to see the difference, try a record with blanks in positions 212-214 - with your constant, that record will be included, whereas with my constant, it won't.


I don't have to test it again. I trust the Sort Master !.

Regards,
Phantom
Back to top
View user's profile Send private message
Jaya
Beginner


Joined: 02 Sep 2005
Posts: 77
Topics: 10
Location: Cincinnati

PostPosted: Mon Dec 26, 2005 4:09 am    Post subject: Reply with quote

Thank you Frank!! I had to use around 150 comparison values in substring and your solution worked great!!

Thanks again,
Jaya.
_________________
"Great spirits have always encountered violent opposition from mediocre minds."
-Albert Einstein
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