© Matti Mattila, CPFA, CISA, CIA

7. Macro for uppercase / lowercase change (CHMM)

Previous Item Next item Previous menu
CHMM macro, introduced here, changes characters of a data file to uppercase or to lowercase according to the user's choice. The contents of the orginal file are written into a new file, where all characters are either in uppercase or in lowercase. The original data file remains unchanged.
Picture 1
Picture 2
Picture 3
Due to the functionality of IDEAScript each line of the new file will start and end with a quotation mark ("). As a result each file of the new file is two characters longer than the original line, and the file size is bigger respectively.
The macro is made with IDEA 2002. It is possible that IDEAScript of newer IDEA versions are not able to execute the macro properly.
Running the macro [1].
- After unzipping the contents of CMM.ZIP, demo version of CHMM, to a folder start IDEA.
- Select: Tools - Macros - Run.. In the dialog box select file type '*.ise' (a compiled macro) and thereafter select CMM.ise as shown in picture 1.
- You are first shown contents of 'cmm.txt' (not shown here). Click 'OK' after reading it. After that you are shown dialog in picture 2.
- We have a data file 'G98.sal' consisting of 10.990 rows, each 86 characters long. We open it with notepad and see that all of the characters of the file are uppercase [2].
- We want to change the characters of 'G98.sal' to lowercase. In order to accomplish this task we select 'Select to lowercase' option and click 'Select a File'.
- Next, we select 'G98.sal' and click 'Open'.
- We are asked to select, whether to change the characters of the file to uppercase or to lowercase. This time we select the latter option and click 'OK' (picture 3).
- The macro makes the change and displays a message [3] telling that a new file has been created. Its number of lines is 500. Number of lines in the original file: 10990.
NOTE! Because the macro is a demo version, only 500 first lines of the original file were processed.
- Finally we check the new file: [4] Again we use notepad. We can see that all of the characters of the new file are lowercase, and the contents of the original file are in quotation marks.
Download
You can download demo version of CHMM (CMM) here [5].

[1] See also the instructions in the 'readme_cmm.txt' file.
[2]
[3]
1]
[4] The zip file 'cmm.zip' contains files 'CMM.ise', 'cmm.txt' and 'readme_cmm.txt'. NOTE! If you make any change in 'cmm.txt' the macro cannot be run.
See also functionality of 'TexEdi' Excel macro in changing text to uppercase/lowercase!