Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to Move Character to COMP field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to Move Character to COMP field
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: 7936
Location: Bellevue, IA

PostPosted: Sat Feb 28, 2009 1:41 am    Post subject:
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    Post subject: Reply to: How to Move Character to COMP field
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    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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us