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
 

 

Problem while reading packed decimal

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

New User


Joined: 14 Jun 2006
Posts: 56

PostPosted: Fri Mar 30, 2007 1:03 pm    Post subject: Problem while reading packed decimal
Reply with quote

Hi All,

I have a table for which key is state-code + target number.

Whats happening is state code is getting populated properly and I am populating the target number by moving 916 to it.

TArget number declaration is PIC S9(3) COMP-3

SOmehow i have no idea why 916 is getting stored properly.Its getting stored as 916F and ultinmately getting abended with an error in table read

Another thing what i noticed is When i move 018 to TArget number ,its getting stored properly.


Kindly advise as to what needs to be done in this regard?
Back to top
View user's profile Send private message

vin12pr
Warnings : 1

New User


Joined: 14 Jun 2006
Posts: 56

PostPosted: Fri Mar 30, 2007 1:04 pm    Post subject: Re: Problem while reading - Urgent
Reply with quote

one small correction : 916 is not getting stored properly..I appolgize.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Mar 30, 2007 1:18 pm    Post subject:
Reply with quote

X'916F' is correct for packed decimal though X'916C' would be better.
What does the 018 look like when you say it is correct?
What kind of abend do you get when you read the table?
Back to top
View user's profile Send private message
vin12pr
Warnings : 1

New User


Joined: 14 Jun 2006
Posts: 56

PostPosted: Fri Mar 30, 2007 1:55 pm    Post subject: Re: Problem while reading packed decimal
Reply with quote

It looks like '018C'
Back to top
View user's profile Send private message
vin12pr
Warnings : 1

New User


Joined: 14 Jun 2006
Posts: 56

PostPosted: Fri Mar 30, 2007 1:57 pm    Post subject: Re: Problem while reading packed decimal
Reply with quote

Here Table refers to a VSAM file which is used in CICS.Its not a DB2 table.I am getting the error "Key not found " error.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Mar 30, 2007 2:33 pm    Post subject:
Reply with quote

That is why it is not wise to use packed decimal as part of a vsam key. Vsam does not see the key as packed decimal, but just a binary string and though the sign C and F are the same, they are different.
If you need the C then make COBOL insure it is there. With TArget defined as S9(3), something like COMPUTE TArget = 916 should force COBOL to insure the sign is as needed. Maybe just MOVE +916 might work, a little experimentation and a look at the generated code can give you a sure way.
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 962
Location: Richmond, Virginia

PostPosted: Fri Mar 30, 2007 6:19 pm    Post subject:
Reply with quote

Technically, C and F are not the same.

C means positive; F means unsigned (and D means negative).

If you have S9(3) COMP-3, I have no idea why moving 916 would not give you x'916F'. Can you show us a hex screen print?

My testing shows, as expected, both MOVE and COMPUTE populate the rightmost nibble with 'C'.
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 962
Location: Richmond, Virginia

PostPosted: Fri Mar 30, 2007 6:20 pm    Post subject:
Reply with quote

CORRECTION:

I mean "... would not give you x'916C'".

Sorry.
Back to top
View user's profile Send private message
socker_dad

Active User


Joined: 05 Dec 2006
Posts: 147
Location: Columbia, MO

PostPosted: Fri Mar 30, 2007 10:49 pm    Post subject:
Reply with quote

Since the field is defined as signed, wouldn't you want to move +916 to it?
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: Sat Mar 31, 2007 12:26 am    Post subject:
Reply with quote

Hello,

As pointed out earlier - it is not a good idea to define signed packed numbers as keys. . . .

Imagine the support nightmare when the file has the same key with both the "C" sign and the "F" sign and it was intentional - to satisfy the imaginization of a "way too clever" coder. . . icon_confused.gif
Back to top
View user's profile Send private message
vin12pr
Warnings : 1

New User


Joined: 14 Jun 2006
Posts: 56

PostPosted: Mon Apr 02, 2007 3:21 pm    Post subject: Re: Problem while reading packed decimal
Reply with quote

Well Guys..Thnx a lot for your replies...the problem was due to the fact that here the table gets modified every 15 days.

916 target number data was included in the table in march 2007 and while creating the policy in CICS i was using the policy effective date as 021207.Since while reading the table,the effective date of policy is also taken in to consideration & Since my policy creation date was < then table modification date,My read of the table was unsuccesfulll..

Thanks,
VIn12pr
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 962
Location: Richmond, Virginia

PostPosted: Mon Apr 02, 2007 5:43 pm    Post subject:
Reply with quote

If the target field is defined as signed, you need not move +916 to it. Moving 916 suffices, as COBOL (and I hope any language) will store the target field as defined.
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 SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm


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