Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

calculating previous months last date.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
Mane Sagar

New User


Joined: 12 Jul 2005
Posts: 41
Location: mumbai

PostPosted: Thu Feb 16, 2006 7:10 pm    Post subject: calculating previous months last date.
Reply with quote

Hi All,

I have a query here.
I had a rqmt to write a pgm that takes system date and calcs prior months last date. So that I can give this value in the output file.
Like if its 15/01/06 then I shud calc and send 31/12/05 i.e Dec 12, 2005.
If its March,2006 then it shud check if this is a leap year. If yes then send 29/02/06 to the output file else 28/02/05.

In simple words calculating how many days the last month mite be having 28, 29, 30 or 31.

I just wanted to ask is. Can I do this in a jcl in a simpler way. If any.

Regds,
Sagar.
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Sun Feb 19, 2006 6:08 pm    Post subject:
Reply with quote

Hi -

You can't do that in JCL, since JCL is a control language (Job Control Language), not a programming language.

However, you can do it in other language, like the below REXX example, and submit it using JCL.

Code:
/* REXX */                                                             
                                                                       
SAY ' LAST DAY OF PREVIOUS MONTH: ' ,                                 
    DATE(S, DATE(B, TRANSLATE('A2345601', DATE(S), 'A23456'), S) - 1,B)
                                                                       
EXIT                                                                   
                                                                       


BTW - I found the above code using simple search in Google.


O.
Back to top
View user's profile Send private message
amitava
Warnings : 1

Active User


Joined: 30 Oct 2005
Posts: 186
Location: India

PostPosted: Mon Feb 20, 2006 4:45 pm    Post subject:
Reply with quote

Hi Mane Sagar,
I will also suggest you to go for REXX for ur requirement. For REXX, what OFFER71 has suggested you is quite fine. But if you have DB2 access then by querying to SYSIBM.SYSDUMMY you can easily get the date of ur previous month. If u want the query, pls let me know and I will send u the query.
Back to top
View user's profile Send private message
Mane Sagar

New User


Joined: 12 Jul 2005
Posts: 41
Location: mumbai

PostPosted: Sat Feb 25, 2006 12:21 pm    Post subject:
Reply with quote

Hi

Thanx a lot Amitava and Ofer71.
I will look out for writing a rexx.

Regds,
Sagar.
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts How to get previous month in SYMNAMES Suganya87 SYNCSORT 9 Fri Oct 28, 2016 1:37 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us