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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts SUBSTR for Date functions Shaheen Shaik DB2 4 Thu Apr 06, 2017 2:14 pm
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm


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