upper case to lower case



High Level Assembler(HLASM) for MVS & VM & VSE

upper case to lower case

Postby blackswan » Mon Oct 15, 2012 4:20 pm

Hi all,

Is there any instruction to change a string of upper case into lower case.

How can we toggle the strings.

please help

regards
blackswan
 
Posts: 13
Joined: Thu Sep 13, 2012 2:39 pm
Has thanked: 0 time
Been thanked: 1 time

Re: upper case to lower case

Postby BillyBoyo » Mon Oct 15, 2012 4:24 pm

You want to do it in Assembler?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: upper case to lower case

Postby blackswan » Mon Oct 15, 2012 4:27 pm

Hi Billy

Yes. Can it be possible?
blackswan
 
Posts: 13
Joined: Thu Sep 13, 2012 2:39 pm
Has thanked: 0 time
Been thanked: 1 time

Re: upper case to lower case

Postby BillyBoyo » Mon Oct 15, 2012 4:39 pm

Yes, it can be done. Since any high-level language has to come down to the machine instructions, you can do anything that is possible in another language. Just might (not always) take you writing more instructions. I was just checking you really wanted Assembler.

Have you googled a bit? There really are many ways you could go about it. How about having a piece of storage defining all the upper-case letters, a piece of storage defining all the lower-case letters. Find each source character in the appropriate piece of storage, and use that displacement to get it from the "converted value" piece of storage.

Also, have a look at the hex values of upper-case and lower-case letters.

You can think about these things. Work up a couple of things, discovering what else you need to keep in mind.

Something may hit you while you're going along, depending on the sort of stuff you've coded before.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: upper case to lower case

Postby dick scherrer » Tue Oct 16, 2012 8:37 am

Hello,

Do consider that maybe only Some of the case should be "flipped".
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: upper case to lower case

Postby steve-myers » Tue Oct 16, 2012 10:32 am

There's always the translate instruction -
         TR    STRING,TABLE
         ...
STRING   DC    C'UPPER CASE CHARACTERS'
TABLE    DC    0XL256'0',(C'A')AL1(*-TABLE),9AL1(*-TABLE-X'40')
         DC    (C'J'-(*-TABLE))AL1(*-TABLE),9AL1(*-TABLE-X'40')
         DC    (C'S'-(*-TABLE))AL1(*-TABLE),8AL1(*-TABLE-X'40')
         DC    (256-(*-TABLE))AL1(*-TABLE)
The code to generate the TABLE are will not work with the Assist Assembler, but it will work with the IBM Assemblers. Obviously it is tailored to EBCDIC; a table to perform something equivalent for ASCII would be different

(C'A')AL1(*-TABLE) generates bytes to translate characters from X'00' to X'C0' to themselves.
9AL1(*-TABLE-X'40') generates bytes to translate A through I to a through i. The remainder of the table you can figure out for yourself.

The classic code to translate EBCDIC lower case characters to upper case is OC STRING,=256X'40'. This code does not alter the punctuation characters, upper case characters, and numeric characters. Why is an exercise for you. My first thought was something like NC STRING,=256AL1(255-X'40') rather than the TR, but I realized it would disturb the punctuation characters, and the numbers. Oops.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: upper case to lower case

Postby blackswan » Tue Oct 16, 2012 11:04 am

Hi Billy, Hi Steve, Hi sherrer,

Thanks... I think i need to try again in my own.,.. then if i will face any prob i can show you all with the program...

@steve: thanks for example
blackswan
 
Posts: 13
Joined: Thu Sep 13, 2012 2:39 pm
Has thanked: 0 time
Been thanked: 1 time

Re: upper case to lower case

Postby dick scherrer » Tue Oct 16, 2012 8:12 pm

You're welcome - someone will be here when there are questions :)

d
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to Assembler