Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Using HIGH-VALUES with different format fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Ensign

New User


Joined: 19 May 2009
Posts: 9
Location: Spain

PostPosted: Thu Jun 25, 2009 2:12 pm    Post subject: Using HIGH-VALUES with different format fields
Reply with quote

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
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jun 25, 2009 2:33 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Mathiv Anan

Active User


Joined: 23 Jul 2008
Posts: 106
Location: USA

PostPosted: Thu Jun 25, 2009 2:38 pm    Post subject: Reply to: Using HIGH-VALUES with different format fields
Reply with quote

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
View user's profile Send private message
Ensign

New User


Joined: 19 May 2009
Posts: 9
Location: Spain

PostPosted: Thu Jun 25, 2009 3:12 pm    Post subject: Reply to: Using HIGH-VALUES with different format fields
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7999
Location: Bellevue, IA

PostPosted: Thu Jun 25, 2009 4:57 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jun 25, 2009 5:08 pm    Post subject:
Reply with quote

or if no valid sales area (w-sales-) can be all 9's, use all 9's.
Back to top
View user's profile Send private message
Ensign

New User


Joined: 19 May 2009
Posts: 9
Location: Spain

PostPosted: Thu Jun 25, 2009 7:59 pm    Post subject: Reply to: Using HIGH-VALUES with different format fields
Reply with quote

Got it. As you said I redefined the field into an alphanumeric and it worked perfectly.

Thanks for your support.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jun 25, 2009 8:29 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us