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
 

 

comp value stored in x(01)

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

Active User


Joined: 08 Dec 2005
Posts: 127
Location: rochester

PostPosted: Thu Dec 29, 2005 9:42 pm    Post subject: comp value stored in x(01)
Reply with quote

An input file has a field at the end of record defined as
01 rec...
05 ..
....
05 chg-cnt pic x(01).

when i open the file in file-aid and looked at the 'change count' data.. it is showing invalid.

if i do hex on

i am seeing comp values like x'21' x'C3' x'1C' in different records.

it is looking like a hex value (comp value) store in the one byte field. How is it possible to store a hex value in alpha 1-char. if a field is defined as comp then it requires minimum 2 bytes.

my program is not using that field but curious to know.
Back to top
View user's profile Send private message

muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Thu Dec 29, 2005 9:55 pm    Post subject: Re: comp value stored in x(01)
Reply with quote

hi,

the field might not be initialized so it must be containing low values.
just initialize the field to spaces and check the result.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Dec 30, 2005 5:23 am    Post subject:
Reply with quote

You can store a count in that 1 byte field as long as your count doesn't exceed 255. If you need to mannipulate the field you can do something like this:
Code:

05 chg-cnt pic x(01).
05 cmp-cnt pic 9(02) comp value zeros.
05 cmp-cnt-x   redefines
   cmp-cnt pic x(02). 


move chg-cnt to cmp-cnt-x(2:)
add 3 to cmp-cnt
.
.
move cmp-cnt-x(2:) to chg-cnt


Why did they do it? Who knows? Maybe it was in a file w/a trillion recs and saving 1 byte per made sense. icon_rolleyes.gif
Back to top
View user's profile Send private message
raghunathns

Active User


Joined: 08 Dec 2005
Posts: 127
Location: rochester

PostPosted: Fri Jan 06, 2006 3:58 pm    Post subject: Hi Jack
Reply with quote

thats cool. working man.. g8.
Back to top
View user's profile Send private message
kiran_65

New User


Joined: 01 Apr 2005
Posts: 46

PostPosted: Tue Oct 03, 2006 4:51 pm    Post subject: initialize
Reply with quote

can we initialize a condition name feild.

for example,

01 taste pic x.
88 sweet value 's'.
88 bitter value 'b'.

initialize taste

please clarify the above doubt
Back to top
View user's profile Send private message
raghunathns

Active User


Joined: 08 Dec 2005
Posts: 127
Location: rochester

PostPosted: Tue Oct 03, 2006 6:54 pm    Post subject: initialize
Reply with quote

there is no problem .. you can initialize 'taste' field.
Back to top
View user's profile Send private message
kiran_65

New User


Joined: 01 Apr 2005
Posts: 46

PostPosted: Wed Oct 04, 2006 1:05 pm    Post subject: initialize
Reply with quote

Thanks for the reply.

what will be the value of taste if initialize.

whether it will be space or 's' or 'b'

thanks,
Kiran
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Oct 04, 2006 10:40 pm    Post subject: Re: comp value stored in x(01)
Reply with quote

Kiran,

the value in 'taste' will be a space after you use 'INITIALIZE TASTE'

If you want the vale to be 's' or 'b'

you can

"MOVE 's' to taste"
or
"SET SWEET to TRUE"

Dave
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 Query on DB2 WLM stored procedures ashek15 DB2 8 Sun Feb 12, 2017 11:13 pm
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts Access SQLCA fields inside a stored p... gangapd DB2 6 Thu Oct 27, 2016 10:20 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm


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