MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with straight forward numeric MOVE in COBOL.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
niks
Beginner


Joined: 25 Feb 2004
Posts: 2
Topics: 1

PostPosted: Tue Apr 20, 2004 7:33 am    Post subject: Problem with straight forward numeric MOVE in COBOL. Reply with quote

I have two numeric variables defined as:

01 SCREEN-AREA.
05 WS-NUM1 PIC 9(17).

01 WORK-AREA.
05 WS-NUM1 PIC 9(17).

MOVE WS-NUM1 IN SCREEN-AREA TO WS-NUM1 IN WORK-AREA.

SCREEN-AREA comes from CICS. When we enter less than 17 digits on the screen, the WS-NUM1 IN WORK-AREA gets a zero padded in the 17th position.

Example if I enter '1187287 ' on the screen, after the move the WS_NUM1 in work area gets '1187287 0'.

The field on the screen is left justified and is defined as numeric in the screen also.

After checking the compile listing I saw the assembly instructions looked like:

MVC 1456(17,6),700( 8 )
OI 1472(6),X'F0'

My guess is the OI (assembler OR) is creating the problem of the zero in position 17.

The requirement is :
The field has to be left justified in any case, the client will not compromise on that. Both fields have to be numeric so justify left will not work.
I cannot change the compile options as it is done by the config tool. I'm using VS COBOL II Release 4.0.

Is there a way to avoid this problem?

Thanks.
Niks
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Apr 20, 2004 8:07 am    Post subject: Reply with quote

Niks,

Quote:

I cannot change the compile options as it is done by the config tool. I'm using VS COBOL II Release 4.0.


The compiler options can be overriden the program itself using CBL statements .

Add this line at the top of your program.i.e before the ID division.

Code:

CBL NUMPROC(PFD)


And now run the program and look at the output. And here is the explanation of NUMPROC

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/2.4.34?DT=20020923143836

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
niks
Beginner


Joined: 25 Feb 2004
Posts: 2
Topics: 1

PostPosted: Tue Apr 20, 2004 11:45 pm    Post subject: Reply with quote

Thanks a lot Kolusu.
I tried the compiler option and it worked. I didn't realise until I saw your reply that sign bit validation was causing the problem.

Thanks once again ! Very Happy
niks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group