ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Noon-to-noon special value

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Noon-to-noon special value

    This is a just-wondering question, but I may need this before too long.

    I like to use special values for parameters in commands and programs. For example, for a date field, I might allow a special value of TODAY, *CURRENT, *CURDATE, etc. to tell the program to retrieve the current date from the system.

    To tell the system to use the date of the day before, I might use a value like YESTERDAY or *PRIOR or something.

    Let’s say I have an overnight job stream where a program could start running before or after midnight, e.g. at 11:50 PM or 12:02 AM. What would be a good special value to use to mean “if the current time is after noon, use today’s date, otherwise use yesterday’s date”?

  • #2
    Would expanding the special value to include an offset solve the problem?

    Code:
    Run Date:
    Date . . . . . *CURRENT Date
    Offset . . . . -12 Hours

    A job submitted at 11:50 PM would run with the current date and a job submitted at 12:02 AM would run with yesterday's date.

    Comment


    • #3
      Thanks for the suggestion, 10.

      I have done that sort of thing in the past. C could mean current date, C-1 might mean 1 day ago (yesterday), C-7 (a week ago), C+1 (tomorrow), that sort of thing. I don't really want to get into programming to calculate an offset. I just want a value I can compare to.

      I thought about NOONTONOON, but it's too long (dates are usually 8 characters in unedited ISO format) and it's not intuitive.

      Comment


      • #4
        How about YESTB412 or YSTB4NOON or B4NOONYEST or NOONSPCL

        Comment

        Working...
        X