Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Conversion of MMDDYY Date to Julian DAte

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
prasanth_urs

New User


Joined: 04 Dec 2006
Posts: 44
Location: Pune,India

PostPosted: Wed Jan 31, 2007 11:29 am    Post subject: Conversion of MMDDYY Date to Julian DAte
Reply with quote

Hi all,

Can anyone please tell me how to convert a Date in format MMDDYY to Julian Date....

For example DAte = 01312007
So the respective date should be like 31.(addding up the total number of days upto that point in an year).

Please reply me as soon as possible.

Many Thanks in advance icon_lol.gif
Back to top
View user's profile Send private message

Santoshdorge

New User


Joined: 27 Jun 2006
Posts: 48
Location: Pune

PostPosted: Wed Jan 31, 2007 1:05 pm    Post subject:
Reply with quote

Hi
One way is using the COBOL table/array. you can initialize of 12 elements to default number of days.For Feb you have to put logic for 28 or 29 days
depanding upon the year.Add the elements upto current month and then the day of the current month.
Another way to do this is by using DB2 functions.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Wed Jan 31, 2007 1:11 pm    Post subject:
Reply with quote

What language/tools do you have to work with?
Back to top
View user's profile Send private message
prasanth_urs

New User


Joined: 04 Dec 2006
Posts: 44
Location: Pune,India

PostPosted: Wed Jan 31, 2007 1:30 pm    Post subject: Re: Conversion of MMDDYY Date to Julian DAte
Reply with quote

Hi ,

I am working with PL/I. I worked in COBOL before, but the requirement is in PL/I..
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Wed Jan 31, 2007 1:51 pm    Post subject:
Reply with quote

There are LE routines that should be available to PL/I too.
If PL/I doesn't have anything available, you can just do what us "old timers" had to do in the "olden days".... Like Santoshdorge posted, a 12 entry table with the julian day for each month and a calculation for leap year - simple boiler plate coding.....
Back to top
View user's profile Send private message
kgumraj

Active User


Joined: 01 May 2006
Posts: 151
Location: Hyderabad

PostPosted: Thu Feb 01, 2007 2:06 pm    Post subject: Re: Conversion of MMDDYY Date to Julian DAte
Reply with quote

Hi,

I can help you in db2. If you have DB2 in your program try this


Code:

EXEC SQL
         SELECT DAYS(DATE(:INDATE-IN-YYYY-MM-DD) + 1 DAY)
                     - DAYS('2007-01-01')
                     FROM SYSIBM.SYSDUMMY1
END-EXEC.


For the above, you need to code in PL1 for conversion of MMDDYYYY to YYYY-MM-DD format
Back to top
View user's profile Send private message
jayaprakashysr
Currently Banned

New User


Joined: 04 Jul 2007
Posts: 1
Location: HYD

PostPosted: Tue Nov 13, 2007 4:58 pm    Post subject: Reply to: Conversion of MMDDYY Date to Julian DAte
Reply with quote

declare external entry
DCL K0B3S31 EXTERNAL ENTRY;
%INCLUDE CHGCOPY;
DATECHG_@STRUCT='';

CHGCOPY : copybook

DCL DATECHG_PTR POINTER;
DATECHG_PTR = ADDR (DATECHG_@STRUCT);

DCL 1 DATECHG_@STRUCT,
5 MMDDYY CHAR (6), /* INPUT/OUTPUT OF SUBRTN */
5 JULIAN PIC '99999', /* INPUT/OUTPUT OF SUBRTN */
5 RET_CODE CHAR (1); /* OUTPUT FROM SUBRTN */

DCL 1 DATECHG_REDEF BASED (DATECHG_PTR),
5 CALENDAR_PIC,
10 MONTH PIC '99',
10 DAY PIC '99',
10 YEAR PIC '99',
5 JULIAN_PIC,
10 YY PIC '99',
10 DDD PIC '999';

DCL 1 CHG_RET,
2 ALL_OK CHAR (1) INIT ('0'),
2 MMDDYY_NG CHAR (1) INIT ('1'),
2 JULIAN_NG CHAR (1) INIT ('2'),
2 REQ_NG CHAR (1) INIT ('3'); /* JULIAN = 0 AND */
/* MMDDYY IS BLANK */

/* CONVERT DATE TO JULIAN FORMAT */
DATECHG_@STRUCT = '';
DATECHG_@STRUCT.MMDDYY = SUBSTR(HOLD_PROCESS_DATE,5,2)
|| SUBSTR(HOLD_PROCESS_DATE,7,2)
|| SUBSTR(HOLD_PROCESS_DATE,3,2)
CALL K0B3S31(DATECHG_@STRUCT);
PARM_DATE_JUL = DATECHG_@STRUCT.JULIAN;


DCL PARM_DATE_JUL PIC'(05)9' INIT(0);

HOLD_PROCESS_DATE is your current date format

i hope this is clear for every one..........

Thanks,
Jayaprakash
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10327
Location: italy

PostPosted: Tue Nov 13, 2007 5:03 pm    Post subject: Reply to: Conversion of MMDDYY Date to Julian DAte
Reply with quote

Quote:
CALL K0B3S31(DATECHG_@STRUCT);
PARM_DATE_JUL = DATECHG_@STRUCT.JULIAN;


DCL PARM_DATE_JUL PIC'(05)9' INIT(0);

HOLD_PROCESS_DATE is your current date format

i hope this is clear for every one..........


clear, but, ... COMPLETELY USELESS

k0b3s31 is an installation developed subroutine/function so it' s of no help to the O/P

as advised many times... avoid posting suggestions based on "in house" tools/facilities
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Tue Nov 13, 2007 8:06 pm    Post subject:
Reply with quote

If you're using the new Enterprise PL/I compiler, you can use the built in function REPATTERN:
greg8dig = REPATTERN(jul7dig , 'YYYYMMDD' , 'YYYYDDD');
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 -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us