× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



The reason you can't get 4/29 after subtracting 3 days from 5/1, is because
there isn't a 4/31.
5/1 - 1 = 4/30
4/30 - 1 = 4/29
4/29 - 1 = 4/28.

Michael Schutte



                                                                           
             Bruce Vining                                                  
             <bvining@xxxxxxxx                                             
             om>                                                        To 
             Sent by:                  Midrange Systems Technical          
             midrange-l-bounce         Discussion                          
             s@xxxxxxxxxxxx            <midrange-l@xxxxxxxxxxxx>           
                                                                        cc 
                                                                           
             05/01/2006 01:10                                      Subject 
             PM                        Re: Date Conversion                 
                                                                           
                                                                           
             Please respond to                                             
             Midrange Systems                                              
                 Technical                                                 
                Discussion                                                 
             <midrange-l@midra                                             
                 nge.com>                                                  
                                                                           
                                                                           




I can't help you much with subtracting three days and getting 4/29 (my
program keeps getting 4/28 when subtracting three days from 5/01...) but
the following demonstrates one approach for V5R3 that will handle month
and year adjustments:

       PGM
       DCL        VAR(&CURDATE) TYPE(*CHAR) LEN(20)
       DCL        VAR(&YYMD) TYPE(*CHAR) LEN(8)
       DCL        VAR(&LILDATE) TYPE(*INT)
       RTVSYSVAL  SYSVAL(QDATETIME) RTNVAR(&CURDATE)
       CHGVAR     VAR(&YYMD) VALUE(%SST(&CURDATE 1 8))
       CALLPRC    PRC(CEEDAYS) PARM((&YYMD) ('YYYYMMDD') +
                    (&LILDATE) (*OMIT))
       CHGVAR     VAR(&LILDATE) VALUE(&LILDATE - 3)
       CALLPRC    PRC(CEEDATE) PARM((&LILDATE) ('YYYYMMDD') +
                    (&YYMD) (*OMIT))
       ENDPGM

and this is another approach if you happen to be on V5R4:

      PGM
      DCL        VAR(&CURDATE) TYPE(*CHAR) LEN(20)
      DCL        VAR(&YYMD) TYPE(*CHAR) STG(*DEFINED) LEN(8) +
                   DEFVAR(&CURDATE)
      DCL        VAR(&LILDATE) TYPE(*INT)
      RTVSYSVAL  SYSVAL(QDATETIME) RTNVAR(&CURDATE)
      CALLPRC    PRC(CEEDAYS) PARM((&YYMD) ('YYYYMMDD') +
                   (&LILDATE) (*OMIT))
      CHGVAR     VAR(&LILDATE) VALUE(&LILDATE - 3)
      CALLPRC    PRC(CEEDATE) PARM((&LILDATE) ('YYYYMMDD') +
                   (&YYMD) (*OMIT))
      ENDPGM

Both programs have &YYMD set to the current system date minus three days.


Bruce Vining




fbocch2595@xxxxxxx
Sent by: midrange-l-bounces+bvining=us.ibm.com@xxxxxxxxxxxx
05/01/2006 09:18 AM
Please respond to
Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>


To
midrange-l@xxxxxxxxxxxx
cc

Subject
Date Conversion






Hi, can someone explain how to use cl to calculate dates properly?

I'm using the following;

/* RETRIEVE THE CURRENT SYSTEM DATE & TIME */
             RTVSYSVAL  SYSVAL(QDATE) RTNVAR(&SYSDAT)
             RTVSYSVAL  SYSVAL(QTIME) RTNVAR(&SYSTIM)

/* CONVERT THE CURRENT DATE FROM MMDDYY TO YYYYMMDD */
             CVTDAT     DATE(&SYSDAT) TOVAR(&SYSYYMD) FROMFMT(*MDY) +
                          TOFMT(*YYMD) TOSEP(*NONE)

/* CREATE PREVIUOS FRIDAY'S DATE BY SUBTRACTING 3 FROM CURRENT DATE */
             CHGVAR     VAR(&PRVDAT#) VALUE(&SYSYYMD)
             CHGVAR     VAR(&PRVDAT#) VALUE(&PRVDAT# - 3)
             CHGVAR     VAR(&PRVDAT) VALUE(&PRVDAT#)

When I run the job on 0501 the pgm returns the date -3 as 20060498.  How
would I have to change the code so that it returns 0429?

Any examples appreciated.

Thanks


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.