From: Fred Mobach on
James J. Gavan wrote:

> Fred Mobach wrote:
>>>>Most questions I had regarding dates has been answered by
>>>> Mapping Time, the Calendar and its History
>>>> E.G. Richards,
>>>> Oxford University Press 1998
>>>
>> BTW, in de book mentioned above see Appendix II, the names of the
>> days of the weeks in 69 languages (long form).
>>
>> Months names in Dutch (long form) see
>> http://nl.wikipedia.org/wiki/Maand#Maanden_in_het_westerse_jaar
>> The short form consist of the first three letters except maart (mrt).
>>
>> Names of the days in Dutch (long form) see
>> http://nl.wikipedia.org/wiki/Week#Weekdagen
>> The short form consist of the first two letters, So zondag -> zo.
>
> Well first off, where do I get a copy of that book above, and if I did
> (buy it), really I'm not interested in becoming a date expert - all
> I'm interested in is what will be used in a computer context,
> invoices, etc.

If all you want are names of days and months you don't have the need to
buy it.

> Now to the germane. I already have DatesEnglish, (surprise, surprise
> !), DatesFrancais (needs confirmation), DatesPortuguese (confirmed by
> Frederico Fonseca). Now if you would be so kind as to edit the
> following and make it 'DatesDutch' or 'DatesNederlands' or whatever, I
> would greatly appreciate it. All my code starts in Column 8, with the
> exception of the dollar-sign for $set, which starts in Column 7.

No problem, just some questions. Most of them because I don't understand
portuguese.

> *>-----------------DatesPortuguese-------------------------------

> 78 DL value 15. *> DL = Dayname Long

In Dutch the longest name of a day is 9 byte. Which value should be
assigned to this variable ?

> *> DAYS-OF-WEEK - "LONG" Dayname
> 01 ws-DayTable-1.
> 05 pic x(DL) value "segunda~". *> # 1
> 05 pic x(DL) value "ter�a~". *> # 2
> 05 pic x(DL) value "quarta~". *> # 3
> 05 pic x(DL) value "quinta~". *> # 4
> 05 pic x(DL) value "sexta~". *> # 5
> 05 pic x(DL) value "s�bado~". *> # 6
> 05 pic x(DL) value "domingo~". *> # 7

Which day is supposed to be the first day of the week ? Some say sunday,
others think monday.

> *> DAYS-OF-WEEK - "LONGER" Dayname
>
> 01 ws-DayTable-5.
> 05 pic x(DL) value "Segunda-feira~". *> # 1
> 05 pic x(DL) value "Ter�a-feira~". *> # 2
> 05 pic x(DL) value "Quarta-feira~". *> # 3
> 05 pic x(DL) value "Quinta-feira~". *> # 4
> 05 pic x(DL) value "Sexta~". *> # 5
> 05 pic x(DL) value "S�bado~". *> # 6
> 05 pic x(DL) value "Domingo~". *> # 7
>
> 01 ws-DayTable-6
> redefines ws-DayTable-5.
> 05 ws-LONGERDayName occurs 7 pic x(DL).

In case of Dutch names where there no difference between long and longer
names, will a redefines do ?

> Now I'm just hoping, by puttng the above here, I might get some
> response from developers from other nationalities (their language
> short and long names), for use with COBOL.
>
>
> ------------------------------------------------------------------------
> OBJECT ORIENTATION 101
> ----------------------

