IBM Power Systems AS/400 iSeries ¤Ë´Ø¤¹¤ë³Ð¤¨½ñ¤­¤Ê¥Ú¡¼¥¸¤Ç¤¹¡£

ILE-RPG »ÍȾ´ü½éÆü¤ÈËöÆü¤òÊÖ¤¹¥×¥í¥°¥é¥à

SystemiNetwork¤Ë¤¢¤Ã¤¿¥µ¥ó¥×¥ë

FISCALYR.RPGLE

¥½¡¼¥¹
      **********************************************************************
      *
      *
      * 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
 
¥³¥ó¥Ñ¥¤¥ë
PDM¤Ç15¤·¤¿¸å¤ËCRTSRVPGM SRVPGM(FISCALYR) EXPORT(*ALL)

TSTFY.RPGLE

     D pFstDayQtr      PR              D
     D  SomeDte                        D   Value

     D pLstDayQtr      PR              D
     D  SomeDte                        D   Value

     D Msg             S             50
     D DummyVar        S              1
     D InpDate         S               D
     D FstDayOfQtr     S               D
     D LstDayOfQtr     S               D

     C     *Entry        Plist
     C                   Parm                    InpDate

     C                   Eval      FstDayOfQtr = pFstDayQtr( InpDate )
     C                   Eval      LstDayOfQtr = pLstDayQtr( InpDate )

     C                   Eval      Msg =    'Quarter: 1st day='
     C                                    + %Char( FstDayOfQtr )
     C                                    + '. Lst day='
     C                                    + %Char( LstDayOfQtr )
     C                                    + '.'

     C     Msg           Dsply                   DummyVar

     C                   Eval      *INLR = *On
 
¥³¥ó¥Ñ¥¤¥ë
PDM¤Ç15¤·¤¿¸å¤ËCRTPGM PGM(TSTFY) BNDSRVPGM(FISCALYR) ACTGRP(*CALLER)

¤³¤Î¥Ú¡¼¥¸¤Ø¤Î¥³¥á¥ó¥È

odJooK Great, thanks for sharing this blog post.Really thank you! Fantastic.

0
Posted by watch for this 2013ǯ12·î19Æü(ÌÚ) 20:46:51 ÊÖ¿®

IPKoGT <a href="http://lqtqhkrizxic.com/">lqtqhkrizxic</a>, [url=http://cqnetipmccdu.com/]cqnetipmccdu[/url], [link=http://wlqgjyxbsldq.com/]wlqgjyxbsldq[/link], http://laykrdsxitig.com/

0
Posted by jgpuyv 2013ǯ11·î15Æü(¶â) 02:24:10 ÊÖ¿®

¥³¥á¥ó¥È¤ò¤«¤¯


¡Öhttp://¡×¤ò´Þ¤àÅê¹Æ¤Ï¶Ø»ß¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

ÍøÍѵ¬Ìó¤ò¤´³Îǧ¤Î¤¦¤¨¤´µ­Æþ²¼¤µ¤¤

WikiÆ⸡º÷

Menu

¤³¤³¤Ï¼«Í³¤ËÊÔ½¸¤Ç¤­¤ë¥¨¥ê¥¢¤Ç¤¹¡£

¥á¥ó¥Ð¡¼¤Î¤ßÊÔ½¸¤Ç¤­¤Þ¤¹