IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Julian Conversion when you don't have access to COBOL functi


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
steves

New User


Joined: 26 Feb 2007
Posts: 30
Location: chicago

PostPosted: Wed Jul 07, 2010 1:32 am
Reply with quote

I've been searching this web site and the internet in general for about 2 days looking for code samples on converting yyyyddd date format to mmddyy. Everything I've seen online says to use standard cobol functions DATE-OF-INTEGER, etc or that the shop I work at should have some code written in house. Every place I've worked in the past has some some code written in house. This place may actually have some code written in house, but they've laid off all of their mainframe staff and I'm not able to find anything. ( No they don't have version control, no, no one knows the names of the production source libraries)

So where might I find actual code samples, hopefully written in COBOL ? I've tried IBM manuals and didn't find it

thanks
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Jul 07, 2010 1:51 am
Reply with quote

Language Environment Callable Service routines can perform this conversion for you. Check with your System's personnel for availability.

Use ===> CEEDAYS (step 01)

Use ===> CEEDATE (step 02)

COBOL FUNCTIONS were introduced with COBOL/370 in the early 1990's.

LE can be installed in OS/VS COBOL and VS/COBOL II. It became an integral part of COBOL/370.

Bill
Back to top
View user's profile Send private message
steves

New User


Joined: 26 Feb 2007
Posts: 30
Location: chicago

PostPosted: Wed Jul 07, 2010 1:56 am
Reply with quote

thanks but
there are no mainframe developers or staff here
this is an old system the client is a government agency they replaced the system years ago and hired me to extract all the historical data and move it to oracle. there is no one here to ask

I'm looking for a sample source code not a callable function. if I can't find one I'll have to write one
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Jul 07, 2010 2:01 am
Reply with quote

Do you know REXX? You could write a REXX callable routine to perform this conversion or you can write a COBOL version yourself.

You've got quite a mess on your hands.

What version of COBOL are you working with?

Try Googling "Julian to Gregorian in COBOL". You might get lucky and find some freeware.

Bill
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 07, 2010 2:02 am
Reply with quote

something that I stole from Kolusu:
Code:


01 WS-GREGORIAN-DATE           PIC 9(08).   
01 WS-JULIAN-DATE              PIC 9(07).   

COMPUTE WS-JULIAN-DATE    = FUNCTION DAY-OF-INTEGER     
                            (FUNCTION INTEGER-OF-DATE   
                            (WS-GREGORIAN-DATE))       
                                                       
                                                       
COMPUTE WS-GREGORIAN-DATE = FUNCTION DATE-OF-INTEGER
                            (FUNCTION INTEGER-OF-DAY
                            (WS-JULIAN-DATE))       
Back to top
View user's profile Send private message
steves

New User


Joined: 26 Feb 2007
Posts: 30
Location: chicago

PostPosted: Wed Jul 07, 2010 2:03 am
Reply with quote

thanks but per my original post I don't have access to cobol functions
Back to top
View user's profile Send private message
steves

New User


Joined: 26 Feb 2007
Posts: 30
Location: chicago

PostPosted: Wed Jul 07, 2010 2:04 am
Reply with quote

i've been googling Julian to Greg etc for 2 days. I think I'm just going to write my own program, the logic doesn't seem hard, I know how days are in a month thanks for you help
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Jul 07, 2010 2:04 am
Reply with quote

Dick,

He doesn't have access to COBOL FUNCTIONS, so that would mean that he's on OS/VS COBOL or VS/COBOL II.

Bill
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Jul 07, 2010 2:14 am
Reply with quote

steves wrote:
i've been googling Julian to Greg etc for 2 days. I think I'm just going to write my own program, the logic doesn't seem hard, I know how days are in a month thanks for you help

Don't forget leap year in your calculation icon_wink.gif

Bill
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 07, 2010 2:21 am
Reply with quote

Sorry about the functions.

as bill said, don't forget about leap year,
and you can skip checking for leap year if the year ends in 1,3,5,7,9
if it is 0,4, or 8 it is a leap year,
so you only have to check for 2 or 6.
saves that divide in your routine.
Back to top
View user's profile Send private message
steves

New User


Joined: 26 Feb 2007
Posts: 30
Location: chicago

PostPosted: Wed Jul 07, 2010 2:33 am
Reply with quote

thanks
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Jul 07, 2010 2:48 am
Reply with quote

Always thought that a leap year check was something like this :

Code:

bool __fastcall DateTimeTricks::IsLeapYear(int AYear)
{
return((AYear % 4) == 0) && (((AYear % 100) != 0) || ((AYear % 400) == 0));
};
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 07, 2010 4:36 am
Reply with quote

Peter,
you are correct.
I have no excuse for such a stupid comment.
(I do, but it is even stupider - I used the logic in a routine that was only going to be used from 2000 to 2008.)

dbzTHEdinosauer erronously wrote:
as bill said, don't forget about leap year,
and you can skip checking for leap year if the year ends in 1,3,5,7,9
if it is 0,4, or 8 it is a leap year,
so you only have to check for 2 or 6.
saves that divide in your routine.


SHOULD BE:
and you can skip checking for leap year if the year ends in 1,3,5,7,9
so you only have to check for 0, 2 , 4, 6, or 8.

List of Leap Years
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts How to access web services/website? Mainframe Interview Questions 4
Search our Forums:

Back to Top