View previous topic :: View next topic
|
Author |
Message |
Ensign
New User
Joined: 19 May 2009 Posts: 9 Location: Spain
|
|
|
|
It's simple, I need to move high-values to a field, so I'm doing this:
MOVE HIGH-VALUES TO WK-SALES-1
But, I'm getting a compilation error, don't know why...
I changed three times the definition of the field, but the error continues. So, I can't use the HIGH-VALUES in my program??
1)
05 WK-SALES-1 PIC 9(9).
"HIGH-VALUES" AND "WK-SALES-1 (NUMERIC INTEGER)" DID NOT FOLLOW THE "MOVE" STATEMENT COMPATIBILITY RULES.
2)
05 WK-SALES-1 PIC S9(18) COMP.
"HIGH-VALUES" AND "WK-SALES-1 (BINARY INTEGER)" DID NOT FOLLOW THE "MOVE" STATEMENT COMPATIBILITY RULES.
3)
05 WK-SALES-1 PIC S9(9) COMP-3.
"HIGH-VALUES" AND "WK-SALES-1 (PACKED INTEGER)" DID NOT FOLLOW THE "MOVE" STATEMENT COMPATIBILITY RULES.
Don't understand which compatibility rules it means.
Regards and thanks. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
high-values is not a numeric literal.
normally, a 'high value' or 'highest value' for a numeric is all 9's.
if you explain your problem - what is it that you are trying to accomplish -
someone could propose a solution. |
|
Back to top |
|
|
Mathiv Anan
Active User
Joined: 23 Jul 2008 Posts: 106 Location: USA
|
|
|
|
Ensign,
High-values - we can say non-numeric values. Isn't it?
Since you are moving high-values (X'FFFFFFFF' etc) to numeric values, it is saying not compatible for a move statement.
Could you please let us know your actual requirement.
If you are trying to initialize the variable, you can use INITIALIZE or Move ZEROS statement.
Thanks. |
|
Back to top |
|
|
Ensign
New User
Joined: 19 May 2009 Posts: 9 Location: Spain
|
|
|
|
It's a matching between files:
IF WK-SALES-1 = WK-SALES-2
MOVE R-AUTCOM TO REG-SALIDA
MOVE FIC-CAE-COMERCIO TO SAL-CAE
DISPLAY 'SAL-CAE: ' SAL-CAE
PERFORM WRITE-SALIDA
PERFORM READ-FILE-1
ELSE
IF WK-SALES-1 < WK-SALES-2
MOVE R-AUTCOM TO REG-SALIDA
MOVE SPACES TO SAL-CAE
PERFORM WRITE-SALIDA
PERFORM READ-FILE-1
ELSE
PERFORM READ-FILE-2
END-IF.
I can't control the end-of-file of file number 2 with high-values in the read paragraph.
The fact is that I want to write all records of file number 1 in output file, and when file number 2 is ended, it should continue writing the remain records of file number 1. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
You'll need a REDEFINES on WK-SALES-1 to PIC X(09) and move the HIGH-VALUES to the PIC X field. You'll also want to use the PIC X field in your comparison or you could get a S0C7 abend. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
or if no valid sales area (w-sales-) can be all 9's, use all 9's. |
|
Back to top |
|
|
Ensign
New User
Joined: 19 May 2009 Posts: 9 Location: Spain
|
|
|
|
Got it. As you said I redefined the field into an alphanumeric and it worked perfectly.
Thanks for your support. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
nested EVALUATEs tend to make this an easy task and removes the need for specials flags in key fields. It does require the use of FILE-STATUS clause for both files and appropriate level 88's:
Code: |
CONTROL-SECTION SECTION.
PERFORM READ-FILE1
PERFORM READ-FILE2
PERFORM CONTROL-SECTION
UNTIL (EOF-FILE1 AND EOF-FILE2)
OR FILE1-ERROR
OR FILE2-ERROR
OR PROGRAM-STOP-REQUESTED
PERFORM EOJ
GOBACK
.
CONTROL-SECTION-EXIT.
EXIT.
PROCESS-FILES-SECTION SECTION.
EVALUATE TRUE
WHEN NOT-EOF-FILE1 AND NOT-EOF-FILE2
EVALUATE TRUE
WHEN KEY-FILE1 < KEY-FILE2
PERFORM KEY1-IS-LESS-THAN-KEY2
PERFORM READ-FILE2
WHEN KEY-FILE1 > KEY-FILE2
PERFORM KEY1-IS-GREATER-THAN-KEY2
PERFORM READ-FILE1
WHEN OTHER
PERFORM KEYS-ARE-EQUAL
PERFORM READ-FILE1
PERFORM READ-FILE2
END-EVALUATE
WHEN NOT-EOF-FILE1 AND EOF-FILE2
PERFORM ONLY-HAVE-KEY1
PERFORM READ-FILE1
WHEN EOF-FILE1 AND NOT-EOF-FILE2
PERFORM ONLY-HAVE-KEY2
PERFORM READ-FILE2
WHEN OTHER
CONTINUE
END-EVALUATE
.
PROCESS-FILES-SECTION-EXIT.
EXIT.
|
|
|
Back to top |
|
|
|