View previous topic :: View next topic
|
Author |
Message |
raghunathns
Active User
Joined: 08 Dec 2005 Posts: 127 Location: rochester
|
|
|
|
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 |
|
|
muffirulz
New User
Joined: 14 Sep 2005 Posts: 74 Location: Atlanta, (USA)
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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. |
|
Back to top |
|
|
raghunathns
Active User
Joined: 08 Dec 2005 Posts: 127 Location: rochester
|
|
|
|
thats cool. working man.. g8. |
|
Back to top |
|
|
kiran_65
New User
Joined: 01 Apr 2005 Posts: 46
|
|
|
|
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 |
|
|
raghunathns
Active User
Joined: 08 Dec 2005 Posts: 127 Location: rochester
|
|
|
|
there is no problem .. you can initialize 'taste' field. |
|
Back to top |
|
|
kiran_65
New User
Joined: 01 Apr 2005 Posts: 46
|
|
|
|
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 |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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 |
|
|
|