Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Julian Conversion when you don't have access to COBOL functi
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Jul 07, 2010 1:51 am    Post subject: Reply to: Julian Conversion when you don't have access to CO
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    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Jul 07, 2010 2:01 am    Post subject: Reply to: Julian Conversion when you don't have access to CO
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    Post subject:
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    Post subject:
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    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Jul 07, 2010 2:04 am    Post subject: Reply to: Julian Conversion when you don't have access to CO
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Jul 07, 2010 2:14 am    Post subject:
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    Post subject:
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    Post subject:
Reply with quote

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

Global Moderator


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

PostPosted: Wed Jul 07, 2010 2:48 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts IMS DC screen Access sivasaras IMS DB/DC 3 Fri Nov 18, 2016 6:38 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us