|
My previous reply was a little cryptic and wordy, so lets try some sample code. Process statement: I have never used quotations, just apostrophies. The date, time, and timestamp let me use the date data types in the code. Compiler takes care of definitions. I like the process statement because I don't have to remember to change the compile options each time I compile the program. PROCESS TIME DATE DATESTAMP APOST In working storage the definitions of the date fields are setup. The code following the FORMAT DATE is the way the date will be stored. In this case the year is 'yy' and the day is 'ddd' with the separator of '/'. Working Storage. 01 Date-Fields 05 Ws-Julian-Date Format Date '%y/%j'. 05 Ws-Redefined-date redefines Ws-Julian-Date 10 Ws-Julian-Year Pic X(02). 10 Ws-Seperator Pic X(01). 10 Ws-Julian-Day Pic X(03). Procedure Division. In the procedure division the move uses the intrinsic function to translate the date to the julian date. MOVE FUNCTION CONVERT-DATE-TIME(Date-Field-Name DATE '@C%y%m%d') to Ws-Julian-Date The first parm of the CONVERT-DATE-TIME function is the field being moved. The second is what is being translated, DATE TIME or TIMESTAMP. The third is the format the date being moved is in. In this case it states that the century is represented by a single digit (0 = 1900, 1 = 2000) followed by a 2 digit each yymmdd. The receiving field is the julian date. once the move has taken place, the WS-JULIAN-YEAR and WS-JULIAN-DAY are available for use. The format expressions are easy to use, and can be found in tables 5 and 9 of the online code/400 ILE COBOL REFERENCE. Table 5 url: http://localhost:49213/cgi-bin/vahwebx.exe/vahelp/va400/Extract/0/qcodemrm/evfbilsh112.htm#TBLSPECF Table 9 url: http://localhost:49213/cgi-bin/vahwebx.exe/vahelp/va400/Extract/0/qcodemrm/evfbilsh230.htm#TBLDATEF ----------------------------------- Jim Essinger Senior Programmer/Analyst Student Loan Fund of Idaho esinger@fmtc.com 208-452-4058 -----------------------------------
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.