Posted: Mon Apr 13, 2020 4:09 pm Post subject: DATE1 equal or greater.
Good day,
Need help to develop dates compare in DFSORT.
Have two datasets, both are RECFM=FB,LRECL=80.
Dataset A can:
a) be empty
b) have a single record - YYYYMMDD date in pos 1.
Dataset B will always have a single record with YYYYMMDD current date in pos 1.
Need to compare contents of both datasets, and
Code:
if dataset A date < OR = dataset B date
write dataset A to output dataset C
ELSE
write a blank output dataset C.
If dataset A being occasionally empty complicates things, I can do a check and run date compare only if dataset A is not empty.
But if that doesn't matter, I'd prefer the conditions as is.
Joined: 26 Nov 2002 Posts: 12370 Topics: 75 Location: San Jose
Posted: Mon Apr 13, 2020 5:48 pm Post subject:
ramy2016,
It is simple task. You can do the empty file check in the same step itself. You haven't explained what the output is when FILE A is empty. Also how do you handle when FILE B is empty?
Either way here is a job that will give you the desired results
kolusu, thank you for your response.
To answer your questions:
- when dataset A is empty - output C should also be empty
- dataset B will never be empty, since I'm extracting a current date prior to compare.
I was doing that differently by using REFORMAT FIELDS=(F1:1,80,?) and then checking the value in postition 81.
One more favor to ask, please.
Is it possible to have a totally empty dataset C when conditions are not met? Your sort inserts a blank record (spaces) into dataset C.
Thanks.
Joined: 26 Nov 2002 Posts: 12370 Topics: 75 Location: San Jose
Posted: Tue Apr 14, 2020 10:36 am Post subject:
ramy2016 wrote:
kolusu, thank you for your response.
To answer your questions:
- when dataset A is empty - output C should also be empty
- dataset B will never be empty, since I'm extracting a current date prior to compare.
I was doing that differently by using REFORMAT FIELDS=(F1:1,80,?) and then checking the value in postition 81.
One more favor to ask, please.
Is it possible to have a totally empty dataset C when conditions are not met? Your sort inserts a blank record (spaces) into dataset C.
Thanks.
Huh? Your Sort? I am merely following the requirements, that you stated. So don't blame me.
In your first post you said you wanted to write out an "write a blank output dataset C. " in the ELSE part
ramy2016 wrote:
Code:
ELSE
write a blank output dataset C.
You can't make up your mind? It is tough to provide solutions to a moving target.
Either way add the following to your SYSIN cards which will give you the desired results
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum