IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Find and replace YccyyMmm to previous month.


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

New User


Joined: 14 Aug 2011
Posts: 24
Location: india

PostPosted: Fri Oct 09, 2015 1:19 am
Reply with quote

Hello,

I need to read input file and replace YyyyyMmm to previous month details i.e. Y2015M09.

Code:

//SORTIN   DD *                       
<SERVER>                                                     
<LOGIN ID & PWD>
PUT  ‘ABCD.A1234.FILE1.YyyyyMmm'      FILE1.TXT                             
PUT  ‘ABCD.A1234.FILE2.YyyyyMmm'      FILE2.TXT
QUIT                                                                           
/*                                     


Output should be
Code:

<SERVER>                                                     
<LOGIN ID & PWD>
PUT  ‘ABCD.A1234.FILE1.Y2015M09'      FILE1.TXT                             
PUT  ‘ABCD.A1234.FILE2.Y2015M09'      FILE2.TXT       
QUIT 
/*   


thank you for your help in advance.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7312
Location: Inside the Matrix

PostPosted: Fri Oct 09, 2015 1:54 am
Reply with quote

OK, but where are you going to get your date from to work out what the previous month is?
Back to top
View user's profile Send private message
santosh_g

New User


Joined: 14 Aug 2011
Posts: 24
Location: india

PostPosted: Fri Oct 09, 2015 2:02 am
Reply with quote

From current date (like DATE2 -1) and pull only yyyy and mm.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7312
Location: Inside the Matrix

PostPosted: Fri Oct 09, 2015 2:34 am
Reply with quote

And what are you going to do for testing? And what are you going to do for a re-run which is inconveniently "outside" the month which would give the "correct" result?

Bad idea.

If you're doing that, what problem do you have in achieving it? Why would you use FINDREP? The date is in a fixed position and is identifiable.
Back to top
View user's profile Send private message
santosh_g

New User


Joined: 14 Aug 2011
Posts: 24
Location: india

PostPosted: Fri Oct 09, 2015 7:25 pm
Reply with quote

I tried something below for test runs but it didn't work out.

I was not using FINDREP but IFTHEN & OVERLAY.

Code:

//SORTIN   DD * 
&YYYYMMDD       
/*               



Code:

SORT FIELDS=COPY                                           
INREC IFOUTLEN=80,IFTHEN=(WHEN=INIT,                       
OVERLAY=(81:DATE2-1,C'01',81:81,8,Y4T,LASTDAYM,TOGREG=Y4T, 
           11:87,2,85,2,81,4))                             
IFTHEN=(WHEN=(1,9,CH,EQ,C'&YYYYMMDD'),                     
OVERLAY=(81:DATE2-1,C'01',81:81,8,Y4T,LASTDAYM,TOGREG=Y4T, 
           11:C'Y',12:81,4,16:C'M',17,87,2))               
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7312
Location: Inside the Matrix

PostPosted: Fri Oct 09, 2015 8:34 pm
Reply with quote

In what way didn't it work? Can you show the sysout and any results, please?
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

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts How to find which file contains my se... DFSORT/ICETOOL 6
No new posts Need to split single line into two li... DFSORT/ICETOOL 7
No new posts Hex Value - vb file replace old date ... DFSORT/ICETOOL 14
No new posts NOT ABLE TO FIND DB2 ROWS DB2 2
No new posts Java Batch launcher JVMPRC86 does not... IBM Tools 2

Back to Top