Hi,
our company delivers the dll and exe files to our customers, which were generated with VisualCobol.
Now we would like to use newer language features like functions. Unfortunately we only get executable programs if the rdf files are also delivered.
Probably it is a directive, but no suitable one was found.
The most promising was the repository directive: https://www.microfocus.com/documentation/visual-cobol/vc60/EclWin/HRCDRHCDIR5N.html
Currently we use Native Cobol, a change to JVM Cobol is unfortunately not planned in the near future.
You shouldn't need a repository file .RDF if you do not use the REPOSITORY directive and you instead specify a prototype for the function within your sources. If you specify a prototype then that will be used as an internal repository.
Example:
id division.
function-id. CAT is prototype.
working-storage section.
linkage section.
01 result pic x(25).
01 param1 pic x(10).
01 param2 pic x(10).
procedure division using param1 param2
returning result.
end function CAT.
identification division.
program-id. testfunc2.
environment division.
repository.
function CAT.
data division.
working-storage section.
01 param1 pic x(10) value "chris".
01 param2 pic x(10) value "test".
01 result pic x(25) value spaces.
procedure division.
move function CAT(param1 param2)
to result
display result
accept result
goback.
end program testfunc2.
Function CAT:
id division.
function-id. CAT.
working-storage section.
linkage section.
01 param1 pic x(10).
01 param2 pic x(10).
01 result pic x(25).
procedure division using param1
param2
returning result.
move spaces to result
string function trim( param1) delimited by size
function trim(param2) delimited by size
into result
goback.
end function CAT.
You shouldn't need a repository file .RDF if you do not use the REPOSITORY directive and you instead specify a prototype for the function within your sources. If you specify a prototype then that will be used as an internal repository.
Example:
id division.
function-id. CAT is prototype.
working-storage section.
linkage section.
01 result pic x(25).
01 param1 pic x(10).
01 param2 pic x(10).
procedure division using param1 param2
returning result.
end function CAT.
identification division.
program-id. testfunc2.
environment division.
repository.
function CAT.
data division.
working-storage section.
01 param1 pic x(10) value "chris".
01 param2 pic x(10) value "test".
01 result pic x(25) value spaces.
procedure division.
move function CAT(param1 param2)
to result
display result
accept result
goback.
end program testfunc2.
Function CAT:
id division.
function-id. CAT.
working-storage section.
linkage section.
01 param1 pic x(10).
01 param2 pic x(10).
01 result pic x(25).
procedure division using param1
param2
returning result.
move spaces to result
string function trim( param1) delimited by size
function trim(param2) delimited by size
into result
goback.
end function CAT.Hi,
Thank you for your reply.
Unfortunately, this does not work as desired. The project can be compiled without errors, but as soon as you deliver the generated file (including the cblrtsm.dll and oopsm.dll) an runtime error occurs with following details (excerpt of full message):
error code 173, "Called program file not found in drive/directory"
Load error : file 'MY-FUNCTION'.
Hi,
Thank you for your reply.
Unfortunately, this does not work as desired. The project can be compiled without errors, but as soon as you deliver the generated file (including the cblrtsm.dll and oopsm.dll) an runtime error occurs with following details (excerpt of full message):
error code 173, "Called program file not found in drive/directory"
Load error : file 'MY-FUNCTION'.
Can you provide me with a small sample of what your function and the calling program look like so I can try to reproduce it here?
Thanks
Can you provide me with a small sample of what your function and the calling program look like so I can try to reproduce it here?
Thanks
Hi Mr. Glazier,
as requested a short example
id division.
function-id. add-tax is prototype.
environment division.
data division.
working-storage section.
linkage section.
copy "typedefs.cpy".
01 l-amount T-AMOUNT.
01 l-customer T-CUSTOMER.
01 l-result T-AMOUNT.
procedure division using l-amount l-customer returning l-result.
end function add-tax.
identification division.
program-id. test.
environment division.
configuration section.
source-computer. ibm-pc.
object-computer. ibm-pc.
special-names.
decimal-point is comma.
repository.
function add-tax
.
data division.
working-storage section.
copy "typedefs.cpy".
01 amount T-AMOUNT.
01 customer T-CUSTOMER.
linkage section.
procedure division.
steuerung section.
move low-value to customer
move 2,99 to amount
move add-tax(amount customer) to amount
exit program.
end program test.
id division.
function-id. add-tax.
environment division.
data division.
working-storage section.
copy "typedefs.cpy".
01 percent T-PERCENT.
linkage section.
01 l-amount T-AMOUNT.
01 l-customer T-CUSTOMER.
01 l-result T-AMOUNT.
procedure division using l-amount l-customer returning l-result .
move 19 to percent
if vat-exempt-yes
move zero to percent
end-if
compute l-result rounded = l-amount * ((100 + percent) / 100)
exit function.
end function add-tax.and the typedefs file
01 T-AMOUNT is typedef pic s9(7)v99 comp-5.
01 T-PERCENT is typedef pic s999v999 comp-5.
01 T-CUSTOMER is typedef.
05 vat-exempt-flag pic x.
88 vat-exempt-no value low-value.
88 vat-exempt-smb value "B".
88 vat-exempt-museum value "M".
88 vat-exempt-school value "S".
88 vat-exempt-yes value "B" "M" "S".as said: the file compiles just fine, but stops working if the extra file with the function name (add-tax.int) is not present.
Hi Mr. Glazier,
as requested a short example
id division.
function-id. add-tax is prototype.
environment division.
data division.
working-storage section.
linkage section.
copy "typedefs.cpy".
01 l-amount T-AMOUNT.
01 l-customer T-CUSTOMER.
01 l-result T-AMOUNT.
procedure division using l-amount l-customer returning l-result.
end function add-tax.
identification division.
program-id. test.
environment division.
configuration section.
source-computer. ibm-pc.
object-computer. ibm-pc.
special-names.
decimal-point is comma.
repository.
function add-tax
.
data division.
working-storage section.
copy "typedefs.cpy".
01 amount T-AMOUNT.
01 customer T-CUSTOMER.
linkage section.
procedure division.
steuerung section.
move low-value to customer
move 2,99 to amount
move add-tax(amount customer) to amount
exit program.
end program test.
id division.
function-id. add-tax.
environment division.
data division.
working-storage section.
copy "typedefs.cpy".
01 percent T-PERCENT.
linkage section.
01 l-amount T-AMOUNT.
01 l-customer T-CUSTOMER.
01 l-result T-AMOUNT.
procedure division using l-amount l-customer returning l-result .
move 19 to percent
if vat-exempt-yes
move zero to percent
end-if
compute l-result rounded = l-amount * ((100 + percent) / 100)
exit function.
end function add-tax.and the typedefs file
01 T-AMOUNT is typedef pic s9(7)v99 comp-5.
01 T-PERCENT is typedef pic s999v999 comp-5.
01 T-CUSTOMER is typedef.
05 vat-exempt-flag pic x.
88 vat-exempt-no value low-value.
88 vat-exempt-smb value "B".
88 vat-exempt-museum value "M".
88 vat-exempt-school value "S".
88 vat-exempt-yes value "B" "M" "S".as said: the file compiles just fine, but stops working if the extra file with the function name (add-tax.int) is not present.
Yes, if you compile the function as its own source file then it's executable needs to be present in order for the main program to find it. This is no different than a called subprogram. You can include the function directly in the main program's source file and then it will not require a separate add-tax.int file.
This is not what we were originally discussing. The inital post was in regards to the .RDF files being required. Your program as it is now will not even have a .RDF file generated so there is nothing additional that needs to be delivered.
Yes, if you compile the function as its own source file then it's executable needs to be present in order for the main program to find it. This is no different than a called subprogram. You can include the function directly in the main program's source file and then it will not require a separate add-tax.int file.
This is not what we were originally discussing. The inital post was in regards to the .RDF files being required. Your program as it is now will not even have a .RDF file generated so there is nothing additional that needs to be delivered.
Hmm, apart from the "typedefs" everything is in a single source code file. So I understand your answer so that there is a setting which ensures that functions come in extra files. So this should be deactivated?
And sorry about the rdf-files, there was a setting changed by someone in the meantime, so now the int-files are necessary. I had not noticed it because before as after additional files were necessary.
I will probably be able to look at it again tomorrow.
Thanks but already in advance.
Translated with www.DeepL.com/Translator (free version)