I am getting a file error status 39 when opening an indexed file.
I need to rebuild the file. Where do I get Rebuild.exe?
Many thanks
Shirley
I am getting a file error status 39 when opening an indexed file.
I need to rebuild the file. Where do I get Rebuild.exe?
Many thanks
Shirley
I am getting a file error status 39 when opening an indexed file.
I need to rebuild the file. Where do I get Rebuild.exe?
Many thanks
Shirley
rebuild.exe is in the bin folder of both the Visual COBOL and the COBOL Server product in stalls:
c:\\program files (x86)\\micro focus\\visual cobol\\bin
c:\\program files (x86)\\micro focus\\cobol server\\bin
If you open up a Visual COBOL 32-bit command prompt from the Start menu you should be able to run it and it will be found in the PATH.
But a file status 39 does not normally mean that a file has become corrupt. It normally means that the program that is trying to open the file has it defined differently than it really is. This can mean record size or key position, number of keys, length of keys etc.
This can be caused by not using the correct set of compiler directives also. If you can open the file in one program but not a different program then you should look at the compiler directives or perhaps the version of the copyfile that is in use to define the file.
If you run rebuild /n against the file it will report the record length and other attributes of the file.
rebuild.exe is in the bin folder of both the Visual COBOL and the COBOL Server product in stalls:
c:\\program files (x86)\\micro focus\\visual cobol\\bin
c:\\program files (x86)\\micro focus\\cobol server\\bin
If you open up a Visual COBOL 32-bit command prompt from the Start menu you should be able to run it and it will be found in the PATH.
But a file status 39 does not normally mean that a file has become corrupt. It normally means that the program that is trying to open the file has it defined differently than it really is. This can mean record size or key position, number of keys, length of keys etc.
This can be caused by not using the correct set of compiler directives also. If you can open the file in one program but not a different program then you should look at the compiler directives or perhaps the version of the copyfile that is in use to define the file.
If you run rebuild /n against the file it will report the record length and other attributes of the file.
Hi Chris
Thanks so much.
It is running fine on the old MS-DOS environment. (Written in 1995!!!)
So I hoping rebuild.exe would give me a bit more info which I have found where you said it would be. (Thanks)
If I am building in Visual Studio 2017 are the compiler directives in properties/COBOL?
Hi Chris
Thanks so much.
It is running fine on the old MS-DOS environment. (Written in 1995!!!)
So I hoping rebuild.exe would give me a bit more info which I have found where you said it would be. (Thanks)
If I am building in Visual Studio 2017 are the compiler directives in properties/COBOL?
Compiler directives can be in a number of places. 
1. Directly in the program source code via $SET statement
2. Program level properties, right-click on source file in solution explorer-->Properties
3. Project Properties page on the COBOL tab.
4. In a user-defined directive files pointed to by the USE or DIR directives
5. In an external COBOL.DIR file that resides in the project folder 
What product did you use previously, Net Express or something earlier like Workbench?
If your NX/Workbench system used a COBOL.DIR file then you should bring this to Visual COBOL and use this also. Compare the directives used previously with VC.
If you compile with the LIST and SETTINGS directives on it will include all of the directives being picked up and list them in the source listing file. This should work for you older product builds as well.
Compiler directives can be in a number of places. 
1. Directly in the program source code via $SET statement
2. Program level properties, right-click on source file in solution explorer-->Properties
3. Project Properties page on the COBOL tab.
4. In a user-defined directive files pointed to by the USE or DIR directives
5. In an external COBOL.DIR file that resides in the project folder 
What product did you use previously, Net Express or something earlier like Workbench?
If your NX/Workbench system used a COBOL.DIR file then you should bring this to Visual COBOL and use this also. Compare the directives used previously with VC.
If you compile with the LIST and SETTINGS directives on it will include all of the directives being picked up and list them in the source listing file. This should work for you older product builds as well.
One of our Support Engineers here recommends that you look into using the NOKEYCHECK directive for compilation.
Alternatively you can set the NOKEYCHECK option in the EXTFH.CFG file.
| Problem | 
| When using the directive KEYCHECK, each key definition must be stated and must match. If this is not the case then a 39 file status error is returned. | 
| Resolution | 
| However, with NOKEYCHECK set, the File Handler opens the file without any checks on key definitions and the 39 file status error is not returned. | 
One of our Support Engineers here recommends that you look into using the NOKEYCHECK directive for compilation.
Alternatively you can set the NOKEYCHECK option in the EXTFH.CFG file.
| Problem | 
| When using the directive KEYCHECK, each key definition must be stated and must match. If this is not the case then a 39 file status error is returned. | 
| Resolution | 
| However, with NOKEYCHECK set, the File Handler opens the file without any checks on key definitions and the 39 file status error is not returned. | 
Hi Chris
Any idea where I can find the EXTFH.CFG file?
I can find a EXTFH.lng but not the former.
Thanks
Shirley
Hi Chris
Any idea where I can find the EXTFH.CFG file?
I can find a EXTFH.lng but not the former.
Thanks
Shirley
Hi Chris
I ran the rebuild/n and this is the result
And this is the file layout. I can't find anything wrong.
* FD NAME = CSFSURVY *
* COPYBOOK NAME = CSFSURVY.REC (ISAM) *
*----------------------------------------------------------------*
01 CFS-SURVY-REC.
05 CFS-KEY.
10 CFS-JOBNO PIC X(6).
10 CFS-JOBNO-RE REDEFINES CFS-JOBNO.
15 CFS-INDUS PIC X(5).
15 CFS-JOB-TYPE PIC X(1).
10 CFS-REC-TYPE PIC 9.
10 CFS-LOCATION.
15 CFS-PROVINCE PIC XX.
15 CFS-CITY PIC XX.
15 CFS-AREA PIC XX.
* Survey date = CCYYMM
05 CFS-SURVEY-DATE PIC 9(6).
05 CFS-TOT-INCUM PIC S9(5) COMP-3.
05 CFS-LO-SALARY PIC S9(7)V99 COMP-3.
05 CFS-HI-SALARY PIC S9(7)V99 COMP-3.
05 CFS-AV-SALARY PIC S9(7)V99 COMP-3.
05 CFS-LO-PACKAG PIC S9(9) COMP-3.
05 CFS-HI-PACKAG PIC S9(9) COMP-3.
05 CFS-AV-PACKAG PIC S9(9) COMP-3.
05 CFS-13-INCUM PIC S9(5) COMP-3.
05 CFS-SURVEY-DATA.
11160 07 CFS-SURVEY-SALARY-DATA OCCURS 20.
10 CFS-SALARY PIC S9(7)V99 COMP-3.
10 CFS-PACKAG PIC S9(7) COMP-3.
10 CFS-PERC-INCUM PIC S9(3) COMP-3.
* 07 CFS-DETAILS-DATA OCCURS 4.
10 CFS-SEX.
15 CFS-MALES PIC S9(3) COMP-3.
15 CFS-FEMALES PIC S9(3) COMP-3.
10 CFS-CLASS.
15 CFS-ASIAN PIC S9(3) COMP-3.
15 CFS-BLACK PIC S9(3) COMP-3.
15 CFS-COLOR PIC S9(3) COMP-3.
15 CFS-WHITE PIC S9(3) COMP-3.
10 CFS-AGE.
15 CFS-LT25 PIC S9(3) COMP-3.
15 CFS-LT35 PIC S9(3) COMP-3.
15 CFS-LT45 PIC S9(3) COMP-3.
15 CFS-GT45 PIC S9(3) COMP-3.
* As per the SIX from the Header Record
10 CFS-JOB-GRADES.
15 CFS-JOB-GRADE OCCURS 6.
20 CFS-GRADES OCCURS 5.
25 CFS-INCUM PIC S9(3) COMP-3.
10 CFS-BENEFITS OCCURS 10.
15 CFS-CASH PIC S9(7) COMP-3.
15 CFS-CASH-INCUM PIC S9(3) COMP-3.
15 CFS-NON-CASH PIC S9(7) COMP-3.
15 CFS-NON-CASH-INCUM PIC S9(3) COMP-3.
05 FILLER PIC X(78).
Hi Chris
I ran the rebuild/n and this is the result
And this is the file layout. I can't find anything wrong.
* FD NAME = CSFSURVY *
* COPYBOOK NAME = CSFSURVY.REC (ISAM) *
*----------------------------------------------------------------*
01 CFS-SURVY-REC.
05 CFS-KEY.
10 CFS-JOBNO PIC X(6).
10 CFS-JOBNO-RE REDEFINES CFS-JOBNO.
15 CFS-INDUS PIC X(5).
15 CFS-JOB-TYPE PIC X(1).
10 CFS-REC-TYPE PIC 9.
10 CFS-LOCATION.
15 CFS-PROVINCE PIC XX.
15 CFS-CITY PIC XX.
15 CFS-AREA PIC XX.
* Survey date = CCYYMM
05 CFS-SURVEY-DATE PIC 9(6).
05 CFS-TOT-INCUM PIC S9(5) COMP-3.
05 CFS-LO-SALARY PIC S9(7)V99 COMP-3.
05 CFS-HI-SALARY PIC S9(7)V99 COMP-3.
05 CFS-AV-SALARY PIC S9(7)V99 COMP-3.
05 CFS-LO-PACKAG PIC S9(9) COMP-3.
05 CFS-HI-PACKAG PIC S9(9) COMP-3.
05 CFS-AV-PACKAG PIC S9(9) COMP-3.
05 CFS-13-INCUM PIC S9(5) COMP-3.
05 CFS-SURVEY-DATA.
11160 07 CFS-SURVEY-SALARY-DATA OCCURS 20.
10 CFS-SALARY PIC S9(7)V99 COMP-3.
10 CFS-PACKAG PIC S9(7) COMP-3.
10 CFS-PERC-INCUM PIC S9(3) COMP-3.
* 07 CFS-DETAILS-DATA OCCURS 4.
10 CFS-SEX.
15 CFS-MALES PIC S9(3) COMP-3.
15 CFS-FEMALES PIC S9(3) COMP-3.
10 CFS-CLASS.
15 CFS-ASIAN PIC S9(3) COMP-3.
15 CFS-BLACK PIC S9(3) COMP-3.
15 CFS-COLOR PIC S9(3) COMP-3.
15 CFS-WHITE PIC S9(3) COMP-3.
10 CFS-AGE.
15 CFS-LT25 PIC S9(3) COMP-3.
15 CFS-LT35 PIC S9(3) COMP-3.
15 CFS-LT45 PIC S9(3) COMP-3.
15 CFS-GT45 PIC S9(3) COMP-3.
* As per the SIX from the Header Record
10 CFS-JOB-GRADES.
15 CFS-JOB-GRADE OCCURS 6.
20 CFS-GRADES OCCURS 5.
25 CFS-INCUM PIC S9(3) COMP-3.
10 CFS-BENEFITS OCCURS 10.
15 CFS-CASH PIC S9(7) COMP-3.
15 CFS-CASH-INCUM PIC S9(3) COMP-3.
15 CFS-NON-CASH PIC S9(7) COMP-3.
15 CFS-NON-CASH-INCUM PIC S9(3) COMP-3.
05 FILLER PIC X(78).
EXTFH.CFG is a text file that you have to create with any text editor. There is no default version. You can place it in the same folder as your executable or you can set the environment variable EXTFH to point to it.
When I copy your record description into a program and create a select based on the rebuild information the record size is not what is shown in your rebuild output.
You show a record size of 1153 and mine shows a record size of 4353.
Because of the formatting of your record in the post it is hard to tell if some of the lines are commented out. I am assuming that the following line is the only one commented?
* 07 CFS-DETAILS-DATA OCCURS 4.
With that commented the record size is 4353 which does not correspond to the file you are trying to open.
Try the following and do a rebuild on testfile.dat to see what I mean:
identification division. program-id. Program1. environment division. $set datacompress"1" $set idxformat"3" select csfsurvy assign to "testfile.dat" organization is indexed access is dynamic record key is cfs-key file status is file-status. configuration section. data division. file section. FD CSFSURVY. 01 CFS-SURVY-REC. 05 CFS-KEY. 10 CFS-JOBNO PIC X(6). 10 CFS-JOBNO-RE REDEFINES CFS-JOBNO. 15 CFS-INDUS PIC X(5). 15 CFS-JOB-TYPE PIC X(1). 10 CFS-REC-TYPE PIC 9. 10 CFS-LOCATION. 15 CFS-PROVINCE PIC XX. 15 CFS-CITY PIC XX. 15 CFS-AREA PIC XX. * Survey date = CCYYMM 05 CFS-SURVEY-DATE PIC 9(6). 05 CFS-TOT-INCUM PIC S9(5) COMP-3. 05 CFS-LO-SALARY PIC S9(7)V99 COMP-3. 05 CFS-HI-SALARY PIC S9(7)V99 COMP-3. 05 CFS-AV-SALARY PIC S9(7)V99 COMP-3. 05 CFS-LO-PACKAG PIC S9(9) COMP-3. 05 CFS-HI-PACKAG PIC S9(9) COMP-3. 05 CFS-AV-PACKAG PIC S9(9) COMP-3. 05 CFS-13-INCUM PIC S9(5) COMP-3. 05 CFS-SURVEY-DATA. 07 CFS-SURVEY-SALARY-DATA OCCURS 20. 10 CFS-SALARY PIC S9(7)V99 COMP-3. 10 CFS-PACKAG PIC S9(7) COMP-3. 10 CFS-PERC-INCUM PIC S9(3) COMP-3. * 07 CFS-DETAILS-DATA OCCURS 4. 10 CFS-SEX. 15 CFS-MALES PIC S9(3) COMP-3. 15 CFS-FEMALES PIC S9(3) COMP-3. 10 CFS-CLASS. 15 CFS-ASIAN PIC S9(3) COMP-3. 15 CFS-BLACK PIC S9(3) COMP-3. 15 CFS-COLOR PIC S9(3) COMP-3. 15 CFS-WHITE PIC S9(3) COMP-3. 10 CFS-AGE. 15 CFS-LT25 PIC S9(3) COMP-3. 15 CFS-LT35 PIC S9(3) COMP-3. 15 CFS-LT45 PIC S9(3) COMP-3. 15 CFS-GT45 PIC S9(3) COMP-3. * As per the SIX from the Header Record 10 CFS-JOB-GRADES. 15 CFS-JOB-GRADE OCCURS 6. 20 CFS-GRADES OCCURS 5. 25 CFS-INCUM PIC S9(3) COMP-3. 10 CFS-BENEFITS OCCURS 10. 15 CFS-CASH PIC S9(7) COMP-3. 15 CFS-CASH-INCUM PIC S9(3) COMP-3. 15 CFS-NON-CASH PIC S9(7) COMP-3. 15 CFS-NON-CASH-INCUM PIC S9(3) COMP-3. 05 FILLER PIC X(78). working-storage section. 01 file-status pic x(2) value spaces. procedure division. open output CSFSURVY display file-status move all "1" to CFS-SURVY-REC write CFS-SURVY-REC invalid key display "bad write = " file-status end-write move all "2" to CFS-SURVY-REC write CFS-SURVY-REC invalid key display "bad write = " file-status end-write close csfsurvy goback. end program Program1.EXTFH.CFG is a text file that you have to create with any text editor. There is no default version. You can place it in the same folder as your executable or you can set the environment variable EXTFH to point to it.
When I copy your record description into a program and create a select based on the rebuild information the record size is not what is shown in your rebuild output.
You show a record size of 1153 and mine shows a record size of 4353.
Because of the formatting of your record in the post it is hard to tell if some of the lines are commented out. I am assuming that the following line is the only one commented?
* 07 CFS-DETAILS-DATA OCCURS 4.
With that commented the record size is 4353 which does not correspond to the file you are trying to open.
Try the following and do a rebuild on testfile.dat to see what I mean:
identification division. program-id. Program1. environment division. $set datacompress"1" $set idxformat"3" select csfsurvy assign to "testfile.dat" organization is indexed access is dynamic record key is cfs-key file status is file-status. configuration section. data division. file section. FD CSFSURVY. 01 CFS-SURVY-REC. 05 CFS-KEY. 10 CFS-JOBNO PIC X(6). 10 CFS-JOBNO-RE REDEFINES CFS-JOBNO. 15 CFS-INDUS PIC X(5). 15 CFS-JOB-TYPE PIC X(1). 10 CFS-REC-TYPE PIC 9. 10 CFS-LOCATION. 15 CFS-PROVINCE PIC XX. 15 CFS-CITY PIC XX. 15 CFS-AREA PIC XX. * Survey date = CCYYMM 05 CFS-SURVEY-DATE PIC 9(6). 05 CFS-TOT-INCUM PIC S9(5) COMP-3. 05 CFS-LO-SALARY PIC S9(7)V99 COMP-3. 05 CFS-HI-SALARY PIC S9(7)V99 COMP-3. 05 CFS-AV-SALARY PIC S9(7)V99 COMP-3. 05 CFS-LO-PACKAG PIC S9(9) COMP-3. 05 CFS-HI-PACKAG PIC S9(9) COMP-3. 05 CFS-AV-PACKAG PIC S9(9) COMP-3. 05 CFS-13-INCUM PIC S9(5) COMP-3. 05 CFS-SURVEY-DATA. 07 CFS-SURVEY-SALARY-DATA OCCURS 20. 10 CFS-SALARY PIC S9(7)V99 COMP-3. 10 CFS-PACKAG PIC S9(7) COMP-3. 10 CFS-PERC-INCUM PIC S9(3) COMP-3. * 07 CFS-DETAILS-DATA OCCURS 4. 10 CFS-SEX. 15 CFS-MALES PIC S9(3) COMP-3. 15 CFS-FEMALES PIC S9(3) COMP-3. 10 CFS-CLASS. 15 CFS-ASIAN PIC S9(3) COMP-3. 15 CFS-BLACK PIC S9(3) COMP-3. 15 CFS-COLOR PIC S9(3) COMP-3. 15 CFS-WHITE PIC S9(3) COMP-3. 10 CFS-AGE. 15 CFS-LT25 PIC S9(3) COMP-3. 15 CFS-LT35 PIC S9(3) COMP-3. 15 CFS-LT45 PIC S9(3) COMP-3. 15 CFS-GT45 PIC S9(3) COMP-3. * As per the SIX from the Header Record 10 CFS-JOB-GRADES. 15 CFS-JOB-GRADE OCCURS 6. 20 CFS-GRADES OCCURS 5. 25 CFS-INCUM PIC S9(3) COMP-3. 10 CFS-BENEFITS OCCURS 10. 15 CFS-CASH PIC S9(7) COMP-3. 15 CFS-CASH-INCUM PIC S9(3) COMP-3. 15 CFS-NON-CASH PIC S9(7) COMP-3. 15 CFS-NON-CASH-INCUM PIC S9(3) COMP-3. 05 FILLER PIC X(78). working-storage section. 01 file-status pic x(2) value spaces. procedure division. open output CSFSURVY display file-status move all "1" to CFS-SURVY-REC write CFS-SURVY-REC invalid key display "bad write = " file-status end-write move all "2" to CFS-SURVY-REC write CFS-SURVY-REC invalid key display "bad write = " file-status end-write close csfsurvy goback. end program Program1.Hi Chris
When I run either rebuild or rebuild/n I get the error message
REBUILD aborted - File type requires use of o option
Hi Chris
When I run either rebuild or rebuild/n I get the error message
REBUILD aborted - File type requires use of o option
Can you be more specific?
What is the full command that you are trying to run?
Are you trying to run it against the file created in my program?
Are you running the command from a VC command prompt?
Can you be more specific?
What is the full command that you are trying to run?
Are you trying to run it against the file created in my program?
Are you running the command from a VC command prompt?
Hi Chris
I am running from a DOS prompt.
REBUILD testfile.dat, testfileout.dat or
REBUILD/n testfile.dat
I'm guessing from your question that I need to run from a VC prompt?
Can you be more specific?
What is the full command that you are trying to run?
Are you trying to run it against the file created in my program?
Are you running the command from a VC command prompt?
By the way I complied the program using GNUCOBOL
By the way I complied the program using GNUCOBOL
Why would you compile with GNUCOBOL? In order to create a Micro Focus Indexed file you need to compile with a MF product.
This is why you are getting the rebuild error. rebuild only works with MF supported indexed file types. Please compile with Visual COBOL.
Why would you compile with GNUCOBOL? In order to create a Micro Focus Indexed file you need to compile with a MF product.
This is why you are getting the rebuild error. rebuild only works with MF supported indexed file types. Please compile with Visual COBOL.
Hi Chris
Yes I see exactly what you mean.
Now I need to look at these old programs and try to figure out why there is such a discrepancy.
Thank you so much for your help
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.