- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Defining an indexed FD for two different files...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2010 06:38 AM
тАО03-30-2010 06:38 AM
Defining an indexed FD for two different files.
Hi all,
I have a problem trying to define a FD indexed file. The problem is that I have two different systems and two different indexed files with diffent length, one on each system. I would like to developed a single program able to read from this file on both systems and I want to define just one FD.
I mean, something like (I am guessing 100%):
FD navigator
Organization is indexed
File status is file-stat
Record contains 15 OR 20 characters depending on wk-system
Access mode is dynamic.
01 wk-system1 pic X(15).
01 wk-system2 pic X(20).
Can I do this somehow?
Thanks in advance,
Yyrkoon.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2010 07:18 AM
тАО03-30-2010 07:18 AM
Re: Defining an indexed FD for two different files.
RECORD CONTAINS xxx TO xx CHARACTERS
or
RECORD IS VARYING IN SIZE FROM xx [ TO xx ] CHARACTERS DEPENDING on depending-name.
Next you declare your record with REDEFINE clause.
For files, you can NOT do those at 01 level.
If you'd try then you would get the message:
%COBOL-E-FILSECRED, REDEFINES clause invalid for 01 level data item in FILE SECTION - clause accepted
So you'll have to add a bonus level just for that.
The FD might end up looking something like:
FD THE-FILE external.
01 all-blah.
02 blah.
03 catch-all pic x(200).
02 redefines blah.
03 wk-system1 pic X(15).
02 redefines blah.
03 wk-system2 pic X(20).
For READING the depending on item will be SET, giving you an indication which flavor of record you read.
For WRITING you'll have to set the correct matching length.
More often than not there will be a flag field early in the record in indicate the flavor as well.
Hope this helps,
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-31-2010 01:03 AM
тАО03-31-2010 01:03 AM
Re: Defining an indexed FD for two different files.
File organization: Indexed, Prolog: 3, Using 1 key
In 2 areas
Shelved state: Online
Caching attribute: Writethrough
File attributes: Allocation: 70, Extend: 12, Maximum bucket size: 12
Global buffer count: 0, No version limit
Contiguous best try
Record format: Fixed length 37 byte records
And the other is define exactly the same but "Fixed length 42 byte records" and they MUST be like this. Am I doing something wrong or it is simply not possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-31-2010 03:47 AM
тАО03-31-2010 03:47 AM
Re: Defining an indexed FD for two different files.
I suspect you are doing something wrong, but since you did not show relevant (fragments of the) code it is hard to guess what.
>> this file (on one server) is define as follows:
File organization: Indexed, Prolog: 3, Using 1 key
Record format: Fixed length 37 byte records
>> And the other is define exactly the same but "Fixed length 42 byte records" and they MUST be like this.
Must is such a seemingly strong word.
It probably just means "we don't understand enough of the system to change this", or "we can not jsutify the cost of changing that, just to resolve the current issue"
>> Am I doing something wrong or it is simply not possible?
It works for me, so my money is on the first choice.
Here is what works for me...
OpenVMS V8.2, Alpha DS20, Compaq COBOL V2.8-1286
:
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT THE-FILE
ASSIGN TO "TEST"
RECORD KEY IS THE-KEY
ACCESS MODE IS DYNAMIC
ORGANIZATION IS INDEXED
FILE STATUS IS FILE-STATUS.
:
FD THE-FILE
RECORD IS VARYING IN SIZE FROM 4 CHARACTERS DEPENDING on depending-name.
01 THE-RECORD.
03 THE-KEY PIC X(4).
03 SOME-DATA PIC X(66).
:
WORKING-STORAGE SECTION.
01 depending-name PIC 9(9) COMP.
01 FILE-STATUS PIC XX.
:
READ THE-FILE RECORD KEY IS THE-KEY.
DISPLAY depending-name WITH CONVERSION.
As input file I used:
$ conver tt: test.dat /fdl="file; org ind; rec; form fixed; size 70; key 0; seg0_l 4"/pad="7"
aap
mies
noot
and
$ conver tt: test.dat /fdl="file; org ind; rec; form fixed; size 60; key 0; seg0_l 4"/pad="6"
Created: 31-MAR-2010 06:29:22.40
Revised: 31-MAR-2010 06:29:45.43 (2)
$
The results report 70 and 60 for the size from Cobol and "7"s and "6"s to pad the data.
Directory shows:
Record format: Fixed length 70 byte records
and
Record format: Fixed length 60 byte records
Good luck,
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-01-2010 04:43 AM
тАО04-01-2010 04:43 AM