## to find the full month and non full month

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

### to find the full month and non full month

I have two date fileds
WS-BG-DATE YYYYMMDD
WS-END-DATE YYYYMMDD

Between these two range of dates, I need to find whether they have full months or non full months. If it is mix of some full months and non full months, how to get the days left?

Exmaple:
WS-BG-DATE 20140101
WS-END-DATE 20140414

Here full months will be 20140101 to 20140401 and 20140401 to 20140414 are number of days left. How to achieve this in a cobol program?
arjun31

Posts: 2
Joined: Mon Apr 14, 2014 6:20 pm
Has thanked: 0 time
Been thanked: 0 time

### Re: to find the full month and non full month

What if your period starts in the middle of a month - where does the full month end? The middle of the next month? Or what? Whichever, you may have to code the calculation yourself if there is no in-house routine do do what you want.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator

Posts: 2511
Joined: Sun Jul 04, 2010 12:13 am
Location: Down on the pig farm
Has thanked: 4 times
Been thanked: 86 times

### Re: to find the full month and non full month

Hello and welcome to the forum,

Suggest you post several date pairs and show what you want for the result when each pair is processed. You might consider showing the result differently than your example.
Hope this helps,
d.sch.

dick scherrer
Global moderator

Posts: 6308
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 90 times

### Re: to find the full month and non full month

Thanks for replying back. The actual requirement is ' I need to print the claim amounts on daily basis if not full month' .The examples are given below,
1) WS-BG-DATE 20140101 (yyyymmdd)
WS-END-DATE 20140414
Amount \$1000
Output:
20140101 to 20140401 \$873.8
20140401 \$9.7
20140402 \$9.7
.....
20140413 \$9.7

2) WS-BG-DATE 20140115
WS-END-DATE 20140414
Amount \$1000

Here the full month is from 20140201 to 20140401. So the output should be
20140115 \$..
20140116 \$..
....
20140131 \$..

20140201 to 20140401 \$..

20140401 \$..
20140402 \$..
...
20140413 \$..

Note: here i need to split the amount also on daily basis and need to print.

Hope these examples are sufficient. Could someone suggest me how can achieve this in a cobol program.
arjun31

Posts: 2
Joined: Mon Apr 14, 2014 6:20 pm
Has thanked: 0 time
Been thanked: 0 time

### Re: to find the full month and non full month

Could someone suggest me how can achieve this in a cobol program.

You might be overlooking the simple fact that when dealing with MONEY quite often
the CALENDAR dates are not the same as LEDGER/ACCOUNTING dates
what about HOLIDAYS and similar ?

first get a better grasp of the RULES and a better description of the requirement
and...
we do not need to know what You do after grouping the days ranges,
providing unneeded info just makes more difficult to understand the CORE requirement and give advice

where is that You are facing problems, anyway, the logic or the coding ?
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator

Posts: 2493
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 119 times