Highlighted
Absent Member.
Absent Member.
5010 views

How to form XFD index from Cobol Data File

I've recently working on a project to form a index in manually in XFD file 
From Acucobol Vision file. 

Can someone who understand what is mean by first index, second index, condition and the rest. 

My XFD structure form manual where I found but I still doesn't understand from its structure.Can someone explain for me in details for below 

Code:

# This xfd layout is a generic one suitable for accessing any 
# .DAD file. However, it needs to be copied and amended for each 
# DAD file that you wish to get access to. 
# The simplest scenario is that you copy dad.xfd to a new file 
# with the same name as the database you wish to access and extension .XFD 
# Then edit this new file and replace the two instances of 'FILE' with the 
# filename that you want to access. e.g. if you want to have ODBC access to 
# icvc.dad then copy dad.xfd to new file icvc.xfd and change line 
#   XFD,02,FILE,FILE            to be 
#   XFD,02,ICVC,ICVC 

# If this doesn't work then the database file you are trying to access has 
# probably set different values for search index sizes. The easiest way to 
# check this is to run $list for the database that you want to access and 
# note down all the key information that it gives. If that is different 
# to the key info in this file then you need to modify the xfd file to match 
# In the current xfd there are four indexes defined. In all cases the first 
# index will be correct and so should the third index. However, the other 
# two may need to be modified or removed if not present. 
# Index 4 is optional and is not present if the database is rebuilt without 
# the fast list option. 
# explaining the details of 2nd index. 1 st line consists of 8 values separated 
# by commas. The first value of 3 is how many segments the index consists of. 
# second value 1 means duplicates allowed (0 means NO DUPS). 
# The remaining six fields are three pairs of key size and byte offset, e.g. 
# first index segment is 4 bytes long and starts from byte 4, second index 
# segment is 20 bytes long and starts from byte 21 etc. 
# The second line specifies how many field names there are to follow and lines 3 
# to 5 are the three field names as defined lower in this xfd. For instance 
# if you look at field D1UNIQ you will see it is defined as starting from byte 0 
# and is 4 bytes long. This corresponds to the values entered in the key definition. 

XFD,02,ICVC,ICVC 
00300,00041,004 
# [Key Section] 
# [1st index] 
01,0,013,00000 
04 
D1UNIQ 
D1NAME 
D1NAMX 
D1OCCU 
# [2nd index] 
3,1,004,00004,020,00021,004,00000 
03 
D1NAME 
D1TUPP 
D1UNIQ 
# [3rd index] 
3,1,004,00004,008,00013,004,00000 
03 
D1NAME 
D1NUMB 
D1UNIQ 
# [4th index] 
1,1,020,00021 
01 
D1TUPP 
# [Condition Section] 
000 
# [Field Section] 
0015,00015,00016 
00000,00013,16,00013,+00,000,999,D1KEY 
00000,00004,12,00009,+00,000,000,D1UNIQ 
00004,00004,16,00004,+00,000,000,D1NAME 
00008,00001,16,00001,+00,000,000,D1NAMX 
00009,00004,12,00009,+00,000,000,D1OCCU 
00013,00008,11,00018,-06,000,000,D1NUMB 
00021,00040,16,00040,+00,000,000,D1TUPP 
00061,00001,01,00001,+00,000,000,D1GRAD 
00062,00004,12,00008,+00,000,000,D1DLUP 
00066,00004,12,00008,+00,000,000,D1TLUP 
00070,00004,16,00004,+00,000,000,D1OLUP 
00074,00001,16,00001,+00,000,000,D1TYPE 
00075,00002,16,00002,+00,000,000,D1FORM 
00077,00160,16,00160,+00,000,000,D1TEXT 
00237,00001,16,00001,+00,000,000,D1PRIN 
00238,00062,16,00062,+00,000,000,D1FILL 



I knowed Acucorp come out with one tool known as Acucorp Indexed file record editor, short form is named as alfred. I know it will used to check out structure of cobol data file. By the way, is that have any replacement tool or other free record editor which can help us to inspect record format of cobol data file? 

Thanks if anyone could help my question.

Tags (1)
0 Likes
7 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How to form XFD index from Cobol Data File

