IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Explaination required for this COBOL move


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Varun Singh

New User


Joined: 01 Aug 2007
Posts: 25
Location: Delhi

PostPosted: Wed Jan 23, 2008 4:22 pm
Reply with quote

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

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Wed Jan 23, 2008 4:33 pm
Reply with quote

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

New User


Joined: 01 Aug 2007
Posts: 25
Location: Delhi

PostPosted: Wed Jan 23, 2008 4:48 pm
Reply with quote

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

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Wed Jan 23, 2008 4:49 pm
Reply with quote

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

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Feb 07, 2008 6:39 pm
Reply with quote

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

Global Moderator


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

PostPosted: Thu Feb 07, 2008 7:41 pm
Reply with quote

now he is going to ask about pack instead of reading himself.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top