Tuesday, April 27, 2010

How to retrieve the current date in COBOL

ACCEPT WS-DATE FROM DATE the result will fetch date in YYMMDD format 080218
ACCEPT WS-CURR-DATE FROM DATE YYYYMMDD the result will fetch date in YYYYMMDD format 20080218



EXCP CPU SRB CLOCK SERV PG PAGE SWAP VIO SWAPS STEPNO
43 .00 .00 .00 1930 0 0 0 0 0 1

I did some simple tests with DB2 calls and plain vanilla cobol.
Here are the results...

SELECT CURRENT_DATE FROM SYSIBM.SYSDUMMY1 is another option which is not recommended as the same would cause additional DB calls and affect the performance of the program.


EXCP CPU SRB CLOCK SERV PG PAGE SWAP VIO SWAPS STEPNO
281 .00 .00 .00 9802 0 0 0 0 0 1


EXCP: The number of EXCPs (Execute Channel Program) performed during the measurement interval.
SRB: The number of CPU seconds consumed in SRB mode during the measurement interval. This does not include any SRB time consumed by the Application Performance Analyzer measurement task.
SERV: CPU SERV + I/O SERV + OTH SERV


Things to try out:
Why do we select current date from SYSIBM.SYSDUMMY1 and what will happen if we select date from any other table.

No comments:

Post a Comment