Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GREAT date conversion routine!

Status
Not open for further replies.

StephenJSpiro

Programmer
Jul 10, 2001
143
US
Terry Heinze posted this in comp.lang.cobol, and I thought it was so great, I want to share it!

*-----------------
You could save yourself some overhead by using:
MULTIPLY YYMMDD BY 100.0001 GIVING MMDDYY
and
MULTIPLY MMDDYY BY 10000.01 GIVING YYMMDD.
Those can be modified to include century for Y2K, also.

....Terry
P.S. Here in MN, we use shortcuts, Mike! :)
*-----------------

Of course, the receiving fields truncate the result! Try the arithmetic ... it really works!

Stephen J Spiro
 
Yes this is well known but not recommended:

1) multiply is much slower than the moves
2) scanning software assumes that dates are not to be multiplied

This algorithm is used in no-COBOL environments.

Regards,

Crox

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top