There are many predefined methods defined by Cache under Security.* package to maintain/manage Roles/Users/Resources ...ect.

Specific to your query, you can use below command to export/import Roles:

Write ##class(Security.Roles).Export("C:\RolesExport.xml")
Write ##class(Security.Roles).Import("C:\RolesExport.xml")

Roles: 
Please refer to below class doc for more: http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?LIBRARY=%25sys&CLASSNAME=Security.Roles&CSPCHD=000000000000gt0xiwWBxf8D77QROEE$c2JR50xdHrcUuUzSzc&CSPSHARE=1

Resources:
http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?LIBRARY=%25sys&CLASSNAME=Security.Roles&CSPCHD=000000000000gt0xiwWBxf8D77QROEE$c2JR50xdHrcUuUzSzc&CSPSHARE=1

Property UniqueStringValue As %String(COLLATION = "SQLUPPER");
Index ValueIndex On UniqueStringValue [ Unique ];

Use COLLATION as above, to specify the manner in which property values are transformed for indexing.

Below is how data and index will look like,

ZW ^DataGlobal
^DataGlobal=1
^DataGlobal(1)=$lb("",,"Hello")
 
ZW ^IndexGlobal
^IndexGlobal("NameIDX"," HELLO",1)=""
^IndexGlobal("ValueIndex"," HELLO",1)=""

Test:

Write ##class(Package.Data).ValueIndexExists("hello") = 1
Write ##class(Package.Data).ValueIndexExists("HELLO") = 1
Write ##class(Package.Data).ValueIndexExists("heLLO") = 1
Write ##class(Package.Data).ValueIndexExists("hello") = 1
Write ##class(Package.Data).ValueIndexExists("Hello") = 1
Write ##class(Package.Data).ValueIndexExists("HelloGuys") = 0

ISC DocBook: http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GSQL_basics#GSQL_basics_collation

I believe you have figured out the solution for this.

I have just mentioned below list of methods for different fields.

NAME - Name()
SSN - SSN()
COMPANY - Company()
TITLE - Title()
PHONE - USPhone()
CITY - City()
STREET - Street()
ZIP - USZip()
MISSION - Mission()
STATE - USState()
COLOR - Color()
PRODUCT - Product()

DocBook Link:
docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GOBJ_populate

I would suggest to use client side javascript API to check the file size, instead of uploading it to server and check it.

I got a nice article on a blog.

<script language='JavaScript'> 
function checkFileSize(inputFile) {
        var max = 3 * 512 * 512; 
        if (inputFile.files && inputFile.files[0].size > max) { 
                alert("File is too large to upload."); 
                inputFile.value = null; 
        } 
} </script>

Thanks for your response. I looked into the github utcov. But still, the entire approach is w.r.t the INT code rather than the actual lines of code in classes. Also, when you have thousands of classes running in production for many clients, its difficult to even change the comment with #;. That's a huge effort though. But, adding the unit test cases even for a old code is like covering the tech debt, and that's a ongoing practice.

Having said that, I was really looking for something easy solution like any other language has. May be once we star using Atelier, there could be some addin or frameworks to use with Cache Object Scripts.

Typically this is  a very common issue I have observed many times.

If I have understood this correctly, you have comma(,) in values. You want to export that values into a comma(,) separated CSV file. So, the comma(,) in values are also being considered as delimiter.

Easy solution would be enclosed it with double quote. by default if you open the csv file into EXCEL, commas in values will not be considered as delimiter if its enclosed in double quote.

So, with reference to your code:

S file="C:\Export.CSV"
O file:("RSN"):2
U file w """"_name_""","""_details_"""",!
C file


Two double quote will represent one double quote finally in the output ("")->(").

Please let me know if you tried this, and this resolved your problem.

Thanks,

Tirthankar