Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Comparing dates in different formats

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
migusd

New User


Joined: 08 Aug 2014
Posts: 31
Location: USA

PostPosted: Sat Nov 18, 2017 3:02 am    Post subject: Comparing dates in different formats
Reply with quote

Hello guys,
I just haven't understand how to manage dates in SYNCSORT
Can someone help me understand it ?
I am comparing a date in the record with yesterday's date in the system
If they are different I need the record in the output file and set RC=4

So here is the code
Code:

  INREC BUILD=(FEMA,COM,HDAT,BLK,HTIM,BLK,DATE1(/)-1)                 
  SORT FIELDS=COPY,STOPAFT=1                                           
  OUTFIL INCLUDE=(HDAT,LT,25,10,CH),BUILD=(1,24),VTOF,                 
  NULLOFL=RC0                                                         
DATA DICTIONARY SYMBOLS SUBSTITUTED :                                 
INREC BUILD=(1,4,C',',6,10,C' ',17,8,C' ',DATE1(/)-1)                 
SORT FIELDS=COPY,STOPAFT=1                                             
OUTFIL INCLUDE=(6,10,CH,LT,25,10,CH),BUILD=(1,34),VTOF,NULLOFL=RC4     


So, I couldn't get the desired results. I force the output including both dates.
here is the output file
Code:

FEMA,11/13/2017 20:21:232017/11/16


So the comparing failed because of the date format being different.
I was looking at the manual and I saw Y2W meaning 2 digits for years.
So I tried Y4W. I believe it accepted it. but not Y4W-1
Code:

INREC BUILD=(1,4,C',',6,10,C' ',17,8,Y4W(/)-1)
                                           * 


So, how can I get yesterday's date in MM/DD/YYYY so I can compare it?
Also, is that the correct way of forcing RC=4 when condition is met?

Thank you
Back to top
View user's profile Send private message

sergeyken

Active User


Joined: 29 Apr 2008
Posts: 340
Location: Maryland

PostPosted: Tue Nov 21, 2017 12:10 am    Post subject:
Reply with quote

Y4W is the date FORMAT supported by SORT.
It cannot be used instead of date FUNCTION.

RTFM, please
Back to top
View user's profile Send private message
migusd

New User


Joined: 08 Aug 2014
Posts: 31
Location: USA

PostPosted: Tue Nov 21, 2017 12:23 am    Post subject:
Reply with quote

thanks Sergey,
I have solved my issue
I have a different issue now that I will soon post.
Thank you for your response
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 340
Location: Maryland

PostPosted: Tue Nov 21, 2017 12:33 am    Post subject:
Reply with quote

The easiest way to match date formats is, - to reformat the input field in accordance with the used DATE function, and then to compare two fields with the same format.

Correct way to force RC=4 is, parameter NULLOFL=RC4 in OUTREC/OUTFIL statement (to indicate that the corresponding file is empty)
Back to top
View user's profile Send private message
migusd

New User


Joined: 08 Aug 2014
Posts: 31
Location: USA

PostPosted: Tue Nov 21, 2017 3:28 am    Post subject:
Reply with quote

thanks Sergey.
I have not been able to get RC=4 when the output file is empty.
see my latest post
Thank you
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Comparing Comp-3 fields with greater ... Prateeksichem1 DFSORT/ICETOOL 11 Fri Jul 13, 2018 8:45 am
No new posts Comparing inside same file vickey_dw DFSORT/ICETOOL 2 Tue Jul 10, 2018 9:51 pm
No new posts Comparing two sequential files Mohan Kothakota COBOL Programming 14 Mon Apr 16, 2018 6:35 pm
No new posts To get Non matching row after compari... vinu78 DB2 7 Fri Jan 05, 2018 5:43 pm
This topic is locked: you cannot edit posts or make replies. Comparing current time with the time ... arunsoods SYNCSORT 1 Mon Oct 30, 2017 4:07 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us