Home > Archive > Cobol > December 2007 > DATE-OF-INTEGER and DAY-OF-INTEGER
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
DATE-OF-INTEGER and DAY-OF-INTEGER
|
|
| john@wexfordpress.com 2007-11-21, 6:55 pm |
| My most recent COBOL text (Copyright 2000) mentions the functions
DATE-OF-INTEGER, DAY-OF-INTEGER, INTEGER-OF-DAY and
INTEGER-OF-DATE but gives no examples of use.
I want to create a routine that given a yymmdd starting date on a
Thursday, will print every other following Thursday as a yymmdd
date.
1. Is the integer field in the form S9(5) COMP. ?
2. Is the content of that field effectively YYDDD?
3. When using FUNCTION DATE-OF-INTEGER should the yymmdd result field
be DISPLAY? Signed or unsigned?
Sorry to be so stupid but I am an old-timer.
John Culleton
| |
| Howard Brazee 2007-11-21, 6:55 pm |
| On Wed, 21 Nov 2007 08:31:57 -0800 (PST), "john@wexfordpress.com"
<john@wexfordpress.com> wrote:
>My most recent COBOL text (Copyright 2000) mentions the functions
>DATE-OF-INTEGER, DAY-OF-INTEGER, INTEGER-OF-DAY and
>INTEGER-OF-DATE but gives no examples of use.
>
>I want to create a routine that given a yymmdd starting date on a
>Thursday, will print every other following Thursday as a yymmdd
>date.
>
>1. Is the integer field in the form S9(5) COMP. ?
>
>2. Is the content of that field effectively YYDDD?
>
>3. When using FUNCTION DATE-OF-INTEGER should the yymmdd result field
>be DISPLAY? Signed or unsigned?
>
>Sorry to be so stupid but I am an old-timer.
>
>John Culleton
I don't know your platform, but here's an on-line IBM CoBOL manual,
which should work for anybody (although COMP-5 and such are specific
to your compiler):
http://publibz.boulder.ibm.com/cgi-...LR205/CCONTENTS
Page down to 7.0 for intrinsic functions, and 7.1.10 & 7.1.14 for your
functions.
| |
| Doug Miller 2007-11-21, 6:55 pm |
| In article <f0d009cb-12c2-4638-9cba-e2964ec64816@p69g2000hsa.googlegroups.com>, "john@wexfordpress.com" <john@wexfordpress.com> wrote:
>My most recent COBOL text (Copyright 2000) mentions the functions
>DATE-OF-INTEGER, DAY-OF-INTEGER, INTEGER-OF-DAY and
>INTEGER-OF-DATE but gives no examples of use.
Surely it describes the input and return values. Given that, are examples
really necessary?
>
>I want to create a routine that given a yymmdd starting date on a
>Thursday, will print every other following Thursday as a yymmdd
>date.
Do you *really* want to use yymmdd dates?
>
>1. Is the integer field in the form S9(5) COMP. ?
Which of those four functions are you talking about? And do you mean the
parameter, or the return value?
>
>2. Is the content of that field effectively YYDDD?
No. What the content is depends on which of those four functions you're
talking about, and whether you mean the parameter or the return value -- but
in no case is it YYDDD. (You might remember a small problem a few years back
that resulted from using dates in that form. <g> )
>
>3. When using FUNCTION DATE-OF-INTEGER should the yymmdd result field
>be DISPLAY? Signed or unsigned?
DATE-OF-INTEGER returns YYYYMMDD, not YYMMDD. As far as I know, it doesn't
matter whether it's DISPLAY or COMP, signed or unsigned.
--
Regards,
Doug Miller (alphag at milmac dot com)
It's time to throw all their damned tea in the harbor again.
| |
| Robert 2007-11-21, 6:55 pm |
| On Wed, 21 Nov 2007 08:31:57 -0800 (PST), "john@wexfordpress.com" <john@wexfordpress.com>
wrote:
>My most recent COBOL text (Copyright 2000) mentions the functions
>DATE-OF-INTEGER, DAY-OF-INTEGER, INTEGER-OF-DAY and
>INTEGER-OF-DATE but gives no examples of use.
>
>I want to create a routine that given a yymmdd starting date on a
>Thursday, will print every other following Thursday as a yymmdd
>date.
>
>1. Is the integer field in the form S9(5) COMP. ?
The one holding a gregorian date should be s9(8) or bigger. It contains yyyymmdd. The one
holding an absolute date should be s9(5) or bigger. It doesn't matter whether they are
COMP.
>2. Is the content of that field effectively YYDDD?
No.
>3. When using FUNCTION DATE-OF-INTEGER should the yymmdd result field
>be DISPLAY? Signed or unsigned?
Doesn't matter. Signed.
If you divide the absolute date by 7 and get the remainder, 0 = Sunday, 4 =Thursday.
| |
|
|
|
|
|
|
| Rick Smith 2007-11-24, 6:55 pm |
|
<john@wexfordpress.com> wrote in message
news:6cf06ba0-f376-4801-8d1a-5e0838a1ee05@y43g2000hsy.googlegroups.com...
> On Nov 21, 1:46 pm, "Rick Smith" <ricksm...@mfi.net> wrote:
news:f0d009cb-12c2-4638-9cba-e2964ec64816@p69g2000hsa.googlegroups.com...[color=darkred]
>
> Thanks much. It almost works. I use Tiny COBOL and Open COBOL.
> Both blow up on the colon in
> move function current-date (1:8) to today
>
> I presume the (1:8) edits the current date string down to
> ccyymmdd. Correct?
Yes. It is reference modification. Either the versions do not
recognize reference modification or they require spaces
around the colon.
>
> Is there a reason (other than just personal preference) that you
> omit most periods?
No.
>
> Thanks again.
You are welcome.
| |
| Rick Smith 2007-11-24, 6:55 pm |
|
"Rick Smith" <ricksmith@mfi.net> wrote in message
news:13kgjju5gi3orcb@corp.supernews.com...
>
> <john@wexfordpress.com> wrote in message
> news:6cf06ba0-f376-4801-8d1a-5e0838a1ee05@y43g2000hsy.googlegroups.com...
[snip]
>
> Yes. It is reference modification. Either the versions do not
> recognize reference modification or they require spaces
> around the colon.
< http://www.opencobol.org/modules/bw...ex.php?Features >
states that Intrinsic functions are not implemented.
< http://tiny-cobol.sourceforge.net/index.php > mentions the
standards (ISO and ANSI) for Intrinsic functions; but I can
not find a statement that they are implemented.
| |
| Rick Smith 2007-11-24, 6:55 pm |
|
"Rick Smith" <ricksmith@mfi.net> wrote in message
news:13k8va2qf2m5p57@corp.supernews.com...
[snip]
> Here is an example for every Thursday for 10 w s.
> -----
[snip]
> 01 todays-dow pic 9 value 0.
> 01 days-until-thursday binary pic 9(4) value 0.
[snip]
> * calculate the number of days until thursday
> * zero if today is thursday
> accept todays-dow from day-of-w
> evaluate todays-dow
> when 5 thru 7
> subtract todays-dow from 11
> giving days-until-thursday
> when other
> subtract todays-dow from 4
> giving days-until-thursday
> end-evaluate
It took me a while to realize how; but the above evaluate
may be reduced to:
compute days-until-thursday =
function mod ((4 - dow-today) 7)
Whether this is easier to understand is anybody's guess.
I thought I would mention the alternative since this form may
be more useful.
| |
| Vince Coen 2007-11-25, 6:55 pm |
| Mime-Version: 1.0
Content-Type: text/plain; charset=ibm437
Content-Transfer-Encoding: 8bit
X-Newsreader: GoldED+ 1.1.5 (Linux 2.6.17-13mdv i686)
X-FTN-CHRS: UTF-8 2
X-FTN-MSGID: 2:257/609@fidonet 4749e8d6
X-FTN-PID: GED+LNX 1.1.5
REPLY: corp.supernews.com ebdb8655
Sender: "Vince Coen" <VBCoenDespawn@btconnect.com>
X-FTN-AREA: COMP.LANG.COBOL
X-FTN-TID: MBSE-FIDO 0.92.0 (GNU/Linux-i386)
X-FTN-SEEN-BY: 257/0 609
X-FTN-PATH: 257/609
Lines: 20
X-Original-NNTP-Posting-Host: 88.111.0.78
NNTP-Posting-Host: mk-nntp-2.news.uk.tiscali.com
X-Trace: 25 Nov 2007 23:21:16 GMT, mk-nntp-2.news.uk.tiscali.com
Path: border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!feeder.news-service.com!news.astraweb.com!newsrouter-eu.astraweb.com!tiscali!newsfeed2.ip.tiscali.net!212.74.112.120.MISMATCH!mk-nntp-1.news.uk.tiscali.com!mk-nnt
p-2.news.uk.tiscali.com
Bytes: 2097
Xref: number1.nntp.dca.giganews.com comp.lang.cobol:170367
<f0d009cb-12c2-4638-9cba-e2964ec64816@p69g2000hsa.googlegroups.com>
<13k8va2qf2m5p57@corp.supernews.com>
<6cf06ba0-f376-4801-8d1a-5e0838a1ee05@y43g2000hsy.googlegroups.com>
<13kgjju5gi3orcb@corp.supernews.com> <13kgu5plo64ki32@corp.supernews.c
Hello Rick!
24 Nov 07 19:16, Rick Smith wrote to All:
RS> < http://www.opencobol.org/modules/bw...ex.php?Features >
RS> states that Intrinsic functions are not implemented.
That wiki is out of date, they are mostly implemented.
The wiki has been updated.
Vince
| |
|
|
| Rick Smith 2007-11-26, 9:57 pm |
|
"Frank Swarbrick" <Frank.Swarbrick@efirstbank.com> wrote in message
news:474AA69C.6F0F.0085.0@efirstbank.com...
> <13kgu5plo64ki32@corp.supernews.com>,
> Rick Smith<ricksmith@mfi.net> wrote:
>
[snip][color=darkred]
[snip][color=darkred]
> Probably that wiki (which I can't get to at the moment) is out of date.
OC
> supports many Intrinsic Functions, even including a few (like TRIM) that
are
> scheduled for the *next* Cobol standard.
Yes, the wiki was out-of-date and has been updated to
list the Intrinsic functions supported and those to be
added later.
[snip]
> The problem with the original version is that OC doesn't appear to support
> reference modification of an intrinsic function. So I just changed to
move
> the entire 21 characters to a 21 character field, where the first 8 is
> defined as 'today'.
Thank you for the explanation.
| |
| Roger While 2007-12-03, 6:56 pm |
|
"Rick Smith" <ricksmith@mfi.net> schrieb im Newsbeitrag
news:13km7keodu4qcc1@corp.supernews.com...
>
> "Frank Swarbrick" <Frank.Swarbrick@efirstbank.com> wrote in message
> news:474AA69C.6F0F.0085.0@efirstbank.com...
> [snip]
> [snip]
> OC
> are
>
> Yes, the wiki was out-of-date and has been updated to
> list the Intrinsic functions supported and those to be
> added later.
>
> [snip]
>
support[color=darkred]
> move
>
> Thank you for the explanation.
>
>
Yep, WIKI, out of date, and still so :-)
OC does E, PI, WHEN-COMPILED.
Roger
| |
| Vince Coen 2007-12-05, 6:55 pm |
| Hello Roger!
03 Dec 07 17:11, Roger While wrote to All:
[color=darkred]
RW> Yep, WIKI, out of date, and still so :-)
RW> OC does E, PI, WHEN-COMPILED.
Has now been updated.
Vince
|
|
|
|
|