My lab is DUE!!! 
Author Message
 My lab is DUE!!!

Help me please,

My lab is due and I can't get it to work!

Here's the situation:
        1. I need to generate a unique ID number for a record.
        2. The ID must consist of the following:
                A. 7 digit number representing the current date                 including the
century (YYYYDDD).
                B. A two digit counter.

I know how to increment the counter, but, I keep getting an error when
checking that says "Integer Required".

I'm trying to use this syntax:

WORKING-STORAGE SECTION.
        01 THIS-DATE.
                05 THIS-YR      PIC 9(04).
                05 THIS-MO      PIC 9(02).
                05 THIS-DY      PIC 9(02).

        01 PROJ-ID.
                05 JULIAN       PIC 9(07).
                05 OTHER-PART   PIC 9(02).
...
        MOVE FUNCTION CURRENT-DATE TO THIS-DATE.
        COMPUTE JULIAN =
                FUNCTION DAY-OF-INTEGER (FUNCTION INTEGER-OF-DATE
                                        (THIS-DATE)).

This is the same exact syntax that is in my book and I keep getting the
error "Integer Required".

What's wrong?



Fri, 29 Jan 1999 03:00:00 GMT  
 My lab is DUE!!!

+Help me please,
+
+My lab is due and I can't get it to work!
+
+Here's the situation:
+       1. I need to generate a unique ID number for a record.
+       2. The ID must consist of the following:
+               A. 7 digit number representing the current date                 including the
+century (YYYYDDD).
+               B. A two digit counter.
+
+I know how to increment the counter, but, I keep getting an error when
+checking that says "Integer Required".
+
+I'm trying to use this syntax:
+
+WORKING-STORAGE SECTION.
+       01 THIS-DATE.
+               05 THIS-YR      PIC 9(04).
+               05 THIS-MO      PIC 9(02).
+               05 THIS-DY      PIC 9(02).
*********** add this here
        01 this-date-n REDEFINES this-date PIC 9(8).
**************************************************************************
+
+       01 PROJ-ID.
+               05 JULIAN       PIC 9(07).
+               05 OTHER-PART   PIC 9(02).
+....
+       MOVE FUNCTION CURRENT-DATE TO THIS-DATE.
+       COMPUTE JULIAN =
+               FUNCTION DAY-OF-INTEGER (FUNCTION INTEGER-OF-DATE
**************************************** and change this
+                                       (THIS-DATE)).
********************************************* to this:
                                        (this-date-n)).

+This is the same exact syntax that is in my book and I keep getting the
+error "Integer Required".
+
+What's wrong?

The book's author didn't test everything he wrote -- a common affliction
even (particularly?) among experienced programmers.



Sat, 30 Jan 1999 03:00:00 GMT  
 My lab is DUE!!!

Quote:

> WORKING-STORAGE SECTION.
>         01 THIS-DATE.
>                 05 THIS-YR      PIC 9(04).
>                 05 THIS-MO      PIC 9(02).
>                 05 THIS-DY      PIC 9(02).

I think this is where your problem lies. Any GROUP level item (such as
your "01 THIS-DATE" is considered to be a character field. You need to
change it as follows:

          01 THIS-DATE-CHAR.
                  05 THIS-YR      PIC 9(04).
                  05 THIS-MO      PIC 9(02).
                  05 THIS-DY      PIC 9(02).
          01 THIS-DATE REDEFINES  THIS-DATE-CHAR PIC 9(8).

Then it'll work.

You also need to change the MOVE statement to be :

        MOVE FUNCTION CURRENT-DATE TO THIS-DATE-CHAR.

Hope this helps!!

--
Andy Styles.

     /o/-------------------------------------/o/


   \o\. . . . . . . . . . . . . . . . . . .\o\
   /o/ My opinions are my own, and do not  /o/
  /o/ reflect those of Ford Motor Company /o/



Sat, 30 Jan 1999 03:00:00 GMT  
 My lab is DUE!!!

Quote:

>Help me please,
>My lab is due and I can't get it to work!
>Here's the situation:
>    1. I need to generate a unique ID number for a record.
>    2. The ID must consist of the following:
>            A. 7 digit number representing the current date                 including the
>century (YYYYDDD).
>            B. A two digit counter.
>I know how to increment the counter, but, I keep getting an error when
>checking that says "Integer Required".
>I'm trying to use this syntax:

>WORKING-STORAGE SECTION.
>    01 THIS-DATE.
>            05 THIS-YR      PIC 9(04).
>            05 THIS-MO      PIC 9(02).
>            05 THIS-DY      PIC 9(02).

        01  THIS-DATE           PIC 9(8).

Quote:
>    01 PROJ-ID.
>            05 JULIAN       PIC 9(07).
>            05 OTHER-PART   PIC 9(02).
>...
>    MOVE FUNCTION CURRENT-DATE TO THIS-DATE.
>    COMPUTE JULIAN =
>            FUNCTION DAY-OF-INTEGER (FUNCTION INTEGER-OF-DATE
>                                    (THIS-DATE)).
>This is the same exact syntax that is in my book and I keep getting the
>error "Integer Required".
>What's wrong?

Try using the above change to your working-storage.  A group item is
defined as alphanumeric, even if all its' elements are integer.  If you
need to reference the year, month or day, you can always use reference
modification.


Sat, 30 Jan 1999 03:00:00 GMT  
 My lab is DUE!!!


the following was written:

Quote:
> Help me please,

> My lab is due and I can't get it to work!

> Here's the situation:
> 1. I need to generate a unique ID number for a record.
> 2. The ID must consist of the following:
> A. 7 digit number representing the current date            
> including the
> century (YYYYDDD).
> B. A two digit counter.

> I know how to increment the counter, but, I keep getting an error when
> checking that says "Integer Required".

> I'm trying to use this syntax:

> WORKING-STORAGE SECTION.
> 01 THIS-DATE.
> 05 THIS-YR      PIC 9(04).
> 05 THIS-MO      PIC 9(02).
> 05 THIS-DY      PIC 9(02).

> 01 PROJ-ID.
> 05 JULIAN       PIC 9(07).
> 05 OTHER-PART   PIC 9(02).
> ....
> MOVE FUNCTION CURRENT-DATE TO THIS-DATE.
> COMPUTE JULIAN =
> FUNCTION DAY-OF-INTEGER (FUNCTION INTEGER-OF-DATE
> (THIS-DATE)).

> This is the same exact syntax that is in my book and I keep getting
> the error "Integer Required".

> What's wrong?

The basic problem has to with data format.  The functions that you are
using in the JULIAN computation must be integers which are defined as
COMP.  Also the CURRENT-DATE function returns more than just the date,
so I changed that also.  Here is the code that I compiled and ran to get
what I believe you are looking for.  Hope this helps.

Larry

       IDENTIFICATION DIVISION.
       PROGRAM-ID. TESTPGM.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SOURCE-COMPUTER.    IBM-PC.
       OBJECT-COMPUTER.    IBM-PC.

       DATA DIVISION.

       WORKING-STORAGE SECTION.

       01  CURR-DATE-STUFF.
           05  CURR-DATE      PIC 9(8).
           05  FILLER         PIC X(13).

       01  THIS-DATE          PIC 9(8)    COMP.

       01  PROJ-ID.
              05 JULIAN       PIC 9(07)   COMP.
              05 OTHER-PART   PIC 9(02).

       PROCEDURE DIVISION.

       MOVE FUNCTION CURRENT-DATE TO CURR-DATE-STUFF.
       MOVE CURR-DATE TO THIS-DATE.
       DISPLAY THIS-DATE.
       COMPUTE JULIAN =
              FUNCTION DAY-OF-INTEGER (FUNCTION INTEGER-OF-DATE
                                   (THIS-DATE)).
       DISPLAY JULIAN.



Sat, 30 Jan 1999 03:00:00 GMT  
 My lab is DUE!!!

Jeffe',

I misled you in my previous reply.  The fields do not have to be coded
as COMP to be handled correctly.  COBOL handles the data conversion.
The referenced data names have to be numeric, and group levels default
to alpha-numeric fields.

Larry



Sat, 30 Jan 1999 03:00:00 GMT  
 My lab is DUE!!!

Thanks for all your help.  I chose to use a REDEFINES clause and it worked.  
It is great to see that the Inet can be such a powerful tool!

Jeffe'



Sun, 31 Jan 1999 03:00:00 GMT  
 My lab is DUE!!!

Quote:


>the following was written:
>> Help me please,

>> My lab is due and I can't get it to work!

>> Here's the situation:
>> 1. I need to generate a unique ID number for a record.
>> 2. The ID must consist of the following:
>> A. 7 digit number representing the current date
>> including the
>> century (YYYYDDD).
>> B. A two digit counter.

>> I know how to increment the counter, but, I keep getting an error when
>> checking that says "Integer Required".

>> I'm trying to use this syntax:

>> WORKING-STORAGE SECTION.
>> 01 THIS-DATE.
>> 05 THIS-YR      PIC 9(04).
>> 05 THIS-MO      PIC 9(02).
>> 05 THIS-DY      PIC 9(02).

>> 01 PROJ-ID.
>> 05 JULIAN       PIC 9(07).
>> 05 OTHER-PART   PIC 9(02).
>> ....
>> MOVE FUNCTION CURRENT-DATE TO THIS-DATE.
>> COMPUTE JULIAN =
>> FUNCTION DAY-OF-INTEGER (FUNCTION INTEGER-OF-DATE
>> (THIS-DATE)).

>> This is the same exact syntax that is in my book and I keep getting
>> the error "Integer Required".

>> What's wrong?

>The basic problem has to with data format.  The functions that you are
>using in the JULIAN computation must be integers which are defined as
>COMP.

This is not completely correct. The fields must be integers, yes, but there
is no requirement that they be USAGE COMP.

Quote:
> Also the CURRENT-DATE function returns more than just the date,
>so I changed that also.  Here is the code that I compiled and ran to get
>what I believe you are looking for.  Hope this helps.

Actually, he's using this properly, I think -- since he's returning the value
into an alphanumeric data item, it's truncated on the right, which produces
the desired result. His problem is simply that he needs to redefine those
eight bytes as PIC 9(8) before trying to use them as input to the next
function call. There's no need to copy that to a COMP field.

- Show quoted text -

Quote:
>Larry

>       IDENTIFICATION DIVISION.
>       PROGRAM-ID. TESTPGM.
>       ENVIRONMENT DIVISION.
>       CONFIGURATION SECTION.
>       SOURCE-COMPUTER.    IBM-PC.
>       OBJECT-COMPUTER.    IBM-PC.

>       DATA DIVISION.

>       WORKING-STORAGE SECTION.

>       01  CURR-DATE-STUFF.
>           05  CURR-DATE      PIC 9(8).
>           05  FILLER         PIC X(13).

>       01  THIS-DATE          PIC 9(8)    COMP.

>       01  PROJ-ID.
>              05 JULIAN       PIC 9(07)   COMP.
>              05 OTHER-PART   PIC 9(02).

>       PROCEDURE DIVISION.

>       MOVE FUNCTION CURRENT-DATE TO CURR-DATE-STUFF.
>       MOVE CURR-DATE TO THIS-DATE.
>       DISPLAY THIS-DATE.
>       COMPUTE JULIAN =
>              FUNCTION DAY-OF-INTEGER (FUNCTION INTEGER-OF-DATE
>                                   (THIS-DATE)).
>       DISPLAY JULIAN.



Sun, 31 Jan 1999 03:00:00 GMT  
 My lab is DUE!!!


Quote:

>>Help me please,

>>My lab is due and I can't get it to work!

>>Here's the situation:
>>        1. I need to generate a unique ID number for a record.
>>        2. The ID must consist of the following:
>>                A. 7 digit number representing the current date                 including the
>>century (YYYYDDD).
>>                B. A two digit counter.

>>I know how to increment the counter, but, I keep getting an error when
>>checking that says "Integer Required".

>>I'm trying to use this syntax:

>>WORKING-STORAGE SECTION.
>>        01 THIS-DATE.
>>                05 THIS-YR      PIC 9(04).
>>                05 THIS-MO      PIC 9(02).
>>                05 THIS-DY      PIC 9(02).

>    01  THIS-DATE           PIC 9(8).

>>        01 PROJ-ID.
>>                05 JULIAN       PIC 9(07).
>>                05 OTHER-PART   PIC 9(02).
>>...
>>        MOVE FUNCTION CURRENT-DATE TO THIS-DATE.
>>        COMPUTE JULIAN =
>>                FUNCTION DAY-OF-INTEGER (FUNCTION INTEGER-OF-DATE
>>                                        (THIS-DATE)).

>>This is the same exact syntax that is in my book and I keep getting the
>>error "Integer Required".

>>What's wrong?

>Try using the above change to your working-storage.  A group item is
>defined as alphanumeric, even if all its' elements are integer.  If you
>need to reference the year, month or day, you can always use reference
>modification.

If you had tested this incorrect code before posting it, you would realize
that it places the LOW-order eight characters of the function's return value
in THIS-DATE. These eight characters aren't even all numeric.

The function CURRENT-DATE returns a 21-character STRING value consisting of
1-4     year
5-6     month
7-8     day
9-10    hours past midnight
11-12   minutes
13-14   seconds
15-16   hundredths of seconds
17      relationship to Greenwich Mean Time ( "-" or "+")
18-19   hours ahead/behind GMT
20-21   additional minutes ahead/behind GMT



Mon, 01 Feb 1999 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. I am not deaf, but am I mute?

2. I am using LabVIEW6.i and DAQ Lab-PC+ with Windows 98.

3. I am unable to print main VI due to "image.ccp"

4. I am inexperienced in Lab View. I need to convert several...

5. Exit Due to Error 52. GPF

6. Mysterious W.B. due to missing presenter method

7. NYC ST meeting cancelled due to ObjectExpo

8. Papers due 6/13 - Conference on Domain-Specific Languages (DSL)

9. CHI99 Workshops...position papers due 26 February 1999

10. Primitive failed in: EmSystemConfiguration>>#loadComponentPrimitive: due to Not enough memory

11. Image crashing due to .DLL

12. OOPSLA '97 papers due February 14th

 

 
Powered by phpBB® Forum Software