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
 

 

Read a comp-3 value in a pic x format

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

Active User


Joined: 23 Mar 2005
Posts: 156

PostPosted: Wed Jan 27, 2010 11:45 pm    Post subject: Read a comp-3 value in a pic x format
Reply with quote

I am coding a varying list SELECT statement and have populated the address in SQLDA and after the Fetch cursor I can see the data populated in the storage that I allocated.
Now I have trouble reading decimal fields, suppose if the hex values are 001C. Since my store is a pic X(1000), how do I move the char field that has a hex value of 001C to a displayable format like '1'
I would appreciate any help.

Vivek.
Back to top
View user's profile Send private message

Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Jan 28, 2010 12:02 am    Post subject: Reply to: Read a comp-3 value in a pic x format
Reply with quote

Assuming there's a X'001C' in the first two-bytes of WS-STORE-1000 -

Code:

03  WS-STORE-1000 PIC  X(1000).
03  WS-PACKED-X PIC  X(02).
03  WS-PACKED REDEFINES WS-PACKED-X PIC S9(03) COMP-3.
03  WS-DISPLAY PIC 9(03).

MOVE WS-STORE-1000 TO WS-PACKED-X.
MOVE WS-PACKED TO WS-DISPLAY.

At this point, WS-DISPLAY equals 001.

YMMV....

Bill
Back to top
View user's profile Send private message
die7nadal

Active User


Joined: 23 Mar 2005
Posts: 156

PostPosted: Thu Jan 28, 2010 1:32 am    Post subject:
Reply with quote

Thanks a lot it worked good.
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 Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm
No new posts Read of TDQ fails in LENGERR Tracy Hansen CICS 10 Wed Apr 05, 2017 12:10 am


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