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

Converting data - DB2 RBA to Character


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
paulo sampaio viola

New User


Joined: 19 Aug 2009
Posts: 7
Location: lisboa, portugal

PostPosted: Mon Aug 24, 2009 5:44 pm
Reply with quote

Hello!

I am receiving a file with the DB2 LOG. One of the fields is the DB2 RBA (Relative Byte Address). I want to convert this data into character

Example : X'1B785DE110B2' into 1B785DE110B2

I am using the instruction

EXEC SQL
SET :FLOGDB2O-RBA = HEX(:FLOGDB2I-RBA)
END-EXEC.

But I wanted to do this WITHOUT acessing DB2, as the input file can have millions of records.

Can anyone help?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Aug 24, 2009 5:57 pm
Reply with quote

Quote:
I want to convert this data into character

Example : X'1B785DE110B2' into 1B785DE110B2


?? why don't you just remove the "X'" and the last "'"?
Back to top
View user's profile Send private message
paulo sampaio viola

New User


Joined: 19 Aug 2009
Posts: 7
Location: lisboa, portugal

PostPosted: Mon Aug 24, 2009 6:04 pm
Reply with quote

What do you mean?

The field is X(06)

175E1B
B8D102

is the content
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: Mon Aug 24, 2009 6:09 pm
Reply with quote

Click on the following LINK -

www.ibmmainframes.com/viewtopic.php?p=115071&highlight=#115071

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Aug 24, 2009 6:27 pm
Reply with quote

Code:

01  HEX-CHAR-TAB.
    FILLER          PIC X(32) VALUE '000102030405060708090A0B0C0D0E0F'.
    FILLER          PIC X(32) VALUE '101112131415161718191A1B1C1D1E1F'.
    ...
    FILLER          PIC X(32) VALUE 'F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF'.

01  CONVERT-TAB
    REDEFINES
    HEX-CHAR-TAB.
    05  CONVERT-ITEM           OCCURS 256 TIMES
                               PIC X(02).


01  WS-WORK-AREA.
    05  WS-SUB-1               PIC S9(04) BINARY.
    05  FILLER
        REDEFINES
        WS-SUB-1.
        10  FILLER             PIC X(01) VALUE LOW-VALUES.
        10  PLUG-HEX           PIC X(01).
    05  WS-RBA-WORK.
        10  WS-RBA-1           PIC X(01).
        10  WS-RBA-2           PIC X(01).
        10  WS-RBA-3           PIC X(01).
        10  WS-RBA-4           PIC X(01).
        10  WS-RBA-5           PIC X(01).
        10  WS-RBA-6           PIC X(01).
     05 WS-RBA-CHAR.
        10  WS-RBA-CHAR-1      PIC X(01).
        10  WS-RBA-CHAR-2      PIC X(01).
        10  WS-RBA-CHAR-3      PIC X(01).
        10  WS-RBA-CHAR-4      PIC X(01).
        10  WS-RBA-CHAR-5      PIC X(01).
        10  WS-RBA-CHAR-6      PIC X(01).

MOVE RBA-FROM-INPUT             TO WS-RBA-WORK
MOVE WS-RBA-1                   TO PLUG-HEX
MOVE CONVERT-ITEM(WS-SUB-1)     TO WS-RBA-CHAR-1
MOVE WS-RBA-2                   TO PLUG-HEX
MOVE CONVERT-ITEM(WS-SUB-1)     TO WS-RBA-CHAR-2
MOVE WS-RBA-3                   TO PLUG-HEX
MOVE CONVERT-ITEM(WS-SUB-1)     TO WS-RBA-CHAR-3
MOVE WS-RBA-4                   TO PLUG-HEX
MOVE CONVERT-ITEM(WS-SUB-1)     TO WS-RBA-CHAR-4
MOVE WS-RBA-5                   TO PLUG-HEX
MOVE CONVERT-ITEM(WS-SUB-1)     TO WS-RBA-CHAR-5
MOVE WS-RBA-6                   TO PLUG-HEX
MOVE CONVERT-ITEM(WS-SUB-1)     TO WS-RBA-CHAR-6

MOVE WS-RBA-CHAR                TO OUTPUT-RBA
Back to top
View user's profile Send private message
paulo sampaio viola

New User


Joined: 19 Aug 2009
Posts: 7
Location: lisboa, portugal

PostPosted: Mon Aug 24, 2009 6:54 pm
Reply with quote

Bill

It really works

Thanks a 1.000.000
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top