Thanks for that 101 lesson, when I left COBOL more than 10 years ago
(because of the lack of use on Siemens mainframes) OO wasn't is much
use. ;-)
--
Fred Mobach - fred(a)mobach.nl
website : https://fred.mobach.nl
.... In God we trust ....
.. The rest we monitor ..
From: James J. Gavan on
Fred Mobach wrote:
>>Now to the germane. I already have DatesEnglish, (surprise, surprise
>>!), DatesFrancais (needs confirmation), DatesPortuguese (confirmed by
>>Frederico Fonseca). Now if you would be so kind as to edit the
>>following and make it 'DatesDutch' or 'DatesNederlands' or whatever, I
>>would greatly appreciate it. All my code starts in Column 8, with the
>>exception of the dollar-sign for $set, which starts in Column 7.
>
For starters, I wish folks would chuck out all the previous stuff, that
is not relevant to current responses :-) Not just you Fred, checking
'inter-active' threads between Pete and Richard - it goes on like a new
edition of the Bible. (Be more effective if they phoned one another -
I'm sure they have a reasonable Phone utility DOWN there :-) )

>
> No problem, just some questions. Most of them because I don't understand
> portuguese.
>
>
>> *>-----------------DatesPortuguese-------------------------------
>
>
>> 78 DL value 15. *> DL = Dayname Long
>
>
> In Dutch the longest name of a day is 9 byte. Which value should be
> assigned to this variable ?
>
BTW I didn't want to get into the nitty-gritty at this stage - just get
some names :-).

Note the Level 78 DL Value 15 above. My guess it will cover all names.
If not then the value for DL could be increased from 15 to 20, before
compiling; same principle applies to the other uses of Level 78s.

In English "Wednesday" is the longest, so in the English version, which
I could have attached originally :-

*> DAYS-OF-WEEK
01 ws-DayTable-1.
05 pic x(DL) value "Monday~". *> # 1
05 pic x(DL) value "Tuesday~". *> # 2
05 pic x(DL) value "Wednesday~". *> # 3
05 pic x(DL) value "Thursday~". *> # 4
05 pic x(DL) value "Friday~". *> # 5
05 pic x(DL) value "Saturday~". *> # 6
05 pic x(DL) value "Sunday~". *> # 7

Allows for a literal size of pic x(DL = 15), but I'm only interested in
the characters prior to and including the tilde (~):-

*>--------------------------------------------------------------
Method-id. "formatEU". *> PRIVATE - don't invoke
*>--------------------------------------------------------------
Linkage section.
01 lnk-DateObject object reference.

Procedure Division returning lnk-DateObject.

*> EU Format : DayName, Day, Month/MonthName, Year, Time

initialize Date-Holder

string Out-DayName delimited by ws-Tilde
Out-DayNumeric delimited by ws-Tilde
Out-Separator-1 delimited by ws-Tilde
Out-MonthName delimited by ws-Tilde
OUT-MonthNumeric delimited by ws-Tilde
Out-Separator-2 delimited by ws-Tilde
Out-Year delimited by ws-Tilde
Out-Time delimited by ws-Tilde
x"00" delimited by size
into Date-Holder
ON OVERFLOW
set Error-StringingDate to true
EXIT METHOD
End-string

perform varying n from 1 by 1 until n > DH-Size

if Date-Holder (n:1) = x"00"
subtract 1 from n
invoke CharacterArray "withLengthValue"
using n, Date-Holder(1:n)
returning lnk-DateObject
EXIT METHOD
End-if
End-perform

Exit Method
End Method "formatEU".
*>--------------------------------------------------------------

> Which day is supposed to be the first day of the week ? Some say sunday,
> others think monday.

However, I think most say 1 = Monday and the ACCEPT FROM DAY definitely
gives you Monday = 1. This method from DateAndTime should clarify :-

*>---------------------------------------------------------------
Method-id. "CalculateDayCode". *> PRIVATE - don't Invoke
*>---------------------------------------------------------------

if UseCurrentDate
move function CURRENT-DATE to Date21
Accept DayCode from DAY-OF-WEEK

else Compute DayCode = Function
REM
(function INTEGER-OF-DATE (Date21-Year-Month-Day-N), 7)

if DayCode = zero *> Monday = 1, Sunday = 0 = (7)
move 7 to DayCode
End-if
End-if

EXIT METHOD.
End Method "CalculateDayCode".
*>---------------------------------------------------------------

