View previous topic :: View next topic |
Author |
Message |
tcurrier Intermediate
Joined: 10 Feb 2006 Posts: 188 Topics: 68
|
Posted: Thu Apr 08, 2010 1:48 pm Post subject: INSPECT - checking 2 values instead of 1 ? |
|
|
Ising 'inspect tallying', can I check for 2 values instead of 1 ?
I want to compute the length of data in a field, ignoring any trailing
spaces OR low-values....
This obviously doesn't work, but would there be another way to do it ?
Code: | INSPECT FUNCTION REVERSE(W-TEXT) TALLYING W-TALLY
FOR LEADING SPACES OR LOW-VALUES. |
Thanks... |
|
Back to top |
|
|
papadi Supermod
Joined: 20 Oct 2009 Posts: 594 Topics: 1
|
Posted: Thu Apr 08, 2010 3:23 pm Post subject: |
|
|
One way would be to move this field to a work field, replace all of the low-values with zeros, then do the reverse inspect tallying leading spaces.
If it is ok to remove the low-values, the move to the work field would not be needed. _________________ All the best,
di |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Apr 08, 2010 4:17 pm Post subject: |
|
|
tcurrier,
Unless I am missing something , doesn't removing the OR work?
This would work for ALL trailing spaces or ALL trailing low values ,but I guess it wouldn't work for mixed bag of both trailing spaces with embedded low-values
Code: |
INSPECT FUNCTION REVERSE(W-TEXT) TALLYING W-TALLY
FOR LEADING SPACES LOW-VALUES.
|
Kolusu |
|
Back to top |
|
|
tcurrier Intermediate
Joined: 10 Feb 2006 Posts: 188 Topics: 68
|
Posted: Thu Apr 08, 2010 5:24 pm Post subject: |
|
|
Thanks, Kolusu...
That does work if the trailing bytes are ALL spaces or ALL low-values....
I doubt that we would ever have a combination of both in the same field anyway....
TC |
|
Back to top |
|
|
tcurrier Intermediate
Joined: 10 Feb 2006 Posts: 188 Topics: 68
|
Posted: Thu Apr 08, 2010 5:28 pm Post subject: |
|
|
Sorry, Papadi....
Didn't see your reply at first... That's also a good idea..
Thanks,
TC |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu Apr 08, 2010 5:44 pm Post subject: |
|
|
why not negatively increment an index, preset to LENGTH of W-TEXT
and PERFORM until TEXT(index) > spaces (remembering that spaces are > LVs, x'40' > x'00)
the index will then have your length, and you save the time of an INSPECT.
wasting time converting x'00' to x'40' means two passes thru W-TEXT. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
|
|