IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

To fetch records that has Ttamp value of last 7 days


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Chidane

New User


Joined: 25 Nov 2021
Posts: 13
Location: India

PostPosted: Sun Apr 28, 2024 5:30 pm
Reply with quote

Hi Team,

Please help me to solve this.

I have a flat file with record legth 30 bytes having 2 char User ID and 26 char Timestamp. I would like to filter and get the records that has Timestamp value for last 7 days from current date.

Code:
Input file
AB  2012-10-27-12.45.32.791914
CD  2024-04-27-12.45.32.791914
VC  2024-04-19-12.45.32.791914
DF  2024-04-25-12.45.32.791914
ZY  2003-09-25-12.45.32.791914


If I am executing the job with SORT step today 2024-04-28, Output should be
Code:
CD  2024-04-27-12.45.32.791914
DF  2024-04-25-12.45.32.791914


Is it possible to acheive this using DFSORT step.


Thanks
CD
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1281
Location: Bamberg, Germany

PostPosted: Sun Apr 28, 2024 6:27 pm
Reply with quote

Code:
OPTION COPY                                                 
INREC OVERLAY=(31:5,10,UFF,TO=ZD,LENGTH=8,31:31,8,Y4T,AGE=YD)
OUTFIL FNAMES=(SORTOUT),                                     
  INCLUDE=(31,7,ZD,LT,+7),                                   
  REMOVECC,                                                 
  BUILD=(1,30)                                               
END


To deal with the complete timestamp, you will have to add extra logic.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1281
Location: Bamberg, Germany

PostPosted: Mon Apr 29, 2024 10:56 am
Reply with quote

The very short option:

Code:
OPTION COPY                         
INCLUDE COND=(5,10,CH,GE,DATE1(-)-7)
END
Back to top
View user's profile Send private message
Chidane

New User


Joined: 25 Nov 2021
Posts: 13
Location: India

PostPosted: Fri May 03, 2024 10:14 pm
Reply with quote

Thanks Joerg. Both the SORT card works like a charm.
If I want to include HEADER and TRAILER from input data as is to output, what changes I need to make in the second SORT card

Input file
Code:
 HEADER 2024-05-03
AB  2012-10-27-12.45.32.791914
CD  2024-04-27-12.45.32.791914
VC  2024-04-19-12.45.32.791914
DF  2024-04-25-12.45.32.791914
ZY  2003-09-25-12.45.32.791914
9TRAILER
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1281
Location: Bamberg, Germany

PostPosted: Sat May 04, 2024 12:40 am
Reply with quote

Just extend the INCLUDE statement, or use HEADER/TRAILER parameters in the OUTFIL statement. It's up to you.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files and write Matched/Unm... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top