MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DATE1 equal or greater.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
ramy2016
Beginner


Joined: 18 Apr 2016
Posts: 46
Topics: 14

PostPosted: Mon Apr 13, 2020 4:09 pm    Post subject: DATE1 equal or greater. Reply with quote

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.

Thanks.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Mon Apr 13, 2020 5:48 pm    Post subject: Reply with quote

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
Code:

//STEP0100 EXEC PGM=SORT             
//SYSOUT   DD SYSOUT=*               
//INA      DD DISP=SHR,DSN=Your input FB 80 File A
//INB      DD DISP=SHR,DSN=Your input FB 80 File B
//SORTOUT  DD DSN=Your output file C,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(TRK,(1,0))             
//SYSIN    DD *                       
  JOINKEYS F1=INA,FIELDS=(1,8,A)     
  JOINKEYS F2=INB,FIELDS=(1,8,A)     
  JOIN UNPAIRED                       
  REFORMAT FIELDS=(F1:1,80)           
  OPTION COPY,STOPAFT=1               
/*                                   
//JNF1CNTL DD *                       
  OPTION STOPAFT=1                   
/*                                   
//JNF2CNTL DD *                       
  OPTION STOPAFT=1                   
/*

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ramy2016
Beginner


Joined: 18 Apr 2016
Posts: 46
Topics: 14

PostPosted: Tue Apr 14, 2020 8:15 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Tue Apr 14, 2020 10:36 am    Post subject: Reply with quote

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
Code:

OUTFIL OMIT=(1,80,CH,EQ,C' ')

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ramy2016
Beginner


Joined: 18 Apr 2016
Posts: 46
Topics: 14

PostPosted: Tue Apr 14, 2020 2:23 pm    Post subject: Reply with quote

Sorry for the confusion kolusu, and thanks for your help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group