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

To get previous month from current timestamp


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

New User


Joined: 02 Jul 2021
Posts: 2
Location: India

PostPosted: Fri Jul 02, 2021 12:07 pm
Reply with quote

I have a situation like whenever I run that sort I should get the current timestamp - 1 monthin the format 'yyyymmdd'

Eg. If I run the job today (2021/07/01) I should get as (2021/06/01)

please help me out. thanks in advance.[/quote]
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Fri Jul 02, 2021 12:19 pm
Reply with quote

Code:
//WHATEVER EXEC PGM=SORT                                       
//SORTIN   DD *                                               
2021/07/02                                                     
/*                                                             
//SYSOUT   DD SYSOUT=*                                         
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  OPTION COPY                                                 
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:1,10,UFF,M10,LENGTH=8,   
    1:81,8,Y4T,SUBMONS,+1,TOGREG=Y4T(/)))                     
  END                                                         
/*
Back to top
View user's profile Send private message
Rohini 3114

New User


Joined: 02 Jul 2021
Posts: 2
Location: India

PostPosted: Fri Jul 02, 2021 12:25 pm
Reply with quote

Got the output as 9999/99/99 in this format
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Fri Jul 02, 2021 12:49 pm
Reply with quote

Have you tried the exact job as I have posted? It works perfectly fine on my site even for a 2021/03/31 date.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Fri Jul 02, 2021 7:58 pm
Reply with quote

Rohini 3114 wrote:
Got the output as 9999/99/99 in this format

100% - your input date format doesn't match the format you declared in you SORT statements.
You SHOULD be able to understand this type of errors by yourself.
BTW: you refuse to present any part of your own code; it is nasty.

Either change your SORT statements, or correct your input data. Nothing else to discuss at the forum when you are trying to hide any information on your code.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Sat Jul 03, 2021 12:01 am
Reply with quote

sergeyken wrote:
100% - your input date format doesn't match the format you declared in your SORT statements.

I definitely would agree. The given code is tested against SYNCSORT and DFSORT, I always test my stuff before posting.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Sat Jul 03, 2021 12:19 am
Reply with quote

Rohini 3114 wrote:
I have a situation like whenever I run that sort I should get the current timestamp - 1 monthin the format 'yyyymmdd'

Eg. If I run the job today (2021/07/01) I should get as (2021/06/01)

please help me out. thanks in advance.

Please search before posting , its simple task and discussed on this forum many a times.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Sat Jul 03, 2021 12:45 am
Reply with quote

What makes it so hard to avoid excessive tags? There is a preview button..
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 Populate last day of the Month in MMD... SYNCSORT 2
No new posts To get the count of rows for every 1 ... DB2 3
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts Changeman - how can we know the curr... Compuware & Other Tools 2
Search our Forums:

Back to Top