MAINFRAME - TIP OF THE DAY :
When you specified V for RECFM parameter, LRECL value is largest record in the file plus 4 bytes. These four bytes contain the actual length of each variable length record in the file
Programmers Voted for below topics. Please Vote for good Posts.
Thank You! for your feedback. Connecting to the server. Please Wait...
Posted: Thu Apr 02, 2009 9:41 am Post subject: 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
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
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.
05 jan pic 9(3) value 0
05 feb pic 9(3) value 31
05 mar pic 9(3) value 59
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
MOVE 2000 TO CC-YY
Let me know, if you need any more help on this. _________________ Natarajan
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
Cobol Tutorial This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial This Tutorial covers all important aspects of DFSORT. Has more SORT examples