Support COBUG |
|
 |
|
 |
|
|
| |
|
COBOL Language [
return
] |
|
From |
Message |
Simon
1/30/2006 13:34:15
|
Subject: need help - urgent ;-)
Message: Hi folks:
I need some help. I have to solve the following problems:
1) Read a record by the Key (Client Number) and update the Address field to "Cologne".
2) A small program to read the dataset serially, and delete all the records. The dataset is called "Kunden" and contains these fields:
- Client-Number : Numeric 6 (Key)
- Name X30
- Address X30
- Tel: Numeric 10.
The file belongs to an Image database on the hp3000 called "Bestellungen".
Any help will be very much appreciated. Thanks a lot in advance!!!
Thanks,
Simon
|
nathviswa
1/30/2006 20:26:16
| RE: need help - urgent ;-)
Message: 1) Lets assume its an ORGANIZATION IS INDEXED file, otherwise it will be little difficult to do this update.
The PROCEDURE DIVISION goes as follows:
MOVE client_no_to_del TO client-no IN file-rec
READ file-name INVALID KEY
DISPLAY 'Client no. doesnt exist'
NOT INVALID KEY
MOVE 'Cologne' TO addr-field IN file-rec
REWRITE file-rec
END-READ.
2) Again lets assume its an ORGANIZATION IS INDEXED file. Otherwise DELETE is problematic.
READ-PARA.
READ file-name NEXT RECORD AT END
DISPLAY 'Delete over'
GO TO NEXT-PARA.
DELETE file-name.
GO TO READ-PARA.
NEXT-PARA.
...........
|
CodeTalker
5/04/2007 11:14:31
| RE: need help - urgent ;-)
Message: Well, this is terribly old, but in case someone should stumble along, still using an HP3000 and Image database...
Assumptions:
1) You are only serially reading the dataset and are in fact not getting records by key values.
Therefore,
Call "dbget" using database-name
dataset-name
read-mode-2
db-status
db-list-all-items
record-buffer
dummy-value.
move "Cologne" to address-field.
Call "dbupdate" using database-name
dataset-name
update-mode-1
db-status
record-buffer.
Of course you'll want to check the status of each call for a zero value.
And yes, lock your record first and then unlock afterwards.
You cannot read image datasets and check for invalid keys as they are not KSAM files. You cannot open I-O and do a read then rewrite either as they are not flat files.
Again, not likely anyone is still doing much of this anymore and you likely no longer care, but hey, someone might come along and wonder.
|
|
|
|
|
|
|
|
|
|
|
[ Go to Top of Page ]
|
|
 |
|
COBOL Forums |
Do you need COBOL help?
Let the COBUG members help you.
Post your issues!
|
 |
|
COBOL Job Resources |
Here are references to a wealth of
COBOL job resources, including job listing sites, resume preparation, and interview questions.
|
 |
|
Job and Resume Matchmaker! |
Employers submit your COBOL job openings.
Job seekers submit your resumes.
|
 |
|