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
 
Cobol programming question

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
deepak.kec

New User


Joined: 26 Feb 2007
Posts: 71
Location: bangalore

PostPosted: Fri Dec 11, 2009 7:16 pm    Post subject: Cobol programming question
Reply with quote

Hi,

The question is below.

A PIC X(5) VALUE 'ABCDE'
B PIC 9(5).

Move A TO B

This will give SOC07 abend.

How to resolve this abend using program logic.

No change in A,B definition is allowed

Please let me know your feedback
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8195
Location: East Dubuque, Illinois, USA

PostPosted: Fri Dec 11, 2009 7:24 pm    Post subject:
Reply with quote

Have you tried this? If you do, you'll find no S0C7 abend occurs so there's nothing to resolve. The S0C7 will occur when B is converted to packed decimal or binary (for use in computations, for example).

Find the COBOL Language Reference manual (link at the top of the page) and read up on using the IF NUMERIC test to resolve it.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Fri Dec 11, 2009 7:41 pm    Post subject: Reply to: Cobol programming question
Reply with quote

Change -

Code:

Move A TO B

To -

Code:

Move A (1:) TO B (1:)


This will cause the MOVE to be Alphanumeric to Alphanumeric, without any type of conversion and is applicable to COBOL2 and greater.

However, in the unaltered MOVE, field B will equal 'ABCD5' after the MOVE is complete. The compiler ensures that the last byte of B contains an 'F' zone-nibble, but the numeric-nibble remains. An 'E' is X'C5' and this is where the '5' comes from.

Neither one of these moves will cause a S0C7 on COBOL2 and greater compilers. However, this may not be true on OS/VS COBOL compilers as field A might be packed and then unpacked into B, with a result of 12345.

The reason for B resulting in 12345 is Assembler related and I'll leave that for you to research....

Bill
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Cobol to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts COBOL - EXIT statement weird behavior anthony.pangestu COBOL Programming 0 Fri Oct 27, 2017 9:57 am
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts question about dfsms management clas... Hervey Martinez IBM Tools 0 Tue Oct 10, 2017 6:19 pm

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