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



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

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

Postby prisgs » Thu Nov 17, 2022 7:13 pm

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.
prisgs
 
Posts: 5
Joined: Thu Nov 17, 2022 6:54 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby sergeyken » Thu Nov 17, 2022 9:05 pm

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??
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times

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

Postby prisgs » Thu Nov 17, 2022 11:12 pm

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.
prisgs
 
Posts: 5
Joined: Thu Nov 17, 2022 6:54 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby sergeyken » Thu Nov 17, 2022 11:24 pm

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.
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 6 times
Been thanked: 40 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post