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

Alphanumeric to Packed Decimal Conversion


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

New User


Joined: 06 Jun 2018
Posts: 8
Location: USA

PostPosted: Mon May 27, 2019 2:52 am
Reply with quote

I have an input field 01 WS-A X(07) VALUE '5.95).

I am trying to convert this field to and insert as is in a database field. The format of the database field is S9(08)V9(04) COMP-3.

Can someone suggest me, how can i achieve this?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon May 27, 2019 5:04 am
Reply with quote

Please search before posting. About 10 topics belw yours is one with a nearly identical title. (And I didn't even have to use the search function!)
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Tue May 28, 2019 4:39 pm
Reply with quote

Use Nic’s suggestions going forward that will help.

This is a quick DB2 solution since you said you need to insert into DB( which I assumed it’s DB2). If that’s correct then this topic needs to move to DB2 section.
Code:
01 WS-B  pic s9(08)v9(04) comp-3.
EXEC SQL
   SET DEC(:WA:A,12,4) = :WS-B
END-EXEC
IF SQLCODE = 0
    Continue
Else
    Error
END-IF
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
Search our Forums:

Back to Top