Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Alphanumeric to Packed Decimal Conversion

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Vijay_Sirisha

New User


Joined: 06 Jun 2018
Posts: 7
Location: USA

PostPosted: Mon May 27, 2019 2:52 am    Post subject: Alphanumeric to Packed Decimal Conversion
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: 2247
Location: Hampshire, UK

PostPosted: Mon May 27, 2019 5:04 am    Post subject: Reply to: Alphanumeric to Packed Decimal Conversion
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

Senior Member


Joined: 21 Sep 2010
Posts: 2299
Location: NY,USA

PostPosted: Tue May 28, 2019 4:39 pm    Post subject:
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    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 String to ASCII conversion JPLMARTINS COBOL Programming 4 Sun Sep 29, 2019 12:00 am
No new posts Convert string to packed format ajaydwivedi4u COBOL Programming 6 Sat Sep 21, 2019 5:01 pm
No new posts Pack to Unpack conversion for sending... A_programmers COBOL Programming 13 Wed Sep 11, 2019 10:46 pm
No new posts Convert Numeric to Packed decimal and... anand1204 DFSORT/ICETOOL 5 Thu Aug 08, 2019 3:53 am
No new posts data conversion error maxsubrat PL/I & Assembler 4 Thu May 09, 2019 10:57 pm

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