Brad McDaniel <BMCDANIEL@ABSBC.ORG> on 10/13/99 08:31:02 AM


I am writing some CL's to automate some monthly jobs that are usually
submitted through user menus.  This particular CL submits a job with the
prior month and year as the parms (let's say &YEAR (4) and &MONTH (2)).



If it can be run on the last day of the Month (Or first day of new month),  I
would Use the Job Scheduler  with *Monthend  then Just get the date from the the
System Values.  With the First day of the Month you would use the Julian date
and Subtract 1 Which will get you the Last day of the previous month except on
January 1.


                   Specify Value for Parameter SCDDATE

 Type choice, press Enter.

 Type . . . . . . . . . . . . . :   DATE
 Schedule date, or  . . . . . . .   *CURRENT

   *CURRENT
   *MONTHSTR
   *MONTHEND
   *NONE


   DCL        VAR(&JUL) TYPE(*CHAR) LEN(5)
   DCL        VAR(&JULD) TYPE(*DEC) LEN(5 0)
 /* THE SYSTEM'S DATE */
              DCL        VAR(&SYSDAT) TYPE(*CHAR) LEN(6)
              DCL        VAR(&SYSDD) TYPE(*CHAR) LEN(2)
              DCL        VAR(&SYSMM) TYPE(*CHAR) LEN(2)
              DCL        VAR(&SYSYY) TYPE(*CHAR) LEN(2)
              DCL        VAR(&SYSYYD) TYPE(*DEC) LEN(2 0)
              DCL        VAR(&SYSMMD) TYPE(*DEC) LEN(2 0)
              DCL        VAR(&SYSDDD) TYPE(*DEC) LEN(2 0)
 /* YESTERDAY'S DATE */
              DCL        VAR(&JOBDAT) TYPE(*CHAR) LEN(6)
              DCL        VAR(&JOBMM) TYPE(*CHAR) LEN(2)
              DCL        VAR(&JOBDD) TYPE(*CHAR) LEN(2)
              DCL        VAR(&JOBYY) TYPE(*CHAR) LEN(2)

  RTVSYSVAL  SYSVAL(QDATE) RTNVAR(&SYSDAT)
  CHGVAR     VAR(&SYSMM) VALUE(%SST(&SYSDAT 1 2))
  CHGVAR     VAR(&SYSDD) VALUE(%SST(&SYSDAT 3 2))
  CHGVAR     VAR(&SYSYY) VALUE(%SST(&SYSDAT 5 2))
  CHGVAR     VAR(&SYSYYD) VALUE(&SYSYY)
  CHGVAR     VAR(&SYSMMD) VALUE(&SYSMM)
  CHGVAR     VAR(&SYSDDD) VALUE(&SYSDD)

  IF         COND((&SYSMMD *EQ 1) *AND (&SYSDDD *EQ 1)) +
               THEN(DO)
  CHGVAR     VAR(&SYSYYD) VALUE(&SYSYYD - 1)

  CHGVAR     VAR(&JOBMM) VALUE("12")
  CHGVAR     VAR(&JOBDD) VALUE("31")
  CHGVAR     VAR(&JOBYY) VALUE(&SYSYYD)

               ENDDO
  ELSE       CMD(DO)

  CVTDAT     DATE(&SYSDAT) TOVAR(&JUL) FROMFMT(*SYSVAL) +
               TOFMT(*JUL) TOSEP(*NONE)
  CHGVAR     VAR(&JULD) VALUE(&JUL)
  CHGVAR     VAR(&JULD) VALUE(&JULD - 1)
  CHGVAR     VAR(&JUL) VALUE(&JULD)
     CVTDAT     DATE(&JUL) TOVAR(&JOBDAT) FROMFMT(*JUL) +
               TOFMT(*MDY) TOSEP(*NONE)

  CHGVAR     VAR(&JOBMM) VALUE(%SST(&JOBDAT 1 2))
  CHGVAR     VAR(&JOBDD) VALUE(%SST(&JOBDAT 3 2))
  CHGVAR     VAR(&JOBYY) VALUE(%SST(&JOBDAT 5 2))
               ENDDO







+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

This thread ...


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

This mailing list archive is Copyright 1997-2019 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].