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

Replacing 'YYMMDD' with date, varying column positions


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

New User


Joined: 18 Mar 2024
Posts: 4
Location: United States

PostPosted: Tue Apr 09, 2024 8:44 pm
Reply with quote

Within a record, I need to replace the following characters 'YYMMDD' with the actual date. Below is what I'm currently using to do this;

Code:
OUTREC IFTHEN=(WHEN=(44,6,CH,EQ,C'YYMMDD'),OVERLAY=(44:DATENS=(YMD)))


Is there a way to do this if 'YYMMDD' does not start in column 44?

I would like to do something like below;

Code:
OUTREC FINDREP=(IN=C'YYMMDD',OUT=DATENS=(YMD))


however, this doesn't work. I'm assuming FINDREP will only work with literals
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed Apr 10, 2024 9:23 am
Reply with quote

This should work for you:
Code:
//WHATEVER EXEC PGM=SORT               
//SYMNAMES DD *                         
YMD,S'&LYYMMDD.'                       
/*                                     
//SYMNOUT  DD SYSOUT=*                 
//SORTIN   DD *                         
    YYMMDD                             
         YYMMDD                         
                             YYMMDD     
/*                                     
//SYSOUT   DD SYSOUT=*                 
//SORTOUT  DD SYSOUT=*                 
//SYSIN    DD *                         
  OPTION COPY                           
  INREC FINDREP=(INOUT=(C'YYMMDD',YMD))
  END                                   
/*
Back to top
View user's profile Send private message
AlexSalas95

New User


Joined: 18 Mar 2024
Posts: 4
Location: United States

PostPosted: Wed Apr 10, 2024 6:39 pm
Reply with quote

It works beautifully, thank you!
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed Apr 10, 2024 7:21 pm
Reply with quote

If you have to use not the current date, a two step solution is needed. There is a sample somewhere in the forum we have provided some time ago.
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts How to load to DB2 with column level ... DB2 6
No new posts RC query -Time column CA Products 3
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top