Created On:  02 October 2012

Problem:

Customer is converting an application created using Net Express and Oracle Pro*COBOL to Visual COBOL managed code using OpenESQL.
In Pro*COBOL they could use the following statement to change the date format of date fields returned in SQL queries:

EXEC SQL ALTER SESSION SET NLS_DATE_FORMAT = 'MM-DD-YYYY' END-EXEC.

Is there an equivalent method in Visual COBOL using OpenESQL?

Resolution:

Starting in Visual COBOL 2.1 several SQL directives have been added to control the returned formats of SQL Date and Time fields.

Please see Visual COBOL documentation under Data Access, Database Access > Reference > OpenESQL > Compiler directives for full details of these directives.

DATE
Controls the reformatting of date values in output parameters and in input parameter character host variables when DETECTDATE is also specified.

TIME
Controls the reformatting of date values in output parameters and in input parameter character host variables when DETECTDATE is also used.

DATEDELIM
Specifies a single character as the delimiter between the year, month, and day components to override the default delimiter determined by the DIALECT or DATE directive specification.

TIMEDELIM
Specifies a single character as the delimiter between the hour, minute, and second components to override the default delimiter determined by the DIALECT or TIME directive specification.

TSTAMPSEP
Specifies a single character as the separator between the date and time parts of timestamp and date/time data.

Incident #2574103