So above makes sure INTEGER-OF-DATE function gives the same result as
DAY-OF-WEEK
>
> In case of Dutch names where there no difference between long and longer
> names, will a redefines do ?
>
Fine, just look at my notes more closely. It's a pure guess, but I think
this Longer DayName feature is non-Teutonic, but perhaps some other
Latin languages than Portuguese might use it - Spanish perhaps ?

Note that I say make changes to the source before you compile, and in
your case totally ignore LONGERDaynames as per this comment in the source :-

*> ws-DayTable-5 and ws-DayTable-6 are only required when you
*> have a similar situation to Portuguese in other languages.

You can certainly code the input parameter, (accidentally) to say you
want LONGERDayName. I think if you look at the code, plus suggested
adjustments before compiling, I covered that possibility - you will get
back ONLY LongDayName and not LONGERDayname - the alternative, the
program would go belly-up !

Hopefully, that clarifies your points.

Jimmy, Calgary AB
From: Pete Dashwood on
James J. Gavan wrote:
> Fred Mobach wrote:
>>> Now to the germane. I already have DatesEnglish, (surprise, surprise
>>> !), DatesFrancais (needs confirmation), DatesPortuguese (confirmed
>>> by Frederico Fonseca). Now if you would be so kind as to edit the
>>> following and make it 'DatesDutch' or 'DatesNederlands' or
>>> whatever, I would greatly appreciate it. All my code starts in
>>> Column 8, with the exception of the dollar-sign for $set, which
>>> starts in Column 7.
>>
> For starters, I wish folks would chuck out all the previous stuff,
> that is not relevant to current responses :-) Not just you Fred, checking
> 'inter-active' threads between Pete and Richard - it goes on like a
> new edition of the Bible. (Be more effective if they phoned one
> another - I'm sure they have a reasonable Phone utility DOWN there :-) )

Don't pick on Richard and myself; we are far from the worst offenders, and
the thread you are referring to is weeks old.

If it bothers you, why not adjust your newsreader to show only unread posts,
and mark long topics you are not interested in as "all read" (That's Ctrl/T
for Outlook users.)

Control is in your own hands.

Pete.
--
"I used to write COBOL...now I can do anything."


From: James J. Gavan on
Pete Dashwood wrote:
> "Pete Dashwood" <dashwood(a)removethis.enternet.co.nz> wrote in message
> news:7tfh0dFbjlU1(a)mid.individual.net...
>>
>>Anyway....getting back to inheritance and SUPER...the thing that trumps
>>all supposition is empirical data.
>>
>>Why not just try it and see? :-)

I couldn't agree more. I thought of that after I posed and sent the
question :-) I've already got a simple test with Classes A, B, C and D
in the inheritance chain. Wont require much to make it try my supposition.

I've got to absorb your example above, so I mustn't this time lose your
reference.

Here's a trick I tried for the first time using M/F support classes when
testing, and am still testing, for DateAndTime; the different spoken
language elements are just add ons. What I'm illustrating here is that I
want the invoke result to spit out for display which features in the
input parameters are being used :-

*>---------------- Test-Dates-1.cbl ---------------------------

$set OUTDD "List-DateTests.txt 80"

*> The above Directive instructs the program to direct screen
*> output to the file Test-Dates-1.txt, record size = 80.
*> If you put a comment character (*) in column 1 of the
*> Directive line, tests will be displayed on the Screen

Program-id. Test-Dates-1.

Class-Control.

*> M/F Support Classes :
CharacterArray is class "chararry"

*> Your Classes :
DatesEnglish is class "datesenglish"
DatesFrancais is class "datesfrancais"
DatesPortuguese is class "datesportuguese"
.
- - - - -
*>--------------------------------------------------------------
*> CREATING INSTANCES OF THE SUB-CLASSES AND THEN USING
*> os-CurrentClass
*>--------------------------------------------------------------
*> We are going to create instances of the sub-classes
*> DatesEnglish, DatesFrancasis and DatesPortuguese which will
*> use methods inherited from DateAndTime.cbl. (See the first
*> three invokes below)

*> If you need to switch between different spoken languages,
*> having created Instances for appropriate languages, you can
*> set your current default as follows :-

*> set os-CurrentClass to os-DatesEnglish, OR
*> set os-CurrentClass to os-DatesPortuguese
*>
*> Then you can invoke os-CurrentClass as required. the
*> os-CurrentClass this feature for 'perform SEND-AND-RECEIVE'
*> -------------------------------------------------------------

invoke DatesEnglish "new" returning os-DatesEnglish
invoke DatesFrancais "new" returning os-DatesFrancais
invoke DatesPortuguese "new" returning os-DatesPortuguese
set os-CurrentClass to os-DatesEnglish
move length of DateParameters to ws-Length

*>--------------------------------------------------------------
*> GROUP 2 - METHODS THAT DO REQUIRE PARAMETERS
*>---------------------------------------------------------------
move "AnyDayName" to T-Methodname
set os-CurrentClass to os-DatesEnglish
initialize DateParameters
set UseCurrentDate to true
set ShortDayName to true
perform SEND-AND-RECEIVE

set os-CurrentClass to os-DatesFrancais
set LongDayName to true
perform SEND-AND-RECEIVE

set os-CurrentClass to os-DatesPortuguese
set LONGERDayName to true
perform SEND-AND-RECEIVE
- - - - - - - - - -
*>--------------------------------------------------------------
SEND-AND-RECEIVE.

perform SEND-LANGUAGE

move InputFormat to T-P1
move DayFormat to T-P2
move MonthFormat to T-P3
move OutputFormat to T-P4
move SeparatorFormat to T-P5
move TimeFormat to T-P6
move YearFormat to T-P7

what I'm illustrating above is the perform SEND-LANGUAGE
- - - - - - - - - - - - -
SEND-LANGUAGE.

*> This is an interesting one which demonstrates the flexibilty
*> of using OO. So that you can see what I have done, I want the
*> spoken language to appear in my screen display.
*>
*> I could have coded as follows, up above where I am setting the
*> input parameters :-
*>
*>01 Language.
*> 05 pic x(LL) value "English".
*> 05 pic x(LL) value "Francais".
*> 05 pic x(LL) value "Portuguese".
*>
*>01 filler redefines Language
*> 05 SpokenLanguage pic x(LL) occurs 3
*>
*>01 LanguageChoice pic x(4) comp-5.
*>
*> set osCurrentClass to os-DatesPortuguese
*> move 3 to LanguageChoice
*> move SpokenLanguage (LanguageChoice) to T-Language
*>
*> Instead of the above I'll be doing the following, which
*> granted is overkill, but serves the purpose of this demo

perform varying n from 1 by 1 until n > 4

Evaluate true
when n = 1
set os-TempObject to os-DatesEnglish
when n = 2
set os-TempObject to os-DatesFrancais
when n = 3
set os-TempObject to os-DatesPortuguese
when n = 4
move "Don't Know" to T-Language
EXIT PERFORM
End-Evaluate

invoke os-CurrentClass "equal" using os-TempObject
returning ls-Bool

if isTrue
move SpokenLanguage(n) to T-Language
EXIT PERFORM
end-if
end-Perform

*> Which Class holds the method "equal" ? There are some 6 methods
*> for doing this. ALL classes eventually inherit from the
*> Root Class = "Base"; therefore sub-classes have the
*> ability to inherit from 'super' right through the hierarchical
*> chain. In this test I only have one class specified in this
*> source - 'CharacterArray', and it is that class which is
*> invoking 'super', passing through other sub-classes, as
*> appropriate, until it gets to the class Base which contains the
*> "equal" method. If Base doesn't contain the method "equals"
*> (I've accidentally typed the 's' in the methodname), then I
*> will get a runtime error 'class base doesn't understand
*> method 'equals'.

Additional to above, using the Animator I can EXAMINE the contents of an
object and I will see "DatesEnglish" for example - but that's only
because I'm using the Animator. I could use the class CharacterArray to
'unwrap' the object's name and then test using the literals.

Jimmy, Calgary AB
From: Fred Mobach on
James J. Gavan wrote:

> BTW I didn't want to get into the nitty-gritty at this stage - just
> get some names :-).
<< big snip>>
>
> Hopefully, that clarifies your points.

It does, and here below are the names in Dutch.

*> Information for tables confirmed by Fred Mobach (fred(a)mobach.nl)

*> DAYS-OF-WEEK - "LONG" Dayname
01 ws-DayTable-1.
05 pic x(DL) value "maandag~". *> # 1
05 pic x(DL) value "dinsdag~". *> # 2
05 pic x(DL) value "woensdag~". *> # 3
05 pic x(DL) value "donderdag~". *> # 4
05 pic x(DL) value "vrijdag~". *> # 5
05 pic x(DL) value "zaterdag~". *> # 6
05 pic x(DL) value "zondag~". *> # 7

01 ws-DayTable-2
redefines ws-DayTable-1.
05 ws-LongDayName occurs 7 pic x(DL).

78 DS value 10. *> DS = DayName Short

*> DAYS-OF-WEEK - SHORT DAYNAME
01 ws-DayTable-3.
05 pic x(DS) value "ma.~". *> # 1
05 pic x(DS) value "di.~". *> # 2
05 pic x(DS) value "wo.~". *> # 3
05 pic x(DS) value "do.~". *> # 4
05 pic x(DS) value "vr.~". *> # 5
05 pic x(DS) value "za.~". *> # 6
05 pic x(DS) value "zo.~". *> # 7

01 ws-DayTable-4
redefines ws-DayTable-3.
05 ws-ShortDayName occurs 7 pic x(DS).


78 ML value 15. *> ML = MonthName Long
01 ws-MonthTable-1.
05 pic x(ML) value "januari~".
05 pic x(ML) value "februari~".
05 pic x(ML) value "maart~".
05 pic x(ML) value "april~".
05 pic x(ML) value "mei~".
05 pic x(ML) value "juni~".
05 pic x(ML) value "juli~".
05 pic x(ML) value "augustus~".
05 pic x(ML) value "september~".
05 pic x(ML) value "oktober~".
05 pic x(ML) value "november~".
05 pic x(ML) value "december~".

01 ws-MonthTable-2
redefines ws-MonthTable-1.
05 ws-LongMonthName occurs 12 pic x(ML).

78 MS value 10. *> MS = Monthname Short
01 ws-monthTable-3.
05 pic x(MS) value "jan.~".
05 pic x(MS) value "feb.~".
05 pic x(MS) value "mrt.~".
05 pic x(MS) value "apr.~".
05 pic x(MS) value "mei.~".
05 pic x(MS) value "jun.~".
05 pic x(MS) value "jul.~".
05 pic x(MS) value "aug.~".
05 pic x(MS) value "sep.~".
05 pic x(MS) value "okt.~".
05 pic x(MS) value "nov.~".
05 pic x(MS) value "dec.~".

01 ws-MonthTable-4
redefines Ws-MonthTable-3.
05 ws-ShortMonthName occurs 12 pic x(MS).

*> ******** IMPORTANT **************

*> When first creating the source for this class the Longer
*> DayName Flag is set to a default of zero. For countries such
*> as Portugal and Brazil, where LONGER Daynames are used, amend
*> the line below to read "comp-5 value 1." Comment/De-comment
*> the lines in "GetLONGERDayName". Then compile.

01 LongerDayNameFlag pic x(4) comp-5 value 0. *> <-------
88 NoLongerDayName value 0.
88 LongerDayAvailable value 1.
--
Fred Mobach - fred(a)mobach.nl
website : https://fred.mobach.nl
.... In God we trust ....
.. The rest we monitor ..
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4
Prev: Traditional COBOL environment
Next: More Debugging Issues