ca.portal.admin

Re: [IDMS-L] Computed DBKEY from a SQL Table Procedure

Discussion created by ca.portal.admin on Jul 3, 2007
Cal Domingue at CA tech support found the sample code related to another
client's similar problem from a while back. He says it's the way LE
COBOL works with moves between COMP and character fields that causes
differing results. If you implement this code it should not be necessary
to use the TRUNC(BIN) option on your compile.

I tried this in one of my table procedures and it appears to work OK.
Thanks to all who replied with their suggestions.

01 WS-MISC.
05 WS-THE-DB-KEY-TO-CONVERT.
10 WS-THE-PAGE-YOU-WANT PIC X(03).
10 WS-THE-LINE-YOU-WANT PIC X(01).
05 WS-THE-BINARY-PAGE PIC S9(08) COMP SYNC VALUE 0.
05 FILLER REDEFINES WS-THE-BINARY-PAGE.
10 FILLER PIC X(01).
10 WS-THE-CONVERTED-PAGE PIC X(03).
05 WS-THE-BINARY-LINE PIC S9(04) COMP SYNC VALUE 0.
05 FILLER REDEFINES WS-THE-BINARY-LINE.
10 FILLER PIC X(01).
10 WS-THE-CONVERTED-LINE PIC X(01).
05 WS-DECIMAL-PAGE-NBR PIC 9(08) VALUE 0.
05 WS-DECIMAL-LINE-NBR PIC 9(02) VALUE 0.

..................

ACCEPT WS-THE-DB-KEY-TO-CONVERT FROM TBLDTL CURRENCY.
MOVE WS-THE-PAGE-YOU-WANT TO WS-THE-CONVERTED-PAGE.
MOVE WS-THE-LINE-YOU-WANT TO WS-THE-CONVERTED-LINE.
MOVE WS-THE-BINARY-PAGE TO WS-DECIMAL-PAGE-NBR.
MOVE WS-THE-BINARY-LINE TO WS-DECIMAL-LINE-NBR.

Outcomes