Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Lower Case to upper Case

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Fri Mar 28, 2008 4:09 pm    Post subject: Lower Case to upper Case
Reply with quote

Hi guys,
I want to know how to convert a value which we get through the input file from lower case to upper case
Back to top
View user's profile Send private message

Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Fri Mar 28, 2008 4:23 pm    Post subject:
Reply with quote

What about this?
Code:
FUNCTION UPPER-CASE--(--argument-1--)
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Sat Mar 29, 2008 2:47 am    Post subject: Lower Case to upper Case
Reply with quote

You can stay "in-line" with the following INSPECT (with literals and no reference modification) and avoid the "BALR" using FUNCTION UPPER-CASE. Instead, this generates a single "TR" instruction -

Code:

            03  WS-STRING               PIC X(06) VALUE X'818283848586'.
       *
            INSPECT WS-STRING           CONVERTING X'81828384858687888991
       -                                            '9293949596979899A2A3
       -                                            'A4A5A6A7A8A9'       
                                        TO 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.

Regards,

Bill
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Sat Mar 29, 2008 6:02 am    Post subject:
Reply with quote

If you are changing the full record in a file - it's easy to do it in Sort and feed it to your cobol program without changing your existing COBOL program.
Back to top
View user's profile Send private message
Richa Jain

New User


Joined: 18 Mar 2008
Posts: 35
Location: Gurgaon

PostPosted: Sat Mar 29, 2008 12:26 pm    Post subject:
Reply with quote

If your input string contains only characters, then u can go with this..

Code:

WORKING-STORAGE SECTION.
01 WS-STRING             PIC X(10).           
01 WS-ALPHABTS.                                               
   05 LOWER-CASE PIC X(26) VALUE 'abcdefghijklmnopqrstuvwxyz'.
   05 UPPER-CASE PIC X(26) VALUE 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
.
.
.
PROCEDURE DIVISION.

     MOVE IP-STRING TO WS-STRING
     INSPECT WS-STRING                             
       CONVERTING LOWER-CASE TO UPPER-CASE
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Sat Mar 29, 2008 4:20 pm    Post subject:
Reply with quote

Richa Jain wrote:
If your input string contains only characters, then u can go with this..

Code:

WORKING-STORAGE SECTION.
01 WS-STRING             PIC X(10).           
01 WS-ALPHABTS.                                               
   05 LOWER-CASE PIC X(26) VALUE 'abcdefghijklmnopqrstuvwxyz'.
   05 UPPER-CASE PIC X(26) VALUE 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
.
.
.
PROCEDURE DIVISION.

     MOVE IP-STRING TO WS-STRING
     INSPECT WS-STRING                             
       CONVERTING LOWER-CASE TO UPPER-CASE

This will cause the compiler to generate a BALR (Call) to a COBOL run-time routine.

You might as well use the FUNCTION UPPER-CASE as it is the same level of overhead.

Also, someone could easily set upper-case on in the source and automatically convert the lower-case letters in the VALUE clause of LOWER-CASE to upper-case by accidentally hitting the SPACE bar.

Using hex-notation (X'00') will prevent this.

Bill
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Mar 29, 2008 7:31 pm    Post subject:
Reply with quote

Hello,

If the data to be converted to upper case is an entire record (rather than some particular field), the record must not contain any packed-decimal or binary data. These would most likely cause invalid data conversions.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts RFE: DB2 support for mixed case names. Pedro DB2 0 Tue Jul 04, 2017 1:32 am
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts Summing on Mixed Case Literals Roy Ware SYNCSORT 3 Tue Jan 03, 2017 10:18 pm
No new posts Case insenstive in INCLUDE Condtion smileseenu DFSORT/ICETOOL 2 Mon Feb 15, 2016 8:42 pm
No new posts How steps execute in Job in case of a... richiewalia JCL & VSAM 4 Tue Jan 12, 2016 12:34 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us