I have a jcl which unloads table data to a file and the unload card has simple query as - SELECT * from <table_name>
This table has a column name as DATE which is in format yyyy-mm-dd ex.2020-05-31
The ask from my boss was - Can we get data from 1st day of the month to the last day of the month. I gave them below where condition -
WHERE DATE BETWEEN (CURRENT_DATE - (DAY(CURRENT_DATE)-1)DAYS)
AND LAST_DAY(CURRENT_DATE)
This worked good. But this unload job is month end job and sometimes tend to run late which means the current date being 1st of month which will mess up my above WHERE condition
So, my simplest idea was to do replace CURRENT_DATE with (CURRENT_DATE -2 )
But my boss is asking if we can create new step and filter out the DATE field from the output file and create a new file with only date having a month's worth data.
I dont know how i can achieve filtering the date using sort. can you guys help
Please, start doing something by yourself-> I got the DB2 solution with my where clause condition which I have given in my og post and since you asked to read the f*king manual. I have already used the last day function in my WHERE clause which you shared
My question is simply to understand - is there any DB2 BETWEEN and Last_date equivalent in jcl sort card
Also, THIS IS A JCL QUESTION not "DB2". I explained the DB2 part because I knew there would be someone who would ask if you tried anything?
Also, I did tried to search JCL sort and I found DATE1,DATE4 in jcl sort to deal with date conditions but I couldn't found anything where I can get first and last date of month in jcl sort utility
Also, please do not use condescending tone. You can simply ignore my post if you want to rather than being rude
My question is simply to understand - is there any DB2 BETWEEN and Last_date equivalent in jcl sort card
Yes, there is such equivalent.
It's described in details in manuals, and in Google search from Internet, as well as in search from this forum.
P.S.
There is no such thing as, JCL SORT CARD!!!!!
You can hardly find your solution unless you understand the difference between JCL language, and SORT utility control statements.
You can hardly find your solution unless you understand the difference between JCL language, and SORT utility control statements. -> I already have a DB2 solution I was looking if we have anything similar in jcl(to learn and increase my knowledge)
English is not my first language so I wrote jcl sort card. Also I don't need validation from a boomer whose only answer to every problem is "google it" or "RTFM" why not copy past the manual link on the home page and why even have a forum to discuss!
I regret asking question should've asked in stack overflow. Atleast would'nt have encountered a karen
You can hardly find your solution unless you understand the difference between JCL language, and SORT utility control statements. -> I already have a DB2 solution I was looking if we have anything similar in jcl(to learn and increase my knowledge)
I repeat already 4 or 5 times:
There is no any solution of this kind in JCL language!!!!!!! Neither a similar one, nor a different one.
You can use SORT utility, which has absolutely nothing to do with JCL language.
In such situations , you can never rely on current dates .. so always use a business date maintained by your system ..
Yes, but (depending on business requirements) it can be also assumed that the job running from 1st to Nth of each month should generate the previous month report, while running after Nth of the month generates the current month report.
P.S.
None of the issues discussed in this thread is related to "JCL & VSAM", despite TS sticktoitiveness.