View previous topic :: View next topic
|
Author |
Message |
mahe1015
New User
Joined: 19 Dec 2012 Posts: 14 Location: India
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
mahe1015
New User
Joined: 19 Dec 2012 Posts: 14 Location: India
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Begin by telling us what version of the compiler you are using. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Can you define a CHAR and INIT it with a numeric not a character value? |
|
Back to top |
|
|
mahe1015
New User
Joined: 19 Dec 2012 Posts: 14 Location: India
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Master of the Universe! That compiler has been out of service for a decade
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 |
|
|
|