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

Active Member


Joined: 15 Aug 2015
Posts: 607
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

Active Member


Joined: 15 Aug 2015
Posts: 607
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
Warnings : 2

Senior Member


Joined: 29 Apr 2008
Posts: 1189

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

Active Member


Joined: 15 Aug 2015
Posts: 607
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: 2771
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

Active Member


Joined: 15 Aug 2015
Posts: 607
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 Write a current record plus previous ... DFSORT/ICETOOL 4
No new posts How to append Previous date into a S... JCL & VSAM 2
No new posts Calculate with timestamp PL/I & Assembler 19
No new posts Execute step regardless of previous s... JCL & VSAM 2
No new posts Last day of the month via SYNCSORT. SYNCSORT 5
Search our Forums:

Back to Top