**********************************************************************
*
*
* Service program to handle fiscal year type functions
*
**********************************************************************
H NoMain
H Expropts( *ResDecPos )
* Prototypes
D Mod PR 7P 0
D Integer 7P 0 Value
D Modulus 7P 0 Value
D pFstDayQtr PR D
D SomeDte D Value
D pLstDayQtr PR D
D SomeDte D Value
* Global data
* Change this value to whatever month number is the
* first month of your fiscal year
D FsclYrMo S 3P 0 Inz( 1 )
**********************************************************************
*
* Return the first day of the quarter
*
**********************************************************************
P pFstDayQtr B Export
D PI D
D SomeDte D Value
*Local variables
D ExtrctdMo S 3P 0
D ExtrctdDa S 3P 0
D DiffMod3 S 1P 0
D FstQtrMo S 3P 0
D RetDte S D
*Extract the month
C Extrct SomeDte:*M ExtrctdMo
* Subtract the difference between SomeDte and FstFsclMo mod 3
* from SomeDte. This will get you to the correct month.
C Eval DiffMod3 = Mod( ExtrctdMo - FsclYrMo: 3 )
C SomeDte SubDur DiffMod3:*M RetDte
* Make this the first of the month
C Extrct RetDte:*D ExtrctdDa
C Eval ExtrctdDa = ExtrctdDa - 1
C SubDur ExtrctdDa:*D RetDte
C Return RetDte
P pFstDayQtr E
**********************************************************************
*
* Return the last day of the quarter
*
**********************************************************************
P pLstDayQtr B Export
D PI D
D SomeDte D Value
*Local variables
D RetDte S D
* Last day of the quarter = first day of quarter + 3 months - 1 day
C Eval RetDte = pFstDayQtr( SomeDte )
C AddDur 3:*M RetDte
C SubDur 1:*D RetDte
C Return RetDte
P pLstDayQtr E
**********************************************************************
*
* Return the supplied modulus of the supplied integer
*
**********************************************************************
P Mod B
D Mod PI 7P 0
D Integer 7P 0 Value
D Modulus 7P 0 Value
* Local variables
D RetVal S 7P 0
D WrkNum S 7P 0
C Integer Div Modulus WrkNum
C Mvr RetVal
C If RetVal < 0
C Eval RetVal = RetVal + Modulus
C EndIf
C Return RetVal
P Mod E
¤³¤Î¥Ú¡¼¥¸¤Ø¤Î¥³¥á¥ó¥È
odJooK Great, thanks for sharing this blog post.Really thank you! Fantastic.
IPKoGT <a href="http://lqtqhkrizxic.com/">lqtqhkrizxic</a>, [url=http://cqnetipmccdu.com/]cqnetipmccdu[/url], [link=http://wlqgjyxbsldq.com/]wlqgjyxbsldq[/link], http://laykrdsxitig.com/