Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cobol using computational's

Status
Not open for further replies.

symbolic

Programmer
Jan 16, 2003
3
GB
hi
i've been haveing problems with the different computational's.
i've written a time=sheet program to store 7 days into a 6 digit key(date,,, (ddmmyy)).

if i use comp-3 the program wont write any data who's date is greater than 07,, ie (081203).

if i use comp-1 then any date from 01 to 30 will be stored as one entry.

i have similar problems when using COMP.
and problems when disregarding the computational's.
can any one give detailed explainations of each of the computational's including COMP, and also what happens to the data when not using the computational's.
thanks
 
Symbolic -

1. It's always helpful to know your platform and compiler with version (e.g. IBM MVS COBOL II)

2. What kind of file or database are these dates a key to?

3. Can you provide an abbreviated record layout showing the key definition and, if applicable, the associated SELECT and FD?

4. I'm not sure I understand what you mean by storing 7 days in a 6 digit key.

Use of certain kinds of data for key values is not supported in some O/S's and in some databases. This may be one of those situations. You may also be defining your key value one way and the key data a different way (e.g. key is defined as varchar in the D/B but you're using comp in the record you're trying to write).

Regards,

Glenn
 
i am using utah cobol with the btreive package.



environment division.
select """ assign to disk
organization is relative
access is sequential
relative key is w-key.

data division.
configuration section.
input-output section.
file control.
fd """""
label records are standard
value of file-id is ("""".dat).
01 file-store.
02 f-date pic 9(6).
02 f-store pic x(168).
02 f-tot pic 999v99.

working-storage.
01 w-key pic 9(6).
01 w-date pic 9(6).
01 w-store pic x(168).
01 w-out redefines w-store.
02 w-day pic x(24) occurs 6 times.
01 w-tot pic 999v99.


w-store and w-tot are stored with the date... <this being the key.

to access the information the .dat file is searched for using the invalid key clause.
 
Hi symbolic,
IU'm not familiar with your version of Cobol but it may be to do with the compile options TRUNC(BIN/OPT/STD). Have a look at Thread209-319782 and see if this helps.
Marc
 
symbolic -

I'm not sure how btrieve relates to the SELECT/FD that you've shown. It appears that the file has no COBOL name, so I don't know how you OPEN, WRITE, etc.

For standard, relative record files, the record key must be the absolute record number of the record in the file. E.g. the first record has a relative key of 1, the next record is relative key 2. That's not conducive to using dates as a key. I think you want a file that's ORGANIZATION INDEXED to use dates as keys.

Glenn
 
I dont see why you cant get it to work. We use ssn as a key and pack it into a comp-3 and redefine it as a 5 character field using IBM Mainframe COBOL LE. We also switch the numbers around and store them as 6789123456 so they store and sort easier. Might be easier to order these as yymmdd.

We use organization is indexed.

On my IBM MAINFRAME MANUAL it says the maximum length of a non-numeric literal is 160 Characters.

There may be system or database or compiler options for the sequence pattern for how the date is stored that does not match up. If you do not like my post feel free to point out your opinion or my errors.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top