Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Explaination required for this COBOL move

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Explaination required for this COBOL move
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: 3158
Location: Tucson AZ

PostPosted: Wed Jan 23, 2008 4:33 pm    Post subject:
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    Post subject: Reply to: Explaination required for this COBOL move
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Thu Feb 07, 2008 6:39 pm    Post subject: Re: Reply to: Explaination required for this COBOL move
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: 6968
Location: porcelain throne

PostPosted: Thu Feb 07, 2008 7:41 pm    Post subject:
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    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 IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us