×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Mike,

If you are using ILE COBOL and date data types, you can use
a move statement or the intrinsic function
CONVERT-DATE-TIME.  Set up working storage field to contain
the DATE data type and define it as a julian date.
 Redefine the julian date so you can get at the year and
day.  Use the following:


(copied from the code/400 online manual)

>>-FUNCTION
CONVERT-DATE-TIME----------------------------------->

>----(--argument-1--argument-2--+-----------------------------+---)->
                                '-argument-3--+------------+--'
                                              '-argument-4-'

>--------------------------------------------------------------><


argument-1
Can be:
A date, time, or timestamp item
An item of class alphanumeric
A non-numeric literal
An item of class numeric integer.

argument-2
Specifies the category of the return value and must be one
of the following keywords:
DATE
TIME
TIMESTAMP.
If argument-1 is a date, time, or timestamp item,
CONVERT-DATE-TIME can only convert:

A date to a date, or a timestamp
A time to a time, or a timestamp
A timestamp to a date, a time, or a timestamp.
If argument-2 is TIMESTAMP, neither argument-3 nor
argument-4 can be specified.

If argument-1 is a date-time item, a date-time move is
done.

If argument-1 is a numeric integer, the returned date-time
item will be right-justified and truncated, if it is longer
than what is allowed by the date-time format specified in
argument-3.

If argument-1 is anything else, the returned date-time item
will be left-justified and truncated, if it is longer than
what is allowed by the date-time format specified in
argument-3.


argument-3
Specifies the format of a date or time item. It must be:
A nonnumeric literal at least 2 characters long
The keyword LOCALE
The FORMAT OF special register.
For a list of valid literals and the rules that this
argument must follow, refer to the SPECIAL-NAMES FORMAT
clause described in FORMAT Clause.

Argument-3 should represent a category that is referred to
by argument-2.

If argument-3 is the keyword LOCALE, then the format of the
date or time is based on a LOCALE. If argument-4 is not
specified, the current locale is used, otherwise the locale
associated with the mnemonic-name or the LOCALE OF special
register is used.

If argument-3 is not specified, the format of the returned
value is dependent on the SPECIAL-NAMES FORMAT clause. If
no format has been defined in the SPECIAL-NAMES paragraph,
*ISO format is used.


argument-4
Must be a mnemonic-name associated with a LOCALE, or the
LOCALE OF special register.
Argument-4 must follow these rules:

If argument-4 is specified and argument-3 is a locale-based
format literal, for example contains %p, then the
locale-based format literal would use the locale specified
in argument-4 to determine the actual value of the
conversion specifiers.
If argument-3 is a locale-based format literal (for
example, contains %p) and argument-4 is not specified, the
locale-based format literal would use the current locale to
determine the actual value of the conversion specifiers.
If argument-3 is a locale-based format literal (for
example, contains %p), and the LOCALE OF special register
is used to refer to a non-locale item, the locale-based
format literal would use the default locale to determine
the actual value of the conversion specifiers.
On Fri, 22 Mar 2002 11:40:09 -0500  you wrote;


It takes a little playing with, but it is an easy way to
convert any date.

Hope this helps.

> What is the easiest way to convert a date to julian
> format.
> Thanks
>
> Mike.
>

-----------------------------------
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 thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 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.