ibm midrange - How to get the last day of month in a CL -


i need last day of previous month. cl can run on 3rd day of new month. can select statement in cl (we in 7.1)

or if not steps needed code , save date in small table.

here simple example of calculating last day of previous month using cl.

pgm                                                                         dcl        var(&cymd) type(*char) len(7)                                   dcl        var(&jul) type(*char) len(5)                                    dcl        var(&jul#) type(*dec) len(5)                                     rtvjoba    cymddate(&cymd)                                                 chgvar     var(%sst(&cymd 6 2)) value('01')                                cvtdat     date(&cymd) tovar(&jul) fromfmt(*cymd) tofmt(*jul) tosep(*none)                                      chgvar     var(&jul#) value(&jul)                                          chgvar     var(&jul#) value(&jul# - 1)                                     chgvar     var(&jul) value(&jul#)                                          cvtdat     date(&jul) tovar(&cymd) fromfmt(*jul) tofmt(*cymd) tosep(*none)  endpgm 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -