Code Comments
Programming Forum and web based access to our favorite programming groups.How i can get wnumber in Fuitsu COBOL? Many Thanks JM
Post Follow-up to this messageOn Wed, 14 Jun 2006 10:20:34 +0100, "Euromercante" <nospam_eurogest@euromercante.pt> wrote: >How i can get wnumber in Fuitsu COBOL? > >Many Thanks >JM > IDENTIFICATION DIVISION. PROGRAM-ID. program-name. DATA DIVISION. WORKING-STORAGE SECTION. 01 date-1 PIC 9(6). 01 day-1 PIC 9(5). 01 day-of-w
-1 PIC 9(1). 01 time-1 PIC 9(8). PROCEDURE DIVISION. ACCEPT date-1 FROM DATE. ACCEPT day-1 FROM DAY. ACCEPT day-of-w
-1 FROM DAY-OF-WEEK. ACCEPT time-1 FROM TIME. EXIT PROGRAM. END PROGRAM program-name. Frederico Fonseca ema il: frederico_fonseca at syssoft-int.com
Post Follow-up to this messageOn Wed, 14 Jun 2006 12:52:09 +0100, Frederico Fonseca <real-email-in-msg-spam@email.com> wrote: >On Wed, 14 Jun 2006 10:20:34 +0100, "Euromercante" ><nospam_eurogest@euromercante.pt> wrote: > >IDENTIFICATION DIVISION. >PROGRAM-ID. program-name. >DATA DIVISION. >WORKING-STORAGE SECTION. >01 date-1 PIC 9(6). >01 day-1 PIC 9(5). >01 day-of-w-1 PIC 9(1). >01 time-1 PIC 9(8). >PROCEDURE DIVISION. >ACCEPT date-1 FROM DATE. >ACCEPT day-1 FROM DAY. >ACCEPT day-of-w
-1 FROM DAY-OF-WEEK. >ACCEPT time-1 FROM TIME. >EXIT PROGRAM. >END PROGRAM program-name. OOPSS!! Read the question wrong way. What day of the w
are you after? there are several possibilities. First of all look at the following link http://www.ecben.net/calendar.shtml Load of useful information regarding calendars. Regarding getting the w
number of a given date it will depends on which "w
" you are after. do read [url]http://www.panix.com/~wlinden/w
s.cgi[/url] very well, with the ISO version being at http://www.cl.cam.ac.uk/~mgk25/iso-time.html The following will give you a simple w
version if the abstract above does not interest you. INT((JulianDay - 1) / 7) + 1 Note that this will not be the w
you see on normal calendars except in some years where days happen to coincide. Frederico Fonseca ema il: frederico_fonseca at syssoft-int.com Frederico Fonseca ema il: frederico_fonseca at syssoft-int.com
Post Follow-up to this messageOn Wed, 14 Jun 2006 10:20:34 +0100, "Euromercante" <nospam_eurogest@euromercante.pt> wrote: >How i can get wnumber in Fuitsu COBOL? > >Many Thanks >JM > Further to my post search google for a thread i CLC "help, calculate the number of the w
in a year" where someone was asking for the same question with RM/COBOL. Same answers applies here. Frederico Fonseca ema il: frederico_fonseca at syssoft-int.com
Post Follow-up to this messageThanks Frederico. How can get JulianDay? (1 to 366, correct?) "Frederico Fonseca" <real-email-in-msg-spam@email.com> wrote in message news:r4uv82tq39jd5mn552t6te0i2s4k563s88@ 4ax.com... > On Wed, 14 Jun 2006 12:52:09 +0100, Frederico Fonseca > <real-email-in-msg-spam@email.com> wrote: > > OOPSS!! > > Read the question wrong way. > > What day of the ware you after? there are several possibilities. > > First of all look at the following link > > http://www.ecben.net/calendar.shtml > > Load of useful information regarding calendars. > > Regarding getting the w
number of a given date it will depends on > which "w
" you are after. > > do read [url]http://www.panix.com/~wlinden/w
s.cgi[/url] very well, with the > ISO version being at http://www.cl.cam.ac.uk/~mgk25/iso-time.html > > The following will give you a simple w
version if the abstract > above does not interest you. > INT((JulianDay - 1) / 7) + 1 > > Note that this will not be the w
you see on normal calendars except > in some years where days happen to coincide. > > > > Frederico Fonseca > ema il: frederico_fonseca at syssoft-int.com > > > Frederico Fonseca > ema il: frederico_fonseca at syssoft-int.com
Post Follow-up to this message"Euromercante" <nospam_eurogest@euromercante.pt> wrote in message news:newscache$9awu0j$no3$1@newsfront4.netvisao.pt... > Thanks Frederico. > > How can get JulianDay? (1 to 366, correct?) You could hardcode a list of offsets based on the month (e.g. January = 0, February = 31, etc. with careful consideration for leap years), and add the offset plus the date. So February 20th would be February's offset (31) plus 20 = 51. - Oliver
Post Follow-up to this messageit is not easy !!? "Oliver Wong" <owong@castortech.com> wrote in message news:o9Wjg.40496$771.4752@edtnps89... > > "Oliver Wong" <owong@castortech.com> wrote in message > news:g7Wjg.40471$771.335@edtnps89... = add > > Note that this actually gives you the day of the year (a value between 1 > and 366), not the JulianDay, which is the number of days that have elapsed > since Monday, January 4713 BC in the proleptic Julian Calendar (a value from > potentially negative infinity to positive infinity). > > - Oliver >
Post Follow-up to this messageOn Wed, 14 Jun 2006 16:34:44 +0100, "Euromercante" <nospam_eurogest@euromercante.pt> wrote: >Thanks Frederico. > >How can get JulianDay? (1 to 366, correct?) > > From the example I posted you will notice a "Accept day-1 from DAY. This returns a value made up of YYDDD where DDD is the number of days since January 1st. If you wish to get the Julian day of a particular date then the following would be an acceptable solution. 01 WORK-DATE. 02 W-CCYY PIC 9(4). 02 W-MONTH PIC 9(2). 02 W-DAY PIC 9(2). 01 WORK-DATE-PRV-YEAR. 02 W-CCYY-1 PIC 9(4). 02 W-MONTH-1 PIC 9(2). 02 W-DAY-1 PIC 9(2). 01 WORK-SERIAL PIC S9(9) BINARY. 01 START-YEAR PIC S9(8). 01 WORK-NUM PIC 9(8). 01 DAYS PIC 9(3) USAGE DISPLAY. PROCEDURE DIVISION. SUBTRACT 1 FROM W-CCYY GIVING W-CCYY-1 MOVE 12 TO W-MONTH-1. MOVE 31 TO W-DAY-1. MOVE WORK-DATE TO WORK-NUM. COMPUTE WORK-SERIAL = FUNCTION INTEGER-OF-DATE(WORK-NUM). MOVE WORK-DATE-PRV-YEAR TO WORK-NUM. COMPUTE START-YEAR = FUNCTION INTEGER-OF-DATE(WORK-NUM). COMPUTE DAYS = WORK-SERIAL - START-YEAR. DISPLAY "julian day for date " WORK-DATE " is " DAYS " or " W-CCYY DAYS Frederico Fonseca ema il: frederico_fonseca at syssoft-int.com
Post Follow-up to this messageEuromercante wrote: > it is not easy !!? I wouldn't call it hard :-) - but can get a little complicated. Familiarize yourself with the Date Functions in the Fujitsu on-line help file and give a good read to the ISO Date Standard that Frederico referenced, (which is Gregorian based). Store ALL dates as ccyy-mm-dd because you then have an automatic sort key. (I'm not into accounting so as per ISO, I store ccyy-mm ). Given that you wanted to calculate interest, say at 2.5% per day for the period 2005-03-27 to 2006-June-11 inclusive - this is achievable by using a combination of Date Functions. What is your particular interest in the WNumber ? If it is associated with financial systems use the tried and true manual methods. Back when I was in accounting, depending upon the company, some used :- - a 13 Period year consisting of 4 w
s (28 days). But 13 x 28 doesn't give you 365, so they tacked on the additional one day to Period 13. - another choice was 4,4,5 (4 w
s, 4 w
s, 5 w
s = a Quarter); odd days get tacked on to the fourth Quarter. - not used often, but a cumulative w
count based on the day name when 2006 Jan 01 started. The above can give you 52 or 53 w
years; so tack on any remaining days to W
53 - or perhaps the accountants want them tacked on to W
52. So some senior bean-counter would spend perhaps half an hour determining the 'official' w
or period ends which became the company's calendar for the coming year. Whichever method above, if that's what you are after :- Use a small computer file holding the official corporate calendar table for the option you are interested in :- - Period # and calendar ending date - Number of w
s ( 4 or 5), Quarter # and the calendar ending date - W
# and calendar ending date You don't have much choice - the accountants will tell you what they want - and it wont necessarily fit in with clean computer logic ! Jimmy
Post Follow-up to this messageEuromercante wrote: > Thanks Frederico. > > How can get JulianDay? (1 to 366, correct?) > The "Julian Day" is the number of days that have elapsed since Monday, January 1st, 4713 BC. Today is almost JD 2,500,000. Of course, since they didn't have COBOL back then, that Monday is the zeroth day.
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.