Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Removing Hyphens and Dots using Syncsort

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

New User


Joined: 04 Apr 2007
Posts: 34
Location: Chennai

PostPosted: Tue Apr 28, 2020 9:52 pm    Post subject: Removing Hyphens and Dots using Syncsort
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

Active User


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

PostPosted: Wed Apr 29, 2020 12:24 am    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 2387
Location: NY,USA

PostPosted: Wed Apr 29, 2020 1:59 am    Post subject:
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

Active User


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

PostPosted: Wed Apr 29, 2020 2:06 am    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 2387
Location: NY,USA

PostPosted: Wed Apr 29, 2020 2:44 am    Post subject:
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

Active User


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

PostPosted: Wed Apr 29, 2020 3:19 am    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 2387
Location: NY,USA

PostPosted: Wed Apr 29, 2020 4:38 am    Post subject:
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: 34
Location: Chennai

PostPosted: Wed Apr 29, 2020 1:35 pm    Post subject: Reply to: Removing Hyphens and Dots using Syncsort
Reply with quote

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

Active Member


Joined: 29 Apr 2008
Posts: 778
Location: Maryland

PostPosted: Wed Apr 29, 2020 6:20 pm    Post subject:
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    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 Insert System Runtime in HEADER In SY... Rick Ryan SYNCSORT 9 Tue May 26, 2020 9:01 pm
No new posts SYNCSORT in Z/VSE nithinkarthika SYNCSORT 24 Mon May 11, 2020 3:44 pm
No new posts Sort on different fields, removing du... MOHIT KUMAR GUPTA SYNCSORT 8 Thu Apr 16, 2020 5:54 pm
No new posts On a team working on a new project fo... zCMHII All Other Mainframe Topics 2 Mon Apr 06, 2020 9:15 pm
No new posts Accumulating fields using syncsort Hemant L SYNCSORT 6 Fri Feb 07, 2020 2:55 am

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