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

How to Move Character to COMP field


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

New User


Joined: 16 Aug 2007
Posts: 27
Location: Hyderabad

PostPosted: Sat Feb 28, 2009 1:15 am
Reply with quote

I am writing IMS stored procedure I have requirement like below

INPUT.
01 POS-NEG PIC X(1) Value 'P' or 'N'
/* P means '+' N Means '-' */
01 BET-VALUE PIC X(6) .

OUTPUT.
01 DB2-BET-VALUE PIC S9(9) USAGE COMP. .

For example data of POS-NEG fiedl is 'P' and BET-VALUE is 100 so I have to move +100 to DB2-BET-VALUE

1. How to combine the POS-NEG and BET-VALUE fields to making +100.
2. How to move the +100 to DB2-BET-VALUE.

Please Can anybody provide logic
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat Feb 28, 2009 1:41 am
Reply with quote

Untested on my system:
Code:
01  POS-NEG PIC X(1).
    88  NEG-VALUE     VALUE 'N'.
.
.
.

IF  NEG-VALUE
    COMPUTE DB2-BET-VALUE = FUNCTION NUMVAL (BET-VALUE) * (-1)
ELSE
    COMPUTE DB2-BET-VALUE = FUNCTION NUMVAL (BET-VALUE)
END-IF.
Back to top
View user's profile Send private message
vvgoud

New User


Joined: 16 Aug 2007
Posts: 27
Location: Hyderabad

PostPosted: Sat Feb 28, 2009 2:04 am
Reply with quote

Robert,

It seems it works fine. I appreciate your Help.
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 Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts S0C7 - Field getting overlayed COBOL Programming 2
Search our Forums:

Back to Top