View previous topic :: View next topic
|
Author |
Message |
LlewellynNaicker
New User
Joined: 22 Mar 2005 Posts: 5
|
|
|
|
Hi people I am new to this forum but I am a bit stuck I am trying to convert a field from upper case to lower case alphabet.
Is there any other way to do it besides "FUNCTION" ??
I am using Vs Cobol II.
Thanx in advance.
Llewellyn |
|
Back to top |
|
|
sunnyk
New User
Joined: 20 Oct 2004 Posts: 59
|
|
|
|
U can use the following statement in cobol:
INSPECT ALPHA-VALUE CONVERTING
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
TO 'abcdefghijklmnopqrstuvwxyz'
here ur input-field is say 'ABHSJWLWIQ'.....after above conversion it will become 'abhsjwlwiq'.
Just try this out
Thanks
sunny |
|
Back to top |
|
|
sunnyk
New User
Joined: 20 Oct 2004 Posts: 59
|
|
|
|
Hi,
U CAN ALSO USE:
INSPECT LOWER-VALUE CONVERTING
X'818283848586878889919293949596979899A2A3A4A5A6A7A8A9'
TO X'C1C2C3C4C5C6C7C8C9D1D2D3D4D5D6D7D8D9E2E3E4E5E6E7E8E9'
This `ll convert lower case to upper case.
INSPECT UPPER-VALUE CONVERTING
X'C1C2C3C4C5C6C7C8C9D1D2D3D4D5D6D7D8D9E2E3E4E5E6E7E8E9'
To
X'818283848586878889919293949596979899A2A3A4A5A6A7A8A9'
This `ll convert upper case to lower case.
Thanks
sunny |
|
Back to top |
|
|
ovreddy
Active User
Joined: 06 Dec 2004 Posts: 211 Location: Keane Inc., Minneapolis USA.
|
|
|
|
Hi,
Welcome to forum. You can convert uppercase text into lower case in 2 ways
1. Using INSPECT as follows
INSPECT DATA-4
CONVERTING
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" TO "abcdefghijklmnopqrstuvwxyz"
2. You can use Instrict function LOWER-CASE() as follows...
Move "UPPERCASE DATA" TO VAR1.
MOVE FUNCTION LOWER-CASE(VAR1) TO VAR2.
DISPLAY VAR2.
Bye,
Reddy. |
|
Back to top |
|
|
LlewellynNaicker
New User
Joined: 22 Mar 2005 Posts: 5
|
|
|
|
Thanx a million guys I will try this out. |
|
Back to top |
|
|
sribks2005
New User
Joined: 04 Apr 2005 Posts: 20 Location: Mysore
|
|
|
|
hi sunny,
I tried with the solution u had given thru the below given code in procedure division.
lower-value is declared in WS section as pic x(10).
===============================================
move "abc" to lower-value.
display "before=" lower-value.
INSPECT LOWER-VALUE CONVERTING
X'818283848586878889919293949596979899A2A3A4A5A6A7A8A9'
tO X'C1C2C3C4C5C6C7C8C9D1D2D3D4D5D6D7D8D9E2E3E4E5E6E7E8E9'
display "after=" lower-value.
===============================================
but both before and after executing the INSPECT , lower-value is containing "abc" only. why is this?
Is the way i have used the INSPECT correct??
Waiting for your reply
thank you |
|
Back to top |
|
|
chayanath
New User
Joined: 07 Mar 2005 Posts: 6 Location: vijayawda
|
|
|
|
hello,
to convert upper-lower case and vice-versa do folowing:
1)Procedure division :
MOVE FUCTION UPPER-CASE("hello") TO DATA1.
THE content of data1 after execution is HELLO
DATA1 be alpha-numeric
Same procedure to convert upper-case to lower-case.
hope this solves ur problem
chayanath |
|
Back to top |
|
|
eashwar
New User
Joined: 21 May 2005 Posts: 26 Location: Bangalore
|
|
|
|
hi,
this is a mere guess
add 64 to each character.
if you got it then ok
other wise ignore it
because i'm also not very sure abt it |
|
Back to top |
|
|
vinodmaanju
New User
Joined: 10 May 2005 Posts: 28 Location: Pune
|
|
|
|
USING FUNCTION LOWER-CASE OR UPPER-CASE YOU CAN CHANGE CASE.
EXAMPLE :
WORKING-STORAGE SECTION.
77 A PIC X(5) VALUE 'ABCDE'.
77 B PIC X(5).
PROCEDURE DIVISION.
MOVE FUNCTION LOWER-CASE(A) TO B.
DISPLAY ' B : ' B.
STOP RUN.
OUTPUT WILL BE : abcde |
|
Back to top |
|
|
|