Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert lower to upper case from input terminal

Status
Not open for further replies.

thorfour

Programmer
Jun 9, 1999
9
US
Have a need to convert terminal input from lower to upper case, but<br>
it must be accomplished with COBOL language; no calls to Assembler<br>
are acceptable to the site.
 
What are you using for the terminal input? Are you using CICS?
 
Should have specified that. Yes, I'm converting<br>
a CICS macro level assembler program to a CICS<br>
COBOL OS/390 program. I could use an Assembler<br>
CALL subroutine to do the job, but my clients<br>
would rather COBOL be used. Thanks.
 
Not very elegant but one option is to use the INSPECT statement. I have not used it but the syntax would be something like:<br>
<br>
INSPECT WS-FIELD REPLACING ALL "a" BY "A"<br>
<br>
I guess you would have to repeat the statement 26 times. Maybe you can create a table of conversion characters and have a routine that spins through it...<br>

 
Good idea! In fact, I just came across a new<br>
implementation for INSPECT on COBOL II , release 3<br>
and later:<br>
INSPECT WS-FIELD <br>
CONVERTING 'abcd...' TO 'ABCD...'<br>
I'll try and let you know what happened. <br>
Thanks.
 
The INSPECT worked like a champ.<br>
I used <br>
INSPECT WS-FIELD<br>
CONVERTING 'abcdefghijklmnopqrstuvwxyz'<br>
TO 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'<br>
and the reverse (to convert upper to lower case).<br>
The reverse also worked.<br>
It doesn't care how many times a letter appears.<br>
It converts every one. Also, it won't bother a<br>
letter if it's already "converted."<br>
Thanks again. <br>
<br>
<br>

 
your cobol version support UPPER ???
if yes then
accept ws-text at lincol with upper.
 
Seeing as how you are on an OS/390 box, I'm assuming that you are using the latest COBOL for OS/390 and VM. If so, you can simply use:

MOVE FUNCTION UPPER-CASE (field-name) TO field-name

[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top