Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 2504
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 Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts FTP data transfer from PC to Mainfram... AJAYREDDY All Other Mainframe Topics 8 Wed Aug 23, 2017 9:59 pm

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