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
 
Number of days between two dates in Easytrieve

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
View previous topic :: :: View next topic  
Author Message
Delip

New User


Joined: 13 Sep 2007
Posts: 46
Location: Bangalore

PostPosted: Mon Nov 26, 2007 8:37 pm    Post subject: Number of days between two dates in Easytrieve
Reply with quote

Hi,

Is there any macro to calculate number of days between two dates in Easytrieve?

Thank you
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Tue Nov 27, 2007 6:24 am    Post subject:
Reply with quote

Dil,

Few date Macros are available with 'Easytreive addons' (which ofcourse are paid ones icon_sad.gif ).

If you are lucky enough icon_smile.gif , those may be installed at your shop icon_cool.gif icon_cool.gif .
Back to top
View user's profile Send private message
Delip

New User


Joined: 13 Sep 2007
Posts: 46
Location: Bangalore

PostPosted: Thu Nov 29, 2007 8:31 pm    Post subject:
Reply with quote

Is there any other method or programming logic for this?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Thu Nov 29, 2007 8:42 pm    Post subject:
Reply with quote

Delip wrote:
Is there any other method or programming logic for this?
Other?
You can use the programming function of EZT to calculate the difference between two dates. A small table of the number of days in each month would be a good starting point. The complexity increases if you have large multi-year spans and you really want a high degree of accuracy as you need to account for leap years.
Back to top
View user's profile Send private message
lcmontanez

New User


Joined: 19 Jun 2007
Posts: 50
Location: Chicago

PostPosted: Thu Nov 29, 2007 9:28 pm    Post subject: Reply to: Number of days between two dates in Easytrieve
Reply with quote

If the date is Julian the calc may be a bit more simple.

you can use DATECONV to change format.
Back to top
View user's profile Send private message
Delip

New User


Joined: 13 Sep 2007
Posts: 46
Location: Bangalore

PostPosted: Thu Nov 29, 2007 9:34 pm    Post subject:
Reply with quote

Is there any other method or programming logic for this?
Back to top
View user's profile Send private message
Delip

New User


Joined: 13 Sep 2007
Posts: 46
Location: Bangalore

PostPosted: Sat Dec 01, 2007 1:38 am    Post subject:
Reply with quote

I developed programming logic though a bit lengthy,it is working now.Thank you.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Sat Dec 01, 2007 1:58 am    Post subject:
Reply with quote

Delip wrote:
I developed programming logic though a bit lengthy,it is working now.Thank you.
It usually can be quite involved and lengthy, but I'm glad you got it working......
Back to top
View user's profile Send private message
lcmontanez

New User


Joined: 19 Jun 2007
Posts: 50
Location: Chicago

PostPosted: Sat Dec 01, 2007 3:35 am    Post subject:
Reply with quote

Delip wrote:
I developed programming logic though a bit lengthy,it is working now.Thank you.


If you don't mind... please post your solution just in case some else has the same problem/question
Back to top
View user's profile Send private message
Delip

New User


Joined: 13 Sep 2007
Posts: 46
Location: Bangalore

PostPosted: Mon Dec 03, 2007 7:58 pm    Post subject: Reply to: Number of days between two dates in Easytrieve
Reply with quote

Please find attahment.You may find it too lengthy.But I couldn't help it.
Code:

MACRO  DATE1 DATE2 DIFF
DEFINE    WS-DATE1     W        8 N
DEFINE     WSYY1    WS-DATE1    4 N
DEFINE     WSMM1    WS-DATE1 +4 2 N
DEFINE     WSDD1    WS-DATE1 +6 2 N
DEFINE    WS-DATE2     W        8 N
DEFINE     WSYY2    WS-DATE2    4 N
DEFINE     WSMM2    WS-DATE2 +4 2 N
DEFINE     WSDD2    WS-DATE2 +6 2 N
DEFINE    WS-DAYS1  W 6 N VALUE 0.
DEFINE    WS-DAYS2  W 6 N VALUE 0.
DEFINE    WS-DAYS3  W 6 N VALUE 0.
DEFINE    WS-YEAR-DIFF W 6 N VALUE 0
DEFINE    WS-LEAP      W 6 N VALUE 0
    WS-DATE1 = &DATE1
    WS-DATE2 = &DATE2
    WS-DAYS1 = 0
    WS-DAYS2 = 0
    WS-DAYS3 = 0
    WS-YEAR-DIFF = 0
    WS-LEAP = 0
    IF WSYY2 NE WSYY1
       WS-LEAP = WSYY1 / 4
       WS-LEAP = WS-LEAP * 4
       IF ((WSMM1 = 3) OR (WSMM1 = 5) OR (WSMM1 = 7) OR (WSMM1 = 8) )
          WS-DAYS1 = 31 - WSDD1
       END-IF
       IF ((WSMM1 = 10) OR (WSMM1 = 12) OR (WSMM1 = 01))
          WS-DAYS1 = 31 - WSDD1
       END-IF
       IF ((WSMM1 = 4) OR (WSMM1 = 6) OR (WSMM1 = 9) OR (WSMM1 = 11))
           WS-DAYS1 = 30 - WSDD1
       END-IF
       IF WSMM1 = 2
          IF WS-LEAP = WSYY1
             WS-DAYS1 = 29 - WSDD1
          ELSE
             WS-DAYS1  = 28 - WSDD1
          END-IF
       END-IF
       DO WHILE WSMM1 < 12
          WSMM1 = WSMM1 + 1
          IF ((WSMM1 = 3) OR (WSMM1 = 5) OR (WSMM1 = 7) OR (WSMM1 = 8))
             WS-DAYS1 = WS-DAYS1 + 31
          END-IF
          IF ((WSMM1 = 10) OR (WSMM1 = 12))
             WS-DAYS1 = WS-DAYS1 + 31
          END-IF
          IF ((WSMM1 = 4) OR (WSMM1 = 6) OR (WSMM1 = 9) OR (WSMM1 = 11))
             WS-DAYS1 = WS-DAYS1 + 30
          END-IF
          IF WSMM1 = 2
             IF WS-LEAP  = WSYY1
                WS-DAYS1 = 29 + WS-DAYS1
             ELSE
                WS-DAYS1  = 28 + WS-DAYS1
             END-IF
          END-IF
    END-DO
    END-IF
    DO WHILE WSMM2 > 0
       WSMM2 = WSMM2 - 1
       IF ((WSMM2 = 3) OR (WSMM2 = 5) OR (WSMM2 = 7) OR (WSMM2 = 8) )
          WS-DAYS2 = WS-DAYS2 + 31
       END-IF
       IF ((WSMM2 = 10) OR (WSMM2 = 1))
          WS-DAYS2 = WS-DAYS2 + 31
       END-IF
       IF ((WSMM2 = 4) OR (WSMM2 = 6) OR (WSMM2 = 9) OR (WSMM2 = 11))
          WS-DAYS2 = WS-DAYS2 + 30
       END-IF
       IF WSMM2 = 2
          WS-LEAP = WSYY2 / 4
          WS-LEAP = WS-LEAP * 4
          IF WS-LEAP  = WSYY2
             WS-DAYS2 = 29 + WS-DAYS2
          ELSE
             WS-DAYS2 = 28 + WS-DAYS2
       END-IF
       END-IF
    END-DO
    WS-DAYS2 = WS-DAYS2 + WSDD2
    IF WSYY2 = WSYY1
       DO WHILE WSMM1 > 0
          WSMM1 = WSMM1 - 1
          IF ((WSMM1 = 3) OR (WSMM1 = 5) OR (WSMM1 = 7) OR (WSMM1 = 8) )
             WS-DAYS1 = WS-DAYS1 + 31
          END-IF
          IF ((WSMM1 = 10) OR (WSMM1 = 1))
             WS-DAYS1 = WS-DAYS1 + 31
          END-IF
          IF ((WSMM1 = 4) OR (WSMM1 = 6) OR (WSMM1 = 9) OR (WSMM1 = 11))
             WS-DAYS1 = WS-DAYS1 + 30
          END-IF
          IF WSMM1 = 2
             WS-LEAP = WSYY1 / 4
             WS-LEAP = WS-LEAP * 4
             IF WS-LEAP  = WSYY1
                WS-DAYS1 = 29 + WS-DAYS1
             ELSE
                WS-DAYS1 = 28 + WS-DAYS1
             END-IF
            END-IF
      END-DO
       WS-DAYS1 = WS-DAYS1 + WSDD1
       WS-DAYS3 = WS-DAYS2 - WS-DAYS1
    ELSE
       WS-YEAR-DIFF = WSYY2 - 1 - WSYY1
       WS-LEAP      = WS-YEAR-DIFF / 4
       WS-DAYS3 = WS-DAYS1 + WS-DAYS2 + (WS-YEAR-DIFF * 365) + WS-LEAP
    END-IF
   
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 -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Profile changed to NUMBER ON STD (fro... Martylin TSO/ISPF 1 Thu Aug 03, 2017 9:14 am
No new posts UNIT=AFF for Easytrieve code gandikk JCL & VSAM 7 Wed Jul 12, 2017 11:42 pm
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Edit large number of datasets (QSAM) zh_lad TSO/ISPF 3 Tue Apr 04, 2017 6:08 pm

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