.Net Class to Obtain Regional PC Settings

0 Likes
over 8 years ago

Problem

In .Net how can COBOL find out the regional settings that are currently in use for a class.

 

Solution

The .Net Framework provides the class System.Globalization.CultureInfo that allows you to obtain regional characteristics.

Some sample code that uses this class is:-

 

      $set ilusing"System.Globalization" 
       program-id. Program1 as "CurrentCulture.Program1".

       data division.
       working-storage section.
       01  Cult        type CultureInfo.

       procedure division.
       
      ***** Obtan the Culture Information from the Current Thread 
           set Cult to type CultureInfo::CurrentCulture
           
       
      ***** Display some Values from the Culture Class 
           display "Current Locale= " Cult::EnglishName
           display "Current Date and Time Format = " Cult::DateTimeFormat::FullDateTimePattern
           display "Currency Symbol = " Cult::NumberFormat::CurrencySymbol
           display "Decimal Indicator = " Cult::NumberFormat::NumberDecimalSeparator

           goback.
           
       end program Program1.

 

 

 

 

Comment List
Anonymous
Related Discussions
Recommended