Page 1 of 1

How to obtain only current YEAR and subtract years from it?

PostPosted: Thu Nov 17, 2022 7:13 pm
by prisgs
Hello!
I need to work with records (read from a work file), whose values for the YEARS field (it is a numeric field in position 1, with length 4) need to be in a range: INITIAL YEAR (CURRENT YEAR - 4) and FINAL YEAR (CURRENT YEAR - 1).
My issue is about how to obtain the current year, in a simple way for this case, and use it subtracting values... here is a sample code of what I would like to work with INITIAL-YEAR and FINAL-YEAR:

   SORT FIELDS=COPY          
   OMIT COND=(1,4,ZD,LT,INITIAL-YEAR,AND,
              1,4,ZD,GT,FINAL-YEAR)


If anyone could help me, I'd appretiate it.
Thanks in advance.

Re: How to obtain only current YEAR and subtract years from

PostPosted: Thu Nov 17, 2022 9:05 pm
by sergeyken
This is not JCL!!!!

This is SORT utility!!!


https://www-40.ibm.com/servers/resourcelink/svc00100.nsf/pages/zOSV2R3sc236880/$file/iceg200_v2r3.pdf

None of SORT utilities does allow use of dashes in field/values names (unlike COBOL)
INITIAL-YEAR


Where are any results of your attempts?
Any error message, or whatever else, at all??

Re: How to obtain only current YEAR and subtract years from

PostPosted: Thu Nov 17, 2022 11:12 pm
by prisgs
Actually, there is no results.
I just found out how to obtain the ENTIRE current date, and subtract days or months from it. But with only year, I coudn't find much.. and what I found wasn't very clear/explained.

Re: How to obtain only current YEAR and subtract years from

PostPosted: Thu Nov 17, 2022 11:24 pm
by sergeyken
Please!!!

Show us exactly how did you do this, and we may point you to your mistake
I just found out how to obtain the ENTIRE current date, and subtract days or months from it.


There cannot be such thing as "no result", in case you REALLY tried to do something.