ACCEPT FROM DATE 
Author Message
 ACCEPT FROM DATE

Does anybody know if it is possible to get a 4-digit year with accept
from date?
It tried a little bit but always receive 0098 instead of 1998.
I use Micro Focus Cobol 3.4 and 4.0.

Frank Pohlmann



Wed, 26 Jul 2000 03:00:00 GMT  
 ACCEPT FROM DATE

Quote:

> Does anybody know if it is possible to get a 4-digit year with accept
> from date?
> It tried a little bit but always receive 0098 instead of 1998.
> I use Micro Focus Cobol 3.4 and 4.0.

What you are looking for is FUNCTION CURRENT-DATE, added with the
1989 update to the COBOL-85 standard.  It returns a 21 character
alphanumeric value like this:

01  HOLD-CURRENT-DATE.
    03  HCD-YEAR            PIC  9999.  GREGORIAN YEAR
    03  HCD-MONTH           PIC  99.    01-12
    03  HCD-DAY             PIC  99.    01-31
    03  HCD-HOUR            PIC  99.    00-23
    03  HCD-MINUTE          PIC  99.    00-59
    03  HCD-SECOND          PIC  99V99. 00.00-59.99
    03  HCD-GREENWICH-DIFF  PIC  X.     0,+,-
                        '0' = GREENWICH TIME (ZERO)
                        '+' = AHEAD OF GREENWICH (SEE DIFF BELOW)
                        '-' = BEHIND GREENWICH   (SEE DIFF BELOW)
    03  HCD-DIFF-HOURS      PIC  99.    00-12
    03  HCD-DIFF-MINUTES    PIC  99.    00-59

    MOVE FUNCTION CURRENT-DATE TO HOLD-CURRENT-DATE.
--
Judson McClendon          This is a faithful saying and worthy of all
Sun Valley Systems        acceptance, that Christ Jesus came into the

(please remove zzz from email id to respond)



Wed, 26 Jul 2000 03:00:00 GMT  
 ACCEPT FROM DATE

On Sat, 07 Feb 1998 18:10:37 +0100, Frank Pohlmann

Quote:

>Does anybody know if it is possible to get a 4-digit year with accept
>from date?
>It tried a little bit but always receive 0098 instead of 1998.
>I use Micro Focus Cobol 3.4 and 4.0.

01  The-date PIC 9(8.

ACCEPT The-date from date yyyymmdd

Works in MF COBOL



Wed, 26 Jul 2000 03:00:00 GMT  
 ACCEPT FROM DATE

No. The only COBOL version that is Y2K enhanced is COBOL-MVS (A/K/A
COBOL-370). The only way to obtain the century using a Non-Y2K version of
COBOL is to call an ASSEMBLER Sub-Program, which would issue an SVC 11. The
format of the date returned from the SVC 11 is P'0CYYDDD', but is in a
register. The first byte will equal either X'00' (20th century) or X'01'
(21st Century). All you need to do is move it from the register to a PL4
workarea and add P'1900000'. You'll always arrive at the correct century.
If this is not possible, then you need to setup a sliding-scale and build
the century from that scale. EX:

        Assume R1 contains the date as X'0098038F'. Move it to a workarea and
adjust.

JULDATE DS      PL4

        STCM    R1,B'1111',JULDATE
        AP      JULDATE,=P'1900000'

HTH,

WOB



Quote:
> Does anybody know if it is possible to get a 4-digit year with accept
> from date?
> It tried a little bit but always receive 0098 instead of 1998.
> I use Micro Focus Cobol 3.4 and 4.0.

> Frank Pohlmann



Wed, 26 Jul 2000 03:00:00 GMT  
 ACCEPT FROM DATE



Quote:
>On Sat, 07 Feb 1998 18:10:37 +0100, Frank Pohlmann

>>Does anybody know if it is possible to get a 4-digit year with accept
>>from date?
>>It tried a little bit but always receive 0098 instead of 1998.
>>I use Micro Focus Cobol 3.4 and 4.0.

>01  The-date PIC 9(8.

>ACCEPT The-date from date yyyymmdd

>Works in MF COBOL

IBM is also implementing this syntax for their COBOL/MVS and COBOL/390
products. Is available today as an APAR.  Also available are some new
intrinsic functions that do actual date-windowing.... nice stuff :-)
david


____________________________________



Thu, 27 Jul 2000 03:00:00 GMT  
 ACCEPT FROM DATE


: >
: >01  The-date PIC 9(8.
: >
: >ACCEPT The-date from date yyyymmdd
: >
: >Works in MF COBOL
: >
: IBM is also implementing this syntax for their COBOL/MVS and COBOL/390
: products. Is available today as an APAR.  Also available are some new
: intrinsic functions that do actual date-windowing.... nice stuff :-)

Did MF and IBM implement these extensions the way they are
described in the draft for the new COBOL standard?

Walter Murray



Thu, 27 Jul 2000 03:00:00 GMT  
 ACCEPT FROM DATE

Quote:

>What you are looking for is FUNCTION CURRENT-DATE, added with the
>1989 update to the COBOL-85 standard.  It returns a 21 character
>alphanumeric value like this:

Note that using COBOL for MVS it was necessary to code the statement
thusly if only the 8 digit date was desired, otherwise a compile
diagnostic was generated indicating unequal field lengths:

05  todays-date pic x(8).

move function current-date (1:8) to todays-date.



Fri, 28 Jul 2000 03:00:00 GMT  
 ACCEPT FROM DATE

Quote:




>: >
>: >01  The-date PIC 9(8.
>: >
>: >ACCEPT The-date from date yyyymmdd
>: >
>: >Works in MF COBOL
>: >
>: IBM is also implementing this syntax for their COBOL/MVS and COBOL/390
>: products. Is available today as an APAR.  Also available are some new
>: intrinsic functions that do actual date-windowing.... nice stuff :-)

>Did MF and IBM implement these extensions the way they are
>described in the draft for the new COBOL standard?

>Walter Murray

Yes, both the IBM and the Micro Focus implementation match the current
(always possible to change) draft of the next COBOL Standard.  IBM (but not
Micro focus) have a slight bug in the way that they have implemented the new
windowing intrinsic functions.  The Standard says that you should do NO
date-validation on the input - which IBM does a little (but not complete)
validation.  With IBM's current implementation, you get an error if you use
991345 as a YYMMDD input, but do NOT get an error with 981345 (because it is
between 1 and 991231).  The Standard says that both should be allowed (and
they have provided another function to test if a date is valid.  So far. I
don't think IBM or Micro Focus have implemented those functions yet.)

Note: The Micro Focus implementation is documented in NetExpress but not the
"normal" Workbench Product.  It was provided during the life of WB 4.0 -
check your Release Notes to make certain that it is included in your support
level.



Fri, 28 Jul 2000 03:00:00 GMT  
 ACCEPT FROM DATE

The following reply is not correct.  Micro Focus (for which the original
question was raised) provided support for the new format of the ACCEPT
statement well before IBM did.  As I state in another note, check your Micro
Focus release notes for exact details and availability).

Quote:

>No. The only COBOL version that is Y2K enhanced is COBOL-MVS (A/K/A
>COBOL-370). The only way to obtain the century using a Non-Y2K version of
>COBOL is to call an ASSEMBLER Sub-Program, which would issue an SVC 11. The
>format of the date returned from the SVC 11 is P'0CYYDDD', but is in a
>register. The first byte will equal either X'00' (20th century) or X'01'
>(21st Century). All you need to do is move it from the register to a PL4
>workarea and add P'1900000'. You'll always arrive at the correct century.
>If this is not possible, then you need to setup a sliding-scale and build
>the century from that scale. EX:

> Assume R1 contains the date as X'0098038F'. Move it to a workarea and
>adjust.

>JULDATE DS PL4

> STCM R1,B'1111',JULDATE
> AP JULDATE,=P'1900000'

>HTH,

>WOB



>> Does anybody know if it is possible to get a 4-digit year with accept
>> from date?
>> It tried a little bit but always receive 0098 instead of 1998.
>> I use Micro Focus Cobol 3.4 and 4.0.

>> Frank Pohlmann



Fri, 28 Jul 2000 03:00:00 GMT  
 ACCEPT FROM DATE

Use the intrinsic function CURRENT-DATE, it will return a full, synchronized
date/time/timzone value.

ACCEPT FROM DATE is defined by the standard as providing 2 digit year value,
any deviation would be non-standard.

Rex Widmer
Builder of software archeology tools and other strange programs to help survive
in a legacy based world.



Fri, 28 Jul 2000 03:00:00 GMT  
 ACCEPT FROM DATE

Rex Widmer writes ...

Quote:
>Use the intrinsic function CURRENT-DATE, it will return a full, synchronized
>date/time/timzone value.

>ACCEPT FROM DATE is defined by the standard as providing 2 digit year value,
>any deviation would be non-standard.

Rex,

I just got my programmer's guide for COBOL for OS/390 & VM, and there is indeed
a new variation on ACCEPT supported in this compiler; they have added this
feature from the draft version of the new standard to support Y2K work now,
since the new standard won't be available in time.

Works this way:

ACCEPT variable-name-1 FROM DATE YYYYMMDD

and

ACCEPT variable-name-2 FROM DAY YYYYDDD

where variable-name-1 is a data item with 8 digits and variable-name-2 has 7
digits.

They also added three new intrinsic functions, from the same source for the
same reason:

DATE-TO-YYYYMMDD
DAY-TO-YYYYDDD
YEAR-TO-YYYY

each of these functions has an optional second argument for specifying the size
of the century window for this invocation. If you omit this argument, I suspect
you get the century window currently in effect for the enclave.

Well, gotta' run put this stuff into my courses!

Regards,

Steve Comstock
Telephone: 303-393-8716

256-B S. Monaco Parkway
Denver, CO 80224
USA



Fri, 28 Jul 2000 03:00:00 GMT  
 ACCEPT FROM DATE


Quote:
>Rex Widmer writes ...

>>Use the intrinsic function CURRENT-DATE, it will return a full,
synchronized
>>date/time/timzone value.

>>ACCEPT FROM DATE is defined by the standard as providing 2 digit year
value,
>>any deviation would be non-standard.

>Rex,

>I just got my programmer's guide for COBOL for OS/390 & VM, and there is
indeed
>a new variation on ACCEPT supported in this compiler; they have added this
>feature from the draft version of the new standard to support Y2K work now,
>since the new standard won't be available in time.

>Works this way:

>ACCEPT variable-name-1 FROM DATE YYYYMMDD

>and

>ACCEPT variable-name-2 FROM DAY YYYYDDD

>where variable-name-1 is a data item with 8 digits and variable-name-2 has
7
>digits.

>They also added three new intrinsic functions, from the same source for the
>same reason:

>DATE-TO-YYYYMMDD
>DAY-TO-YYYYDDD
>YEAR-TO-YYYY

>each of these functions has an optional second argument for specifying the
size
>of the century window for this invocation. If you omit this argument, I
suspect
>you get the century window currently in effect for the enclave.

>Well, gotta' run put this stuff into my courses!

>Regards,

>Steve Comstock
>Telephone: 303-393-8716

>256-B S. Monaco Parkway
>Denver, CO 80224
>USA

FYI - there is one bug in the IBM implementation (at least it doesn't work
the way the draft Standard requires).  The Standard requires that you can
feed ANY nueric values to the new functions -without checking that they are
valid.  (They then have some other new functions to check either YYYYMMDD or
YYYYDDD dates to see if they are valid).

IBM however, "goofed" and gives an error if you try to pass 991332 as a
YYMMDD field BUT they allow 981332 because it is between 1 and 991231.  I am
certain that this is going to cause no end of problems - and hopefully, IBM
will fix it eventually.  (Hint - get any customers you can to complain now
rather than waiting)



Fri, 28 Jul 2000 03:00:00 GMT  
 ACCEPT FROM DATE


Quote:

>No. The only COBOL version that is Y2K enhanced is COBOL-MVS (A/K/A
>COBOL-370). The only way to obtain the century using a Non-Y2K version of
>COBOL is to call an ASSEMBLER Sub-Program, which would issue an SVC 11.

That doesn't exactly help Frank! He's using Micro Focus COBOL 3.4/4.0 on a PC.
Quite clearly stated in his post.

Frank, you need to use the Intrinsic Function CURRENT-DATE. I would have
thought COBOL/370 had intrinsic functions too and I'd advise anybody to use
them if available rather than some proprietry nonsense like calling assembler
sub-routines. I've seen this done in PC code too, someone wrote a C module to
return the date rather than looking for a solution in COBOL. Intrinsic functions
were an addendum to the 85 standard so they aren't exactly new.

[snipped assembler routine]

Quote:



>> Does anybody know if it is possible to get a 4-digit year with accept
>> from date?
>> It tried a little bit but always receive 0098 instead of 1998.
>> I use Micro Focus Cobol 3.4 and 4.0.

>> Frank Pohlmann



Sat, 29 Jul 2000 03:00:00 GMT  
 ACCEPT FROM DATE

Shaun,

IMHO, I had misread Frank's original posting and totally missed the MF
COBOL thing. I'm quite familiar with the intrinsic functions included in
COBOL-370. Unfortunately, I assumed Frank was aware of these as well. One
further observation, ASSEMBLER is not nonsense (as you so put it) and is
still viable in this world of 'C' and other 'newbie' languages. May I
suggest that if you don't know it, don't slam it.

WOB



Quote:

> >No. The only COBOL version that is Y2K enhanced is COBOL-MVS (A/K/A
> >COBOL-370). The only way to obtain the century using a Non-Y2K version
of
> >COBOL is to call an ASSEMBLER Sub-Program, which would issue an SVC 11.

> That doesn't exactly help Frank! He's using Micro Focus COBOL 3.4/4.0 on
a PC.
> Quite clearly stated in his post.

> Frank, you need to use the Intrinsic Function CURRENT-DATE. I would have
> thought COBOL/370 had intrinsic functions too and I'd advise anybody to
use
> them if available rather than some proprietry nonsense like calling
assembler
> sub-routines. I've seen this done in PC code too, someone wrote a C
module to
> return the date rather than looking for a solution in COBOL. Intrinsic
functions
> were an addendum to the 85 standard so they aren't exactly new.

> [snipped assembler routine]



> >> Does anybody know if it is possible to get a 4-digit year with accept
> >> from date?
> >> It tried a little bit but always receive 0098 instead of 1998.
> >> I use Micro Focus Cobol 3.4 and 4.0.

> >> Frank Pohlmann



Sat, 29 Jul 2000 03:00:00 GMT  
 ACCEPT FROM DATE


Quote:

>Shaun,

>IMHO, I had misread Frank's original posting and totally missed the MF
>COBOL thing. I'm quite familiar with the intrinsic functions included in
>COBOL-370. Unfortunately, I assumed Frank was aware of these as well. One
>further observation, ASSEMBLER is not nonsense (as you so put it) and is
>still viable in this world of 'C' and other 'newbie' languages. May I
>suggest that if you don't know it, don't slam it.

I didn't slam ASSEMBLER. I slammed proprietry solutions where a standard
generic one exists. Assembler has it's places, sure.

You should see the COBOL and assembler I work with! But then again I'm using
the assembler to do pre-emptive multi-tasking on DOS 5.0 with async comms and
low level device driver access to point-of-sale hardware across a Real/Protect
mode memory driver and keep everything synced on a NETBIOS based network ;-)

Shaun



Mon, 31 Jul 2000 03:00:00 GMT  
 
 [ 15 post ] 

 Relevant Pages 

1. Problem "Accept from date"

2. ACCEPT FROM DATE & COBOL II

3. Y2K Bug found in ACCEPT FROM DATE

4. accept from date

5. accept from date

6. ACCEPT x FROM DATE issue

7. VS COBOL II - Accepting 9(08) date from system

8. ACCEPT x FROM DATE issue

9. ACCEPT x FROM DATE issue

10. Invalid dates - 215 using Btrieve/Clipper DATE format

11. how to convert clarion date to sql date

12. Create Time / date or Modified Time / date of a txt file

 

 
Powered by phpBB® Forum Software