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
 

 

How to calculate days which is difference between two dates?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: How to calculate days which is difference between two dates?
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    Post subject:
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 http://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:
https://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    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Mon Oct 21, 2013 5:46 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Oct 21, 2013 5:50 pm    Post subject: Reply to: How to calculate days which is difference between
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    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Mon Oct 21, 2013 7:00 pm    Post subject:
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    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 Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
No new posts How to calculate an specific transact... lind sh CICS 2 Tue Sep 13, 2016 9:20 pm
No new posts How to find jobs that are in schedule... anilkumar922 All Other Mainframe Topics 5 Tue Jun 28, 2016 10:01 am
This topic is locked: you cannot edit posts or make replies. BAE Systems - Recruitment Open Days -... Express Mainframe Jobs 0 Fri Apr 22, 2016 8:19 pm
No new posts Difference space showed for TS and it... autobox DB2 1 Thu Apr 14, 2016 1:07 pm


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