An indexed file can contain many keys ..a primary key and alternate keys (2nd index, 3rd index), COBOL record layouts also support a redefine .. Chapter 5: Data Division > 5.7 Record Description Entry > 5.7.1 Data Description Entry >  5.7.1.3 REDEFINES clause

I take it that you have COBOL data but not the original source for the COBOL program. What you are attempting to do is very difficult as many of your fields in the data file can have comp values, comp-3 or comp-5 or others. If you open up the data file in an editor like notepad and after the header information, if you see characters that seem odd then it is likely the data has some sort of comp value on it.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: How to form XFD index from Cobol Data File

Hi shjerpe,

     Thanks for your reply. I did to include my further tried on testing. I've success to discovered it is possible to export cobol data in well arrange sequentail line format by using commands " vutil32.exe -unload -t xxx xxx-new", then using "notepad++" to open xxx-new file where you can see those record file will be well arrange in sequential line format. My problem is that How I could track down the format from this export output to form a coordinate mapping on XFD file. You have idea on how to do this?TQ in advance.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How to form XFD index from Cobol Data File

I anticipate that not all of the data in the sequential file is readable, that there are characters, that are probably ASCII characters but not readable. these are the areas within the file where fields were more than likely comp values. you will need to do a lot of trial and error to figure out the field size as well as which comp value was used. Vutil -info on the file can provide some other details, but it won't tell you which fields are comp and which comp was used.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: How to form XFD index from Cobol Data File

Hi shjerpe,

    With the following XFD where I've generated from you system but it is totally uncorrect. The filename is POTE and it need further modification. I tried to link this XFD file in query but failed

POTE.XFD code:

XFD,02,POTE,POTE

00026,00018,002

1,0,008,00000

02

INTIND-UNIQ

INTIND-OCC

1,1,010,00008

01

IND16

000

0004,00004

00000,00004,12,00009,+00,000,000,INTIND-UNIQ

00004,00004,12,00009,+00,000,000,INTIND-OCC

00008,00010,16,00010,+00,000,000,IND16

00018,00008,16,00008,+00,000,000,TERM20

  Beside this I take a real time analysis to my pote data files under system by using LIST commands, Then the anaylsis result is came out like belows:

Anaylsis Result:

Max Record length 300

Min record length 61

No of records 466

Blocking factor 1

Preallocation amount 0

Extension amount 1

Compression factor 80

Encrypted ? No

Number of keys 4

Primary key has 1 segments

key size 13 offset 0

[SPACE]

key 02 has 3 segments

Duplicates Are allowed

Key size 4 offset 4

Key size 40 offset 21

Key size 4 offset 0

[SPACE]

Key 03 has 3 segments

Duplicates Are allowed

Key size 4 offset 4

Key size 8 offset 13

Key size 4 offset 0

[SPACE]

Key04 has 1 segment

Duplicates Are allowed

Key size 10 offset 21

Based on this analysis info, it is correct and it is real time analysis format where it is used to form XFD format in POTE.xfd file. Can you give me guide how can I do for  this? I knowed this pote cobol data file has totaly 4 fields.TQ in advanced.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How to form XFD index from Cobol Data File

I suggest that you use vutil -info -x -k pote (where pote  is the data file). The LIST analysis seems flawed .. Max Record length 300 ..Min record length 61 .. an indexed file is not likely going to have a min max record size.  If you truly have a min / max in an indexed file, then your XFD should get the first 61 bytes.

I hope this helps.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: How to form XFD index from Cobol Data File

Thanks to shjerpe,  I confirmed it is correct for max records equals as 300, minimun records equals to 61 after I issues command "vutil32 -info -x -k pote".

I finally knowed some basic structure of XFD formed but I still have another idle need your helps.

How could I knowed the FD (field Description) with its length size and occur points formed inside pote data file, perhaps is that any possible i could use vutil to extract every fields with its FD info?Thanks in advance.

0 Likes
Highlighted
Visitor.

RE: How to form XFD index from Cobol Data File

The field layout of a Vision file is NOT encoded in the file, so there is no way for vutil to extract that info.  It can only report the layout of the key fields and the overall record size.

It sounds like you don't have source code for the programs that created these files, so you're trying to reverse-engineer the structure of the data.  If you don't own this application (and its source code), perhaps you should try to contact whoever does own it to get this information.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.