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

Help with SORT - I need to validate date and timestamp


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

New User


Joined: 30 Apr 2020
Posts: 13
Location: United States

PostPosted: Thu Dec 26, 2024 8:48 am
Reply with quote

Hi, I have a requirement where my date and timestmap is coming in this format
Code:

 Input
12/21/2024-20.63.66.000000
12/22/2024-20.26.67.000000
12/23/2024-20.35.75.000000
12/21/2024-20.56.80.000000
 
 

I need to validate the hh.mm.ss and
- convert the Seconds, if its over 59 and increment it the minutes to 1 validate
- check minutes, if its over 59, then increment the hour by 1 and convert the rest as Minute

Code:

output
12/21/2024-21.04.06.000000
12/22/2024-20.27.07.000000
12/23/2024-20.36.15.000000
12/21/2024-20.57.20.000000



Thanks in advance.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2144
Location: USA

PostPosted: Thu Dec 26, 2024 6:49 pm
Reply with quote

Please, clarify you post:

1) Do you need an advise on the sequence of operations to produce your result? Or
2) Do you need your job to be done by someone else, and you were provided with a ready-to-copy-and-paste working code?

P.S.
From my primary school days I remember: the required process is called "rounding the time value"

P.P.S.
Do you need also to update the date value after your hours value becomes 24 or more? Such as:
12/31/2024-23.59.59.999999 -> 01/01/2025-00.00.00.000000
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2144
Location: USA

PostPosted: Thu Dec 26, 2024 8:23 pm
Reply with quote

Some hints.

How to round the seconds value
Code:
 . . . . . . . . . . .
 IFTHEN=(WHEN=(21,6,ZD,GE,+500000),   add one second     
         OVERLAY=(18:18,2,ZD,ADD,+1,TO=ZDF,LENGTH=2),     
         HIT=NEXT),
 IFTHEN=(WHEN=(21,6,ZD,GE,+0),        reset fractions of second 
         OVERLAY=(21:C'000000'),                                 
         HIT=NEXT),                                                                                   
 . . . . . . . . . . . .

How to add one day to the date value
Code:
 . . . . . . . . . . .
 IFTHEN=(WHEN=INIT,                                           
         OVERLAY=(81:7,4,1,2,4,2)),   MM/DD/YYYY->YYYYMMDD     
 IFTHEN=(WHEN=(12,2,ZD,GE,+24),       add one day         
         OVERLAY=(12:12,2,ZD,SUB,+24,TO=ZDF,LENGTH=2,     
                  1:81,8,Y4T,ADDDAYS,+1,TOGREG=Y4W(/)))   
 . . . . . . . . . . .
Back to top
View user's profile Send private message
andy12

New User


Joined: 30 Apr 2020
Posts: 13
Location: United States

PostPosted: Thu Dec 26, 2024 8:31 pm
Reply with quote

sergeyken wrote:
Please, clarify you post:

1) Do you need an advise on the sequence of operations to produce your result? Or
2) Do you need your job to be done by someone else, and you were provided with a ready-to-copy-and-paste working code?

P.S.
From my primary school days I remember: the required process is called "rounding the time value"

P.P.S.
Do you need also to update the date value after your hours value becomes 24 or more? Such as:
12/31/2024-23.59.59.999999 -> 01/01/2025-00.00.00.000000



Hi
I tried using the below approach using MOD but i'm getting error using MOD
Code:


OPTION COPY INREC IFTHEN=(WHEN=(1,2,CH,GE,C'24'),
           OVERLAY=(1:1,2,TO=ZD,MOD,24)),
        IFTHEN=(WHEN=(3,2,CH,GE,C'60'),
        OVERLAY=(3:1,2,TO=ZD,MOD,60), BUILD=(1,5,2,1,3,2,TO=ZD)),
   IFTHEN=(WHEN=(5,2,CH,GE,C'60'),
            OVERLAY=(5:1,2,TO=ZD,MOD,60), BUILD=(1,5,3,1,5,2))



Yes, i need to update my date as well accordingly. Thanks
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2144
Location: USA

PostPosted: Thu Dec 26, 2024 8:41 pm
Reply with quote

andy12 wrote:
sergeyken wrote:
Please, clarify you post:

1) Do you need an advise on the sequence of operations to produce your result? Or
2) Do you need your job to be done by someone else, and you were provided with a ready-to-copy-and-paste working code?

P.S.
From my primary school days I remember: the required process is called "rounding the time value"

P.P.S.
Do you need also to update the date value after your hours value becomes 24 or more? Such as:
12/31/2024-23.59.59.999999 -> 01/01/2025-00.00.00.000000



Hi
I tried using the below approach using MOD but i'm getting error using MOD
Code:


OPTION COPY INREC IFTHEN=(WHEN=(1,2,CH,GE,C'24'),
           OVERLAY=(1:1,2,TO=ZD,MOD,24)),
        IFTHEN=(WHEN=(3,2,CH,GE,C'60'),
        OVERLAY=(3:1,2,TO=ZD,MOD,60), BUILD=(1,5,2,1,3,2,TO=ZD)),
   IFTHEN=(WHEN=(5,2,CH,GE,C'60'),
            OVERLAY=(5:1,2,TO=ZD,MOD,60), BUILD=(1,5,3,1,5,2))



Yes, i need to update my date as well accordingly. Thanks


Try with my hints
Back to top
View user's profile Send private message
andy12

New User


Joined: 30 Apr 2020
Posts: 13
Location: United States

PostPosted: Thu Dec 26, 2024 9:12 pm
Reply with quote

sergeyken wrote:
andy12 wrote:
sergeyken wrote:
Please, clarify you post:

1) Do you need an advise on the sequence of operations to produce your result? Or
2) Do you need your job to be done by someone else, and you were provided with a ready-to-copy-and-paste working code?

P.S.
From my primary school days I remember: the required process is called "rounding the time value"

P.P.S.
Do you need also to update the date value after your hours value becomes 24 or more? Such as:
12/31/2024-23.59.59.999999 -> 01/01/2025-00.00.00.000000



Hi
I tried using the below approach using MOD but i'm getting error using MOD
Code:


OPTION COPY INREC IFTHEN=(WHEN=(1,2,CH,GE,C'24'),
           OVERLAY=(1:1,2,TO=ZD,MOD,24)),
        IFTHEN=(WHEN=(3,2,CH,GE,C'60'),
        OVERLAY=(3:1,2,TO=ZD,MOD,60), BUILD=(1,5,2,1,3,2,TO=ZD)),
   IFTHEN=(WHEN=(5,2,CH,GE,C'60'),
            OVERLAY=(5:1,2,TO=ZD,MOD,60), BUILD=(1,5,3,1,5,2))



Yes, i need to update my date as well accordingly. Thanks


Try with my hints


Thanks. I dont need to convert my date. Just Hh:mm:ss is major
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 JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Is this possible via sort (in one pass)? SYNCSORT 4
No new posts GDG generation name to GDG Base name ... DFSORT/ICETOOL 3
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts Date format correction using dfsort DFSORT/ICETOOL 3
Search our Forums:

Back to Top