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

Read a comp-3 value in a pic x format


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Jan 28, 2010 12:02 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Random read in ESDS file by using RBA JCL & VSAM 6
Search our Forums:

Back to Top