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

Removing Hyphens and Dots using Syncsort


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
PORYES

New User


Joined: 04 Apr 2007
Posts: 38
Location: Chennai

PostPosted: Tue Apr 28, 2020 9:52 pm
Reply with quote

Hi -

How to remove the Hyphens and Dots from the below date time format.

2020-04-28-07.40.30

I am using DATE4 function to get the date time format, But My output should not contain any '-' and '.'

Output shout be: 20200428074030

Can someone help me?

My Syncsort version is : 2.1
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed Apr 29, 2020 12:24 am
Reply with quote

Input:
Code:
//DATE4    EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//SORTIN   DD *                                     
DUMMY                                                 
/*                                                 
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                                     
  OPTION COPY                                       
  OUTREC OVERLAY=(1:DATE4,
                  21:1,19,UFF,LENGTH=15)   
/*

Output:
Code:
2020-04-28-20.56.49 20200428205649
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3049
Location: NYC,USA

PostPosted: Wed Apr 29, 2020 1:59 am
Reply with quote

Code:
//S1       EXEC PGM=SORT                               
//SORTIN   DD *                                         
2020-04-28-20.56.49                                     
/*                                                     
//SORTLIST DD SYSOUT=*                                 
//SYSOUT   DD SYSOUT=*                                 
//SORTOUT  DD SYSOUT=*                                 
//ANY      DD DUMMY                                     
//SYSIN    DD *                                         
  OPTION COPY                                           
  INREC OVERLAY=(1,80,SQZ=(SHIFT=LEFT,PREBLANK=C'-,.'))

Output-
Code:
20200428205649
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed Apr 29, 2020 2:06 am
Reply with quote

Code:
//SORTIN   DD *                           
2020-04-28-20.56.49                       
/*                                         
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD *                           
  OPTION COPY                             
  INREC BUILD=(1,4,6,2,9,2,12,2,15,2,18,2)
/*

Code:
20200428205649

icon_lol.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3049
Location: NYC,USA

PostPosted: Wed Apr 29, 2020 2:44 am
Reply with quote

haha - Many more ways
Code:
//S1       EXEC PGM=SORT           
//SORTIN   DD *                   
2020-04-28-20.56.49               
/*                                 
//SORTLIST DD SYSOUT=*             
//SYSOUT   DD SYSOUT=*             
//SORTOUT  DD SYSOUT=*             
//ANY      DD DUMMY               
//SYSIN    DD *                   
  SORT FIELDS=COPY                 
  INREC FINDREP=(INOUT=(C'-',C'',
                         C'.',C''))

Output-
Code:
20200428205649
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed Apr 29, 2020 3:19 am
Reply with quote

Code:
//ANOTHER  EXEC PGM=SORT                       
//SORTIN   DD *                                 
2020-04-28-20.56.49                             
/*                                             
//SYSOUT   DD SYSOUT=*                         
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                                 
  OPTION COPY                                   
  INREC IFTHEN=(WHEN=INIT,                     
    PARSE=(%1=(STARTAT=NUM,FIXLEN=4),           
           %2=(STARTAT=NUM,FIXLEN=2,REPEAT=5)),
  OVERLAY=(21:%1,%2,%3,%4,%5,%6))               
/*

Output:
Code:
2020-04-28-20.56.49 20200428205649


That's now a couple of options to chose from, I'd say.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3049
Location: NYC,USA

PostPosted: Wed Apr 29, 2020 4:38 am
Reply with quote

Yes and if TS wants more we have more ways 👍
Back to top
View user's profile Send private message
PORYES

New User


Joined: 04 Apr 2007
Posts: 38
Location: Chennai

PostPosted: Wed Apr 29, 2020 1:35 pm
Reply with quote

Thanks everyone for your help!
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Wed Apr 29, 2020 6:20 pm
Reply with quote

This suggestion by Joerg is the most suitable to the author's situation, I guess
Code:
 UFF,LENGTH=15

I would update it to the following
Code:
 UFF,EDIT=(TTTTTTTTTTTTTTT)

as a "fool-proof" solution (to fill with zeroes in case some wrong data detected on input instead of a correct timestamp)
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 -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Count Records with a crietaria in a f... DFSORT/ICETOOL 5
No new posts DFSORT/SYNCSORT/ICETOOL JCL & VSAM 8
No new posts Syncsort "Y2C" Function SYNCSORT 1
No new posts Removing date values lines/records fr... SYNCSORT 2
Search our Forums:

Back to Top