How to convert Julian date format into yyyymmdd date format?
Moderators: dbzTHEdinosauer, Moderator Group
- thamodharan
- Member
- Posts: 21
- Joined: Tue Oct 21, 2008 4:45 pm
- Location: chennai
How to convert Julian date format into yyyymmdd date format?
Hi friends,
I need to convert the julian date format to yyyy/mm/dd format.
Is there any facility to do this? or Should we write any routine for this?
please let me know if there is any easy way to convert this...
Thanks...
[/b]
I need to convert the julian date format to yyyy/mm/dd format.
Is there any facility to do this? or Should we write any routine for this?
please let me know if there is any easy way to convert this...
Thanks...
[/b]
julian date to YYYYMMDD
Hi Thamodharan,
Welcome to mainframegurukul.com
You can convert julian date format ( YYDDD) TO YYYYMMDD format using following intrinsic functions.
The INTEGER-OF-DAY function converts a date in the Gregorian calendar from Julian date form (YYYYDDD) to integer date form.
Then use following function, with this value you got from above function.
The DATE-OF-INTEGER function converts a date in the Gregorian calendar from integer date form to standard date form (YYYYMMDD).
After that you can use your own logic to add slashes between year, date, day parts.
Let me now, if you have any other questions.
Welcome to mainframegurukul.com
You can convert julian date format ( YYDDD) TO YYYYMMDD format using following intrinsic functions.
Code: Select all
ws-date-int = FUNCTION INTEGER-OF-DAY(argument-1)
Then use following function, with this value you got from above function.
Code: Select all
date-YYYY-MM-DD = FUNCTION DATE-OF-INTEGER(ws-date-int)
After that you can use your own logic to add slashes between year, date, day parts.
Let me now, if you have any other questions.
Natarajan
Chennai
Chennai
- thamodharan
- Member
- Posts: 21
- Joined: Tue Oct 21, 2008 4:45 pm
- Location: chennai
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
Julian date ( YYDDD) format into yyyymmdd date format
Here is the process to convert Julian date (YYDDD) format into yyyymmdd date format,if you want to code the logic without using functions.
Steps to folllow.
Step 1 - take the year part and find out whether it is leap year or not
Step 2 - If it is leap year.. increase the no. of days in Feb by 1
Step 3 - Now we need to find out.. which month we are in.
Take DDD part... which contains the no of day from starting of the year.
check as below to get MM value..
if the value in DDD less than or equal 31.. then month is Jan0
if the value in DDD less than or equal ( 31+ 28 (29, if leap year) )
then the month is Feb
etc....
You better code these numbers in an array, so that while coding
you can use perform to get MM value... without writing too much of code.
Step 4 - Need to find out day part ...
Example - if the given day fall under in the month of April.
If MM has the value of 4 which means april...
your code should work in such way .. it should subtract 90 ( you can take from above array) from DDD
resultant value will be moved to DD part
In case of Feb, need to subtract 31 from DDD and resultant value will be
moved to DD part. etc...
This logic also can be coded using above array.
calculating century part fully depends upon.. where you will use this code...normally people use window... i.e.,
If YY > 50
MOVE 1900 TO CC-YY
else
MOVE 2000 TO CC-YY
end-if
Let me know, if you need any more help on this.
Steps to folllow.
Step 1 - take the year part and find out whether it is leap year or not
Code: Select all
IF A YEAR DIVISIBLE BY 400
THEN IT IS A LEAP YEAR.
IF A YEAR DIVISIBLE BY 4
BUT NOT DIVISIBLE BY 100
THEN IT IS A LEAP YEAR.
Step 2 - If it is leap year.. increase the no. of days in Feb by 1
Step 3 - Now we need to find out.. which month we are in.
Take DDD part... which contains the no of day from starting of the year.
check as below to get MM value..
if the value in DDD less than or equal 31.. then month is Jan0
if the value in DDD less than or equal ( 31+ 28 (29, if leap year) )
then the month is Feb
etc....
You better code these numbers in an array, so that while coding
you can use perform to get MM value... without writing too much of code.
Code: Select all
example -
01 months
05 jan pic 9(3) value 0
05 feb pic 9(3) value 31
05 mar pic 9(3) value 59
etc....
redefine above structure with an array , so that accessing this data will be easy.
Step 4 - Need to find out day part ...
Example - if the given day fall under in the month of April.
If MM has the value of 4 which means april...
your code should work in such way .. it should subtract 90 ( you can take from above array) from DDD
resultant value will be moved to DD part
In case of Feb, need to subtract 31 from DDD and resultant value will be
moved to DD part. etc...
This logic also can be coded using above array.
calculating century part fully depends upon.. where you will use this code...normally people use window... i.e.,
If YY > 50
MOVE 1900 TO CC-YY
else
MOVE 2000 TO CC-YY
end-if
Let me know, if you need any more help on this.
Natarajan
Chennai
Chennai
- thamodharan
- Member
- Posts: 21
- Joined: Tue Oct 21, 2008 4:45 pm
- Location: chennai
- thamodharan
- Member
- Posts: 21
- Joined: Tue Oct 21, 2008 4:45 pm
- Location: chennai
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page