Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Extracting a packed decimal data from Alphanumeric field
Goto page Previous  1, 2
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL
Author Message
Bill O'Boyle

Senior Member


Joined: 14 Jan 2008
Posts: 344
Location: Orlando, FL, USA

PostPosted: Thu Mar 27, 2008 9:54 pm    Post subject: Extracting a packed decimal data from Alphanumeric
Reply with quote

Is this a Bit-Map formatted message-area, such as a Visa, MasterCard, JCB, etc Authorisation request and you're trying to extract (parse) this data?

Just curious....

Regards,

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

Senior Member


Joined: 13 Mar 2006
Posts: 333
Location: Israel

PostPosted: Thu Mar 27, 2008 10:32 pm    Post subject:
Reply with quote

From what I understood, in the MOVE FILE(X:Y) TO TEMP-FIELD,
the part FILE(X:Y) contains exactly the comp-3 value.
If we define TEMP-FIELD-R PIC X(8) JUST RIGHT,
then we may be able to get somewhere.
After MOVE FILE(X:Y) TO TEMP-FIELD-R,
we can calculate the length of the left part (Z = 8 - Y)
and MOVE LOW-VALUES TO TEMP-FIELD-R (1:Z)
Then use a REDEFINES to have a working COMP-3 field.

Does it work? Anybody tempted to write down some code?
Back to top
View user's profile Send private message
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 8724
Location: 221 B Baker St

PostPosted: Thu Mar 27, 2008 11:23 pm    Post subject:
Reply with quote

Hello,

If i understand correctly (and i may not icon_smile.gif ), comparing the characters in the fields and reporting the differences (in hex) will provide the required output with no need to find a way to work with comp-3 data.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1506

PostPosted: Sun Mar 30, 2008 6:00 am    Post subject:
Reply with quote

Here's something that might work. The PD pseudo code looks OK (haven't tested). The BI section needs more definition by the OP.

Eg. Do the BI fld lengths limit themselves to 2, 4, 8 or can they be any lengths within the 8 byte COMP limit. If so, that raises the ques of negative binary number represtntation (hi order bits of 1).

PS. I used pic s9(18) as the limit. If arith extend is used that would change.

What say you Arav?
Code:
01  wrk-area.
    05  wrk-numeric-grp.
        wrk-pd        pic s9(18) comp-3
        wrk-bi-x      pic  x(8).
        wrk-bi        redefines
        wrk-bi-x      pic s9(18) comp.


move lo-vals to wrk-numeric-grp
eval type
when 'pd'
     compute wrk-strt = (length of wrk-pd - orig-len) + 1
     move orig-rec(orig-strt:orig-len) to wrk-pd(wrk-strt:)
       
when 'bi'
     if orig-fld is neg
        move hi-vals to bi-wrk-x
     end-if
     compute wrk-strt = (length of wrk-bi - orig-len) + 1
     move orig-rec(orig-strt:orig-len) to wrk-bi(wrk-strt:)
when 'an'
     do the easy part
end-eval
.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL All times are GMT + 6 HoursGoto page Previous  1, 2
Page 2 of 2