IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Converting upper case tp lower case ?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
LlewellynNaicker

New User


Joined: 22 Mar 2005
Posts: 5

PostPosted: Tue Mar 22, 2005 5:08 pm
Reply with quote

Hi people I am new to this forum but I am a bit stuck icon_sad.gif 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 icon_smile.gif
Back to top
View user's profile Send private message
sunnyk

New User


Joined: 20 Oct 2004
Posts: 59

PostPosted: Tue Mar 22, 2005 6:10 pm
Reply with quote

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
View user's profile Send private message
sunnyk

New User


Joined: 20 Oct 2004
Posts: 59

PostPosted: Tue Mar 22, 2005 6:19 pm
Reply with quote

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
View user's profile Send private message
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

PostPosted: Tue Mar 22, 2005 8:35 pm
Reply with quote

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
View user's profile Send private message
LlewellynNaicker

New User


Joined: 22 Mar 2005
Posts: 5

PostPosted: Wed Mar 23, 2005 6:57 pm
Reply with quote

Thanx a million guys I will try this out. icon_biggrin.gif
Back to top
View user's profile Send private message
sribks2005

New User


Joined: 04 Apr 2005
Posts: 20
Location: Mysore

PostPosted: Wed Apr 13, 2005 12:23 pm
Reply with quote

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
View user's profile Send private message
chayanath

New User


Joined: 07 Mar 2005
Posts: 6
Location: vijayawda

PostPosted: Mon May 23, 2005 9:12 pm
Reply with quote

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
View user's profile Send private message
eashwar

New User


Joined: 21 May 2005
Posts: 26
Location: Bangalore

PostPosted: Tue May 24, 2005 2:24 am
Reply with quote

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
View user's profile Send private message
vinodmaanju

New User


Joined: 10 May 2005
Posts: 28
Location: Pune

PostPosted: Mon Jan 09, 2006 11:41 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Zunit Test case editor error Testing & Performance 4
No new posts Converting fixed length file to excel... IBM Tools 7
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Converting S9(18) value to a decimal ... DFSORT/ICETOOL 6
Search our Forums:

Back to Top