Increase DATE in date field
- dfixx
- Topic Author
- Offline
- Senior Member
-
- Posts: 73
- Thank you received: 0
Please can anyone advise how to increment date in a date field.
eg Date is 20010707, what command can use to increase this by 10 years in a routine.
Note: Output should be 20110707.
Thank you
This email address is being protected from spambots. You need JavaScript enabled to view it.
jbase 5
Please Log in or Create an account to join the conversation.
- johnperez
- Visitor
-
The IN2 routine is IN2MATLMM ...
Please Log in or Create an account to join the conversation.
- dfixx
- Topic Author
- Offline
- Senior Member
-
- Posts: 73
- Thank you received: 0
perhaps 20010101 is opening date in customer table.
Please Log in or Create an account to join the conversation.
- Azizfatkh
- Offline
- Junior Member
-
- Posts: 35
- Thank you received: 0
DATE.1 = 20010707
YEAR.1 = DATE.1[1,4]
MONTH.DAY = DATE.1[4,4]
YEAR.2 = YEAR.1 + 10
DATE.2 = YEAR.2:MONTH.DAY
Please Log in or Create an account to join the conversation.
- Gigiipse
- Offline
- Senior Member
-
- Posts: 40
- Thank you received: 1
Description:
Calculates the next date from today's date and a frequency code.
Arguments:
COMI from I COMMON
Incoming:
COMI
YYYYMMDDXXXXX where XXXXX is the frequency code.
Returned:
COMI
YYYYMMDDXXXXX the calculated date and the frequency code.
Please Log in or Create an account to join the conversation.
- durai611
- Offline
- Elite Member
-
- Posts: 300
- Thank you received: 51
If you are going to use IN2MATLMM then you have to pass the N & T array. You can see the details of N & T array in I_RULES in GLOBUS.BP/T24.BP respect to your release.
CALL IN2MATLMM(N1,T1)
And also before using this you have to know how it works.
For example, take maturity date itself. When you enter 10M in maturity date field of LD application, based on the field value date of the contract, system will calculate the maturity date. To achieve this, internally before calling this IN2 routine, field position of value date in R.NEW should be passed, along with the country code. Else it won't work. In COMI, you can pass either nnW,nnM & nnD for week, month & days.
CFQ is another option. Also try for CDT & WORKING.DAYS, else you can write a logic of your own as Azizfatkh said, but you have to cater for working day and the date part.
Please Log in or Create an account to join the conversation.
- jpb
-
- Offline
- Moderator
-
- retired . . . ¯\_(ツ)_/¯
- Posts: 2859
- Thank you received: 650
CDT works also with "+3650C", but you have to think about leap-years (or overwrite the daypart after the call)
Please Log in or Create an account to join the conversation.
- dfixx
- Topic Author
- Offline
- Senior Member
-
- Posts: 73
- Thank you received: 0
Please Log in or Create an account to join the conversation.
- dfixx
- Topic Author
- Offline
- Senior Member
-
- Posts: 73
- Thank you received: 0
Please Log in or Create an account to join the conversation.
- Azizfatkh
- Offline
- Junior Member
-
- Posts: 35
- Thank you received: 0
In case dfixx you want to develop your own calculation just add this simple check to determine validity of 29th Feb
0006 YEAR = 2003
0007
0008 IF MOD(YEAR,4) EQ 0 THEN
0009 IF MOD(YEAR,100) EQ 0 THEN
0010 IF MOD(YEAR,400) EQ 0 THEN
0011 PRINT "LEAP YEAR"
0012 END ELSE
0013 PRINT "NOT LEAP YEAR"
0014 END
0015 END ELSE
0016 PRINT "LEAP YEAR"
0017 END
0018 END ELSE
0019 PRINT "NOT LEAP YEAR"
0020 END
durai611 could give example for CALL IN2MATLMM(N1,T1) and to form frequency code for CFQ. Thanks
Please Log in or Create an account to join the conversation.
- dfixx
- Topic Author
- Offline
- Senior Member
-
- Posts: 73
- Thank you received: 0
Please Log in or Create an account to join the conversation.
- durai611
- Offline
- Elite Member
-
- Posts: 300
- Thank you received: 51
PROGRAM TEST.DATE
$INSERT I_COMMON
$INSERT I_EQUATE
CAL.TYPE = ''
COUNTRY.CD = 'US'
START.DATE = 20100101
DISPLACEMENT = '1M' ;* Also try with D & W
CALL WORKING.DAY(CAL.TYPE,START.DATE,'',DISPLACEMENT,'',COUNTRY.CD,'',RETURN.DATE,RETURN.CODE,RETURN.DISPLACEMENT)
CRT RETURN.DATE
STOP
Please Log in or Create an account to join the conversation.
- namco
- Visitor
-
Can you send me more information about the WORKING.DAY routine .i.e. which variables it takes in and which it returns.
Thank you.
Please Log in or Create an account to join the conversation.
- durai611
- Offline
- Elite Member
-
- Posts: 300
- Thank you received: 51
Onething I forgot to mention. You have to check whether this routine WORKING.DAY is allowed to use in your local development.
Please Log in or Create an account to join the conversation.