Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement DATE(BASEDATE) #87

Open
RossPatterson opened this issue Nov 8, 2024 · 2 comments
Open

Implement DATE(BASEDATE) #87

RossPatterson opened this issue Nov 8, 2024 · 2 comments
Assignees
Labels

Comments

@RossPatterson
Copy link
Collaborator

RossPatterson commented Nov 8, 2024

The only thing preventing bREXX from fully implementing Rexx level 3.40 is the highly useful DATE(BASEDATE) function.

@RossPatterson RossPatterson added the enhancement New feature or request label Nov 8, 2024
@RossPatterson RossPatterson changed the title Implement DATE(BASESDATE) Implement DATE(BASEDATE) Nov 8, 2024
@rvjansen
Copy link
Collaborator

rvjansen commented Nov 8, 2024 via email

@RossPatterson
Copy link
Collaborator Author

I have that in Rexx source.

I think I've seen that in tests/date_.exec. Although that's a rather complex code file.

And much to my surprise, I just found a date converter I wrote in Rexx 33 years ago, CVD(Value, InFormat, OutFormat).[1]

Peter Jacob has a C implementation for Brexx on MVS.

Oh! Nice! Yup: lstring/date.c. And it's so easy: if (strncasecmp(LSTR(*datestr), "BASE", 1) == 0) JDN = JDN + 1721426;, where JDN is the Julian day number, as used in astronomy (not the Julian date as used in DATE(JULIAN)).

[1] Interestingly, CVD() includes the following, because I guess I didn't prove to my own satisfaction that the two formulas are equivalent. I can't recall ever hearing this particular klaxon horn go off.

/*! This is the basedate formula from the REXX reference    */
BaseDate = ((Year-1)*365)+(Day-1)+((Year-1)%4)- ,
           ((Year-1)%100)+((Year-1)%400)
/*! This is the basedate formula from IXXRFN(DATEBASE)      */
BD2 = ((Year-1)%4)*(4*365+1) + ((Year-1)//4)*365 + Day - ,
      ((Year-1)%100)+((Year-1)%400) -1
If BaseDate \= BD2 then Do
   'MSG * Ahoogah! Ahoogah! Dive! Dive! Dive'
   Say 'Basedate formulas differ: BaseDate='BaseDate 'BD2='BD2
   Return
End

@RossPatterson RossPatterson self-assigned this Dec 2, 2024
@RossPatterson RossPatterson added the in-progress Being worked on label Dec 2, 2024
@RossPatterson RossPatterson added fixed in next release and removed in-progress Being worked on labels Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants