View previous topic :: View next topic
|
Author |
Message |
Varun Singh
New User
Joined: 01 Aug 2007 Posts: 25 Location: Delhi
|
|
|
|
Hi all,
I had written a cobol pgm
WORKING-STORAGE SECTION.
01 WS-1 PIC X(03) VALUE 'ABC'.
01 WS-2 PIC 9(03) VALUE ZEROES.
01 WS-3 PIC S9(03) COMP-3 VALUE ZEROES.
01 WS-4 PIC X(03) VALUE '123'.
01 WS-5 PIC 9(03) VALUE ZEROES.
01 WS-6 PIC S9(03) COMP-3 VALUE ZEROES.
PROCEDURE DIVISION.
MOVE WS-1 TO WS-2.
MOVE WS-2 TO WS-3.
MOVE WS-4 TO WS-5.
MOVE WS-5 TO WS-6.
DISPLAY "WS-1" WS-1.
DISPLAY "WS-2" WS-2.
DISPLAY "WS-3" WS-3.
DISPLAY "WS-4" WS-4.
DISPLAY "WS-5" WS-5.
DISPLAY "WS-6" WS-6.
STOP RUN.
The result that I got on execution
WS-1ABC
WS-2AB3
WS-3123
WS-4123
WS-5123
WS-6123
and not SOC7
Can anybody explain me...Why this happened |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
COBOL is just following its own rules for Elementary moves...
The movement of tata from 2 to 3 is a ZAP, which doesnt 0C7.... |
|
Back to top |
|
|
Varun Singh
New User
Joined: 01 Aug 2007 Posts: 25 Location: Delhi
|
|
|
|
Hi William,
Thanks for your quick response
Elementary move
Please elaborate
WS-2 = AB3
from where does the value came as WS-2 is numeric in nature
And I would also appreciate if somebody can explain me 'ZAP' |
|
Back to top |
|
|
the_gautam
Active User
Joined: 05 Jun 2005 Posts: 165 Location: Bangalore
|
|
|
|
whenever you pass a value to a particular data-item using MOVE verb, it does not result into S0C7 abend. the abend is thrown only when you try to perform some arithmetic operation on a non-numeric data.
in your case, try performing any arithmetic operation on the data-items WS-2, WS-3, WS-5 and WS-6. you will end up with a S0C7 abend. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Varun Singh wrote: |
Elementary move
Please elaborate |
Follow the link and read....
Quote: |
WS-2 = AB3
from where does the value came as WS-2 is numeric in nature |
ABC>>C1C2C3
C1C2C3 move and insure the sign is F C1C2F3
C1C2F3 pack 123F
Quote: |
And I would also appreciate if somebody can explain me 'ZAP' |
My bad, that should have read PACK rather than ZAP.... |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
now he is going to ask about pack instead of reading himself. |
|
Back to top |
|
|
|