× Discuss on Template programming, jBASE programming, Enquiries, No-File enquiry, Enquiry routines, Version, Version routines, Menus, Abbriviations, Creating local reference fields, Fast path enquiries, Creating charts and graphs, Generating Reports, Deal slips, Straight through processing, Multi Company and Multi Book setup, Tabbed screens, Composite Screens, T24 API, etc...

Increase DATE in date field

  • dfixx
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
13 years 2 months ago #11137 by dfixx
Increase DATE in date field was created by dfixx
Goodday All,

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
  • Visitor
13 years 2 months ago #11138 by johnperez
Replied by johnperez on topic Re: Increase DATE in date field
In the field LD.LOANS.AND.DEPOSITS>FIN.MAT.DATE you can put (for example) 120M, and the IN2 routine makes the calculation ... and the result is 20220412 (reference to VALUE.DATE)

The IN2 routine is IN2MATLMM ...

Please Log in or Create an account to join the conversation.

  • dfixx
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
13 years 2 months ago #11139 by dfixx
Replied by dfixx on topic Re: Increase DATE in date field
Thanks for your response John I know this is possible in the field I am asking how this can be coded in routine say for instance as explained above 20010101 + 10YEARS.
perhaps 20010101 is opening date in customer table.

Please Log in or Create an account to join the conversation.

More
13 years 2 months ago #11142 by Azizfatkh
Replied by Azizfatkh on topic Re: Increase DATE in date field
Simply adding is not an option?

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.

More
13 years 2 months ago #11145 by Gigiipse
Replied by Gigiipse on topic Re: Increase DATE in date field
Function CFQ
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.

More
13 years 2 months ago #11147 by durai611
Replied by durai611 on topic Re: Increase DATE in date field
Dear dfixx,

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.
The following user(s) said Thank You: dfixx, Azizfatkh

Please Log in or Create an account to join the conversation.

  • jpb
  • jpb's Avatar
  • Offline
  • Moderator
  • Moderator
  • retired . . . ¯\_(ツ)_/¯
More
13 years 2 months ago #11149 by jpb
Replied by jpb on topic Re: Increase DATE in date field
To use CFQ with more than 99 month you must define your own frequency in EB.FREQUENCY.

CDT works also with "+3650C", but you have to think about leap-years (or overwrite the daypart after the call)
The following user(s) said Thank You: Azizfatkh

Please Log in or Create an account to join the conversation.

  • dfixx
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
13 years 2 months ago #11155 by dfixx
Replied by dfixx on topic Re: Increase DATE in date field
Thank you all will try which options works best.

Please Log in or Create an account to join the conversation.

  • dfixx
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
13 years 2 months ago #11168 by dfixx
Replied by dfixx on topic Re: Increase DATE in date field
Eventually I was able to use 'Azizfatkh' solution. Thanks all for your contributions

Please Log in or Create an account to join the conversation.

More
13 years 2 months ago #11173 by Azizfatkh
Replied by Azizfatkh on topic Re: Increase DATE in date field
johnperez yes, i knew about that issue and that's why i appreciated durai's and jpb's knowledge...

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
  • Senior Member
More
13 years 2 months ago #11181 by dfixx
Replied by dfixx on topic Re: Increase DATE in date field
Thanks so much I appreciate your input!

Please Log in or Create an account to join the conversation.

More
13 years 2 months ago #11235 by durai611
Replied by durai611 on topic Re: Increase DATE in date field
Check this program for WORKING.DAY
    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
  • Visitor
13 years 1 month ago #11351 by namco
Replied by namco on topic Re: Increase DATE in date field
Hi durai611

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.

More
13 years 1 month ago #11352 by durai611
Replied by durai611 on topic Re: Increase DATE in date field
Hi,

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.

Time to create page: 0.050 seconds