Posted: Fri Dec 23, 2005 4:48 am Post subject: Include on Multiple Conditions in Sort
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
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Fri Dec 23, 2005 5:14 am Post subject:
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'))
/*
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
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Fri Dec 23, 2005 5:49 am Post subject:
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'))
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Dec 23, 2005 10:54 am Post subject:
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
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Sat Dec 24, 2005 6:06 am Post subject:
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 !.
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