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

comp value stored in x(01)


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: Atlanta, (USA)

PostPosted: Thu Dec 29, 2005 9:55 pm
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
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Invoke stored procedure via batch JCL. DB2 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts Calling COBOL DB2 program from a COBO... COBOL Programming 2
Search our Forums:

Back to Top