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
 

 

Question about moving hex to pic x

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

New User


Joined: 16 May 2006
Posts: 11

PostPosted: Mon Apr 07, 2008 10:10 pm    Post subject: Question about moving hex to pic x
Reply with quote

Dear all, I was just wondering if there is a better way to move a hex value to X field, considering the length of the hex value is 512 and which X(256) is expected from it?

Code:

     01  FILLER
    *    WX-INPUT is something like A7F233D6C4
    *    somehow by a routine, it can convert to WX-OUTPUT = X'A7F233D6C4'
          05  WX-INPUT     X(512)
          05  WX-OUTPUT  X(256)


Please help!
[/code]
Back to top
View user's profile Send private message

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon Apr 07, 2008 10:22 pm    Post subject:
Reply with quote

Do you mean that you want to convert from a display form of an hex to an actual hex?
From C'A7F233D6C4' which is X'C1F7C6F2F3F3C4F6C3F4' to X'A7F233D6C4' which is C'x2.PD' where the '.' is unprintable......
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: Mon Apr 07, 2008 11:50 pm    Post subject: Convert C'A7F233D6C4' to X'A7F233D6C4'
Reply with quote

Code:

03  WS-PACKED-V9 PIC  9(16)V9 COMP-3.
03  WS-PACKED-X   REDEFINES WS-PACKED-V9
                              PIC  X(09).
03  WS-PACKED      REDEFINES WS-PACKED-V9
                             PIC  9(17)      COMP-3.
03  WS-DISPLAY-V9 PIC  9(16)V9.
03  WS-DISPLAY-X  REDEFINES WS-DISPLAY-V9
                             PIC  X(17).
03  WS-DISPLAY     REDEFINES WS-DISPLAY-V9
                             PIC  9(17).

MOVE 'A7F233D6C4' TO WS-DISPLAY-X (1:10).
MOVE ZERO TO WS-DISPLAY-X (11:).

INSPECT WS-DISPLAY-X CONVERTING 'ABCDEF' TO X'FAFBFCFDFEFF'.

MOVE WS-DISPLAY-V9 TO WS-PACKED-V9.

At this point, WS-PACKED-X = X'A7F233D6C40000000F'

Note that both NUMERIC fields must be unsigned.

HTH....

Regards,

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

New User


Joined: 16 May 2006
Posts: 11

PostPosted: Tue Apr 08, 2008 12:16 pm    Post subject:
Reply with quote

Thanks a lot.
So due to the limitation of Comp field, I guess my 512 string need to be chopped and run few times to get the result, right? icon_biggrin.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Apr 08, 2008 7:45 pm    Post subject:
Reply with quote

Hello,

One easy way to do what you need is to define an array that contains all of the 2-byte values (representing from x'00' to x'FF') and then use the "hex-value" in each "input" byte as the displacement into the array to get the corresponding expanded value.

For example a one would return the 2-byte value F1.
Back to top
View user's profile Send private message
zaphany

New User


Joined: 16 May 2006
Posts: 11

PostPosted: Thu Apr 10, 2008 6:31 am    Post subject:
Reply with quote

Thanks a lot for all your help icon_biggrin.gif
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 Asynchronous CICS Processing Question moezbud CICS 0 Mon Mar 06, 2017 6:13 pm
No new posts CICS Question RE: Browse, Readnext an... moezbud CICS 7 Sun Mar 05, 2017 5:45 am
No new posts Moving a PD to PD spoorni DFSORT/ICETOOL 8 Fri Oct 07, 2016 9:52 pm
No new posts Fault Analyzer - listings question. egrove IBM Tools 4 Thu Aug 11, 2016 5:31 pm
No new posts dataset copy question - REPRO or some... atulxp TSO/ISPF 2 Wed Aug 03, 2016 10:56 pm


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