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

How to calculate days which is difference between two dates?


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mahe1015

New User


Joined: 19 Dec 2012
Posts: 14
Location: India

PostPosted: Mon Oct 21, 2013 4:39 pm
Reply with quote

I have a requirement in PLI where I need to calculate the days which is difference between two dates.
Can any of you help me?

ex : 2013-10-21 - 2013-10-01= 20days
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Oct 21, 2013 5:00 pm
Reply with quote

this has been asked and answered several times in the past,
so i can only assume that you are too lazy to search the forum.

this may help pic.dhe.ibm.com/infocenter/ratdevz/v7r5/index.jsp?topic=%2Fcom.ibm.ent.pl1.zos.doc%2Ftopics%2Fdtbifs.htm
but then you would have to read a reference manual.

you can use language environment services,
look thru the links provided here:
www.google.de/?gws_rd=cr&ei=wA9lUtCYG8qNtQbxr4DgDg#q=calling+language+environment+from+pl1
Back to top
View user's profile Send private message
mahe1015

New User


Joined: 19 Dec 2012
Posts: 14
Location: India

PostPosted: Mon Oct 21, 2013 5:34 pm
Reply with quote

Code:
SAMP1:PROC OPTIONS(MAIN);                   
DCL TODAYS_YYMMDD CHAR(06);                 
DCL DOC_DATE_FMT    CHAR(06) INIT 131001;   
DCL DATE BUILTIN;                           
DCL DAYS BUILTIN;                           
DCL DATE1 CHAR(06) INIT 0;                 
DCL DATE2 CHAR(06) INIT 0;                 
 TODAYS_YYYYMMDD = DATE;                   
 DATE1 = DAYS(DOC_DATE_FMT);               
 DATE2 = DAYS(TODAYS_YYMMDD);               
PUT SKIP LIST('THE VALUE OF DATE1:',DATE1);
PUT SKIP LIST('THE VALUE OF DATE21:',DATE2);
END SAMP1;       


I am using above code to get days.. I am facing the below error

Code:

INVALID ATTRIBUTE SPECIFICATION AFTER 'E_FMT CHAR(06) INIT'.    'INIT 131001' IG
INVALID ATTRIBUTE SPECIFICATION AFTER 'DATE1 CHAR(06) INIT'.    'INIT 0' IGNORED
INVALID ATTRIBUTE SPECIFICATION AFTER 'DATE2 CHAR(06) INIT'.    'INIT 0' IGNORED
IDENTIFIER 'DAYS' IS NOT DECLARED.    EXTERNAL ENTRY ASSUMED.                   


Can any one help me.. I am very new to PLI programming
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Mon Oct 21, 2013 5:46 pm
Reply with quote

Begin by telling us what version of the compiler you are using.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Oct 21, 2013 5:50 pm
Reply with quote

Can you define a CHAR and INIT it with a numeric not a character value?
Back to top
View user's profile Send private message
mahe1015

New User


Joined: 19 Dec 2012
Posts: 14
Location: India

PostPosted: Mon Oct 21, 2013 5:57 pm
Reply with quote

Akatsukami wrote:
Begin by telling us what version of the compiler you are using.


15668-910 IBM OS PL/I OPTIMIZING COMPILER VER 2 REL 3 MOD 0
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Mon Oct 21, 2013 7:00 pm
Reply with quote

Master of the Universe! That compiler has been out of service for a decade icon_eek.gif

OS PL/I did not have the DAYS built-in function (or many others). To the left, I'd urge you to urge your sysprogs to upgrade to an at least in-service compiler; to the right, jumping from OS PL/I 2.3 to Enterprise PL/I (4.4 is, I believe, the current version) may well be a non-trivial task.
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
No new posts how to calculate SUM for VB file usin... JCL & VSAM 1
No new posts Timestamp difference and its average ... DB2 11
No new posts Difference when accessing dataset in ... JCL & VSAM 7
No new posts Amount of days between two dates PL/I & Assembler 8
Search our Forums:

Back to Top