View previous topic :: View next topic |
Author |
Message |
madisand Beginner
Joined: 29 Aug 2005 Posts: 19 Topics: 7
|
Posted: Thu Mar 26, 2009 8:40 am Post subject: Lowercase field reporting |
|
|
I have file which contains a field of 40 characters. Is there a utility in which I can identify if any of the 40 characters contain a lowercase character and report it ? |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu Mar 26, 2009 9:00 am Post subject: |
|
|
application programming is not really the forum to post this question.
i imagine that you could build some sort cards that would accomplish this.
you could also view the file and xclude P'<' in the columns responding to the 40 char field. you could delete the non-xcluded and then create a new file with the remaining lines.
you possibly could use searchfor, but the max output is only 133 char -
you could write a cobol program to perform this function.
if the file is not to big (rlen and record volume) you could write a quick rexx script.
if you have ezytrieve (or something similar - SAS) you could also write a quick and dirty to accomplish this task. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
computer Beginner
Joined: 12 Jun 2007 Posts: 64 Topics: 17 Location: Hyderabad
|
Posted: Thu Mar 26, 2009 9:15 am Post subject: |
|
|
Hi madisand,
Here is an COBOL program which will serve your purpose.
In cobol we have inbuit function which can retrieve the charater when a ascii code is passed to the function.
Now first retrieve all the ASCII characters for all the lower case letters....
check the link:http://docs.hp.com/cgi-bin/doc3k/B3150090013.11820/122
Thanks,
computer
Now do as shown below,
01 ASCII-a PIC 9(02) VALUE 'ascii value of a'
01 VARIABLE
05 VAR PIC X(40)
05 VAR1 REDEFINES VAR PIC 9 OCCURS 40 TIMES.
MOVE VAR TO VAR1.
Keep this loop for all 4o chanracters
IF FUNCTION CHAR(ASCII-a) = 'a' / VAR1(I)
DISPLAY 'LOWER CASE LETTERS EXISTS'
ELSE
DISPLAY 'LOWER CASE LETTERS DOES NOT EXISTS'
END-IF |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu Mar 26, 2009 9:31 am Post subject: |
|
|
why would anyone want to search for ASCII hex values on an IBM machine?
madisand,
I would INSPECT the 40 char field looking for less than 'A' (capital A) and not = SPACES. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
jsharon1248 Intermediate
Joined: 08 Aug 2007 Posts: 291 Topics: 2 Location: Chicago
|
Posted: Thu Mar 26, 2009 11:47 am Post subject: |
|
|
You posted in the Application Programming section, so if you need a COBOL solution, use a class test.
Code: | ALPHABETIC-LOWER
Identifier consists entirely of any combination of the lowercase alphabetic characters a through z and the space. |
Code: | PERFORM VARYING X FROM 1 BY 1 UNTIL X > LENGTH OF STRING-VAR
IF STRING-VAR(X:1) IS ALPHABETIC-LOWER
<it's lower case>
ELSE
<it's not lower case>
END-IF
END-PERFORM |
|
|
Back to top |
|
 |
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Fri May 08, 2009 9:38 pm Post subject: |
|
|
Not sure what your requirement is, but if you just want to verify that all chars are ALPHABETIC-LOWER you can just code: Code: | IF STRING-VAR IS NOT ALPHABETIC-LOWER
PERFORM ERR-RTN
ELSE
DO-GOOD-STUFF
END-IF |
If you can't use the SPACE as jsharon noted, you can create your own CLASS, e.g. MY-ALPHA-LOWER, without the SPACE.
See the SPECIAL-NAMES paragraph section of the COBOL Ref Guide. _________________ Regards, Jack.
"A problem well stated is a problem half solved" -- Charles F. Kettering |
|
Back to top |
|
 |
|
|