Page 1 of 1

Include rows with numbers and capital letters

PostPosted: Wed Jul 25, 2012 12:52 pm
by xcspg3
In "Beyond sorting" I have not found how to include rows where there are only numbers or capital letters.
Is there a simple solution for this problem?

Thanks

max

Re: Include rows with numbers and capital letters

PostPosted: Wed Jul 25, 2012 1:56 pm
by BillyBoyo
You mean you have a solution but you don't like it? Can you post it here please?

Re: Include rows with numbers and capital letters

PostPosted: Wed Jul 25, 2012 1:59 pm
by xcspg3
I haven't a solution...

Re: Include rows with numbers and capital letters

PostPosted: Wed Jul 25, 2012 4:21 pm
by BillyBoyo
Sorry, missed the rather crucial word "not" in your first posting.

You have some data which you need to validate for numeric-or-alpha-upper only?

Have you looked in the Smart DFSORT Tricks? I'm not saying it is there, but it is a good thing to look at the table-of-contents and see some of the things available.

How many characters do you need to test? There is a NUM available for identifying a numeric. You can also test a single byte for multiple values using SS.

If you look up all that, and see if it leads you anywhere, if it doesn't come back with a fuller explanation and some sample data.

Re: Include rows with numbers and capital letters

PostPosted: Wed Jul 25, 2012 5:22 pm
by xcspg3
The number of characters is 1798 and so it isn't a good idea use a test for 1798 times.

Example
ABCD
AbCD
1234
12a4

The first and third row are ok, the other rows are KO.

max

Re: Include rows with numbers and capital letters

PostPosted: Wed Jul 25, 2012 6:11 pm
by BillyBoyo
VB or FB? Whole record or parts? If parts, what are each start-position and length, given that contiguous fields only need one start-position and length (within reason)?

Plus anything else which may benefit in our understanding...

Re: Include rows with numbers and capital letters

PostPosted: Wed Jul 25, 2012 6:32 pm
by xcspg3
Input is FB
Whole record: 1798 characters.

I don't like use the test
pos,1,GE,C'0',AND,pos,1,LE,C'9',pos,1,GE,C'A',AND,pos,1,LE,C'Z',
where pos is 1,2,3,......,1798

In my example there is a small record and so not 1798 chars.

thanks

Re: Include rows with numbers and capital letters

PostPosted: Wed Jul 25, 2012 7:21 pm
by BillyBoyo
OK.

What you suggest wouldn't "work", as there are "gaps" in between three groups of letters (9, 9 and 8 letters in each group).

How about doing a big FINDREP, changing 1 through 9, A through I, J through R and S through Z to C' ' (blank). Then you can test (in chunks) whether the record is entirely space. If it is entirely space, then you know that it was all numbers or uppercase letters.

There is an "obvious" problem with this. The data has now gone. You'd need to add a sequence number and then have a second step to match, with JOINKEYS, your good/bad ones against the original.

If that does not suit, you can "generate" all the IF statements to save all the typing.

Re: Include rows with numbers and capital letters

PostPosted: Wed Jul 25, 2012 11:39 pm
by skolusu
xcspg3 wrote:The number of characters is 1798 and so it isn't a good idea use a test for 1798 times.

Example
ABCD
AbCD
1234
12a4

The first and third row are ok, the other rows are KO.

max



The easiest way would be eliminating the lower case letters using OMIT COND with SS format. SS format can check in chucks of 256 bytes , so split the 1798 into 8 chunks and perform a check. Use the following DFSORT JCL which will give you the desired results.
//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SYMNAMES DD *                                         
F1,1,256,SS                                             
F2,*,256,SS                                             
F3,*,256,SS                                             
F4,*,256,SS                                             
F5,*,256,SS                                             
F6,*,256,SS                                             
F7,*,256,SS                                             
F8,*,6,SS                                               
//SORTIN   DD DISP=SHR,DSN=Your input FB 1798 byte file
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                     
  OMIT COND=(F1,EQ,C'a',OR,F2,EQ,C'a',OR,F3,EQ,C'a',OR,F4,EQ,C'a',OR,
             F5,EQ,C'a',OR,F6,EQ,C'a',OR,F7,EQ,C'a',OR,F8,EQ,C'a',OR,
             F1,EQ,C'b',OR,F2,EQ,C'b',OR,F3,EQ,C'b',OR,F4,EQ,C'b',OR,
             F5,EQ,C'b',OR,F6,EQ,C'b',OR,F7,EQ,C'b',OR,F8,EQ,C'b',OR,
             F1,EQ,C'c',OR,F2,EQ,C'c',OR,F3,EQ,C'c',OR,F4,EQ,C'c',OR,
             F5,EQ,C'c',OR,F6,EQ,C'c',OR,F7,EQ,C'c',OR,F8,EQ,C'c',OR,
             F1,EQ,C'd',OR,F2,EQ,C'd',OR,F3,EQ,C'd',OR,F4,EQ,C'd',OR,
             F5,EQ,C'd',OR,F6,EQ,C'd',OR,F7,EQ,C'd',OR,F8,EQ,C'd',OR,
             F1,EQ,C'e',OR,F2,EQ,C'e',OR,F3,EQ,C'e',OR,F4,EQ,C'e',OR,
             F5,EQ,C'e',OR,F6,EQ,C'e',OR,F7,EQ,C'e',OR,F8,EQ,C'e',OR,
             F1,EQ,C'f',OR,F2,EQ,C'f',OR,F3,EQ,C'f',OR,F4,EQ,C'f',OR,
             F5,EQ,C'f',OR,F6,EQ,C'f',OR,F7,EQ,C'f',OR,F8,EQ,C'f',OR,
             F1,EQ,C'g',OR,F2,EQ,C'g',OR,F3,EQ,C'g',OR,F4,EQ,C'g',OR,
             F5,EQ,C'g',OR,F6,EQ,C'g',OR,F7,EQ,C'g',OR,F8,EQ,C'g',OR,
             F1,EQ,C'h',OR,F2,EQ,C'h',OR,F3,EQ,C'h',OR,F4,EQ,C'h',OR,
             F5,EQ,C'h',OR,F6,EQ,C'h',OR,F7,EQ,C'h',OR,F8,EQ,C'h',OR,
             F1,EQ,C'i',OR,F2,EQ,C'i',OR,F3,EQ,C'i',OR,F4,EQ,C'i',OR,
             F5,EQ,C'i',OR,F6,EQ,C'i',OR,F7,EQ,C'i',OR,F8,EQ,C'i',OR,
             F1,EQ,C'j',OR,F2,EQ,C'j',OR,F3,EQ,C'j',OR,F4,EQ,C'j',OR,
             F5,EQ,C'j',OR,F6,EQ,C'j',OR,F7,EQ,C'j',OR,F8,EQ,C'j',OR,
             F1,EQ,C'k',OR,F2,EQ,C'k',OR,F3,EQ,C'k',OR,F4,EQ,C'k',OR,
             F5,EQ,C'k',OR,F6,EQ,C'k',OR,F7,EQ,C'k',OR,F8,EQ,C'k',OR,
             F1,EQ,C'l',OR,F2,EQ,C'l',OR,F3,EQ,C'l',OR,F4,EQ,C'l',OR,
             F5,EQ,C'l',OR,F6,EQ,C'l',OR,F7,EQ,C'l',OR,F8,EQ,C'l',OR,
             F1,EQ,C'm',OR,F2,EQ,C'm',OR,F3,EQ,C'm',OR,F4,EQ,C'm',OR,
             F5,EQ,C'm',OR,F6,EQ,C'm',OR,F7,EQ,C'm',OR,F8,EQ,C'm',OR,
             F1,EQ,C'n',OR,F2,EQ,C'n',OR,F3,EQ,C'n',OR,F4,EQ,C'n',OR,
             F5,EQ,C'n',OR,F6,EQ,C'n',OR,F7,EQ,C'n',OR,F8,EQ,C'n',OR,
             F1,EQ,C'o',OR,F2,EQ,C'o',OR,F3,EQ,C'o',OR,F4,EQ,C'o',OR,
             F5,EQ,C'o',OR,F6,EQ,C'o',OR,F7,EQ,C'o',OR,F8,EQ,C'o',OR,
             F1,EQ,C'p',OR,F2,EQ,C'p',OR,F3,EQ,C'p',OR,F4,EQ,C'p',OR,
             F5,EQ,C'p',OR,F6,EQ,C'p',OR,F7,EQ,C'p',OR,F8,EQ,C'p',OR,
             F1,EQ,C'q',OR,F2,EQ,C'q',OR,F3,EQ,C'q',OR,F4,EQ,C'q',OR,
             F5,EQ,C'q',OR,F6,EQ,C'q',OR,F7,EQ,C'q',OR,F8,EQ,C'q',OR,
             F1,EQ,C'r',OR,F2,EQ,C'r',OR,F3,EQ,C'r',OR,F4,EQ,C'r',OR,
             F5,EQ,C'r',OR,F6,EQ,C'r',OR,F7,EQ,C'r',OR,F8,EQ,C'r',OR,
             F1,EQ,C's',OR,F2,EQ,C's',OR,F3,EQ,C's',OR,F4,EQ,C's',OR,
             F5,EQ,C's',OR,F6,EQ,C's',OR,F7,EQ,C's',OR,F8,EQ,C's',OR,
             F1,EQ,C't',OR,F2,EQ,C't',OR,F3,EQ,C't',OR,F4,EQ,C't',OR,
             F5,EQ,C't',OR,F6,EQ,C't',OR,F7,EQ,C't',OR,F8,EQ,C't',OR,
             F1,EQ,C'u',OR,F2,EQ,C'u',OR,F3,EQ,C'u',OR,F4,EQ,C'u',OR,
             F5,EQ,C'u',OR,F6,EQ,C'u',OR,F7,EQ,C'u',OR,F8,EQ,C'u',OR,
             F1,EQ,C'v',OR,F2,EQ,C'v',OR,F3,EQ,C'v',OR,F4,EQ,C'v',OR,
             F5,EQ,C'v',OR,F6,EQ,C'v',OR,F7,EQ,C'v',OR,F8,EQ,C'v',OR,
             F1,EQ,C'w',OR,F2,EQ,C'w',OR,F3,EQ,C'w',OR,F4,EQ,C'w',OR,
             F5,EQ,C'w',OR,F6,EQ,C'w',OR,F7,EQ,C'w',OR,F8,EQ,C'w',OR,
             F1,EQ,C'x',OR,F2,EQ,C'x',OR,F3,EQ,C'x',OR,F4,EQ,C'x',OR,
             F5,EQ,C'x',OR,F6,EQ,C'x',OR,F7,EQ,C'x',OR,F8,EQ,C'x',OR,
             F1,EQ,C'y',OR,F2,EQ,C'y',OR,F3,EQ,C'y',OR,F4,EQ,C'y',OR,
             F5,EQ,C'y',OR,F6,EQ,C'y',OR,F7,EQ,C'y',OR,F8,EQ,C'y',OR,
             F1,EQ,C'z',OR,F2,EQ,C'z',OR,F3,EQ,C'z',OR,F4,EQ,C'z',OR,
             F5,EQ,C'z',OR,F6,EQ,C'z',OR,F7,EQ,C'z',OR,F8,EQ,C'z')         
//*