I'm pretty new to COBOL and programming and I'm having problems to create a word document from COBOL using ole object definitions.
I cant really find a good documentation for it, just some vba examples.
I got some stuff to work - creating the document, writing text, formatting the text.
Now I'm trying to add a header with an image to it - I found some vba code which I'm trying to translate:
With ActiveDocument.Sections(1).Headers _ .Item(wdHeaderFooterFirstPage).Range.InsertBefore "Sales Report"
I don't really understand it, because "headers" is not a property of sections, and also I never learned vba...
I'm using microfocus acubench 10.2.1
Current code:
working-storage section.
77 hFileSystemObject handle of FileSystemObject.
01 word-handles.
03 wrdApp handle of Application of word.
03 wrdDoc handle of Document of word.
03 sections handle of section of word.
03 myHeaderFooter handle of WdHeaderFooterIndex of word.
procedure division.
word-testing-section.
word-testing-010.
CREATE Application OF Word HANDLE IN WrdApp.
MODIFY WrdApp Documents::Add() GIVING wrdDoc.
MODIFY WrdApp #Visible = 1.
modify wrddoc #range = (0,100).
modify wrddoc #sections ::add() giving headersection.
modify wrddoc #sections(1)::#headers::
#item(wdHeaderFooterFirstPage)::#range::#insertbefore =
"Sales Report".
leads to:
D:\AcuReal\Source\testing2.cbl, line 52: Wrong number of parameters: 0 expected, 1 found
D:\AcuReal\Source\testing2.cbl, line 52: '#HEADERS' is not a property or method of 'CLASS #SECTIONS'
D:\AcuReal\Source\testing2.cbl, line 52: 'SECTIONS' must be a 'put' property or method of '#SECTIONS'
D:\AcuReal\Source\testing2.cbl, line 52: Undefined data item: #HEADERS
D:\AcuReal\Source\testing2.cbl, line 52: Verb expected, :: found
i also tried
modify WRDdoc #sections::#item(1)::
#headers::#item(#wdHeaderFooterPrimary)::#range::insertbefore"test".
D:\AcuReal\Source\testing2.cbl, line 60: Wrong number of parameters: 0 expected, 1 found
D:\AcuReal\Source\testing2.cbl, line 60: Wrong number of parameters: 0 expected, 1 found
and if i delete the parameters
D:\AcuReal\Source\testing2.cbl, line 58: Wrong number of parameters: 1 expected, 0 found
D:\AcuReal\Source\testing2.cbl, line 60: Wrong number of parameters: 1 expected, 0 found
Im pretty sure i have to use item twice with the wdHeaderFooterFirstPage parameter, but i have no idea why i get "wrong number of parameters"
Really frustrating
How can I create a word document from COBOL using ole object definitions?
Related
I am trying to confirm the sales order but I am getting error shown below. The environment is updated from CU1 to CU9 recently. I did Full Compilation and Full CIL and Incremental CIL with out errors. Can you please suggest what could be the issue?
Thanks in advance.
Error : Map object not initialized.
Stack trace
(S)\Classes\FormletterService\postJournal - line 52
(S)\Classes\FormletterService\run - line 221
(S)\Classes\FormletterService\postSalesOrderConfirmation - line 14
(S)\Classes\DictClass\callObject
(S)\Classes\SysOperationServiceController\runOperation - line 93
(S)\Classes\SysOperationServiceController\runServiceOperation - line 22
(S)\Classes\DictClass\callStatic
(S)\Classes\SysDictClass\invokeStaticMethod - line 26
(S)\Classes\SysDictClass\invokeStaticMethodIL - line 39
(S)\Classes\SysOperationRPCFrameworkService\runServiceOperation - line 5
(C)\Classes\SysOperationServiceController\runOperationWithRunAs - line 7
(C)\Classes\SysOperationServiceController\run - line 22
(C)\Classes\FormLetterServiceController\run - line 3
(C)\Classes\SalesFormLetter\run - line 95
(C)\Classes\SalesFormLetter\main - line 138
(C)\Classes\FormFunctionButtonControl\Clicked
The error is caused because the docuRefRecIdsPerJournalMap variable of class FormLetterService is not initialized. Debug method initDocuRefRecIdsPerJournalMap where this variable gets initialized and also method run where the initialization method gets called. You may also have to check classes that extend from FormLetterService and overwrite any of these methods or change the docuRefRecIdsPerJournalMap variable. Also check if you have any customizations on these classes.
Try to 'Compile forward' the base class FormletterService and afterwards do a full CIL compilation again
Hope that helps
I get the following displayed at the top of this web page...
http://hippiechickoriginals.com/product-category/manifesto-mania/
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'woocommerce_price_filter' not found or invalid function name in /home/hippiech/public_html/wp-includes/plugin.php on line 214
Warning: array_unique() expects parameter 1 to be array, null given in /home/hippiech/public_html/wp-content/plugins/woocommerce/includes/class-wc-query.php on line 370
Thank you again for your considerations.
Best regards,
Marc
i got a problem with simple cobol call - returning test program.
I am using micro focus cobol.
here are my 2 codes.
***************** CALLING PROGRAM
IDENTIFICATION DIVISION.
PROGRAM-ID. callreturning.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 VA PIC S9(8) USAGE DISPLAY.
01 VB PIC S9(8) USAGE DISPLAY.
01 VC PIC 9(4) USAGE DISPLAY value 0.
PROCEDURE DIVISION.
MOVE 1 TO VA.
MOVE 2 TO VB.
move 3 to VC.
CALL "add_two" USING VA VB returning VC.
* DISPLAY VA VB VC.
EXIT PROGRAM.
END PROGRAM callreturning.
*********CALLED PROGRAM
IDENTIFICATION DIVISION.
PROGRAM-ID. add_two.
ENVIRONMENT DIVISION.
DATA DIVISION.
LINKAGE SECTION.
01 PARM_A PIC S9(8) USAGE DISPLAY.
01 PARM_B PIC S9(8) USAGE DISPLAY.
01 PARM_C PIC 9(4) USAGE DISPLAY value 0.
PROCEDURE DIVISION USING PARM_A PARM_B returning PARM_C.
move 3 to PARM_C.
* ADD PARM_A TO PARM_B GIVING PARM_C.
goback.
END PROGRAM add_two.
CALLING program simply calls the second program with using returing value.
But when i compile both program and run, error happens.
error code: 114, pc=0, call=1, seg=0
114 Attempt to access item beyond bounds of memory (Signal 11)
Did i make a wrong code? or other problem? please help me :)
I am testing 'RETURNING' phrase
Your program compiles and works just fine if you get rid of the returning statement.
Background
01 levels defined in the linkage section are more like pointers in a C program. For normal parameters they are set by the calling program. But returning parameters will be unassigned.
The error is probably caused by trying to use an unallocated pointer.
Solution
Do not use returning as it is for working with languages like java.
Allocate storage to the return-value before using it.
See:
Microfocus Manual, Look at the returning example
IBM Manual Look at the Returning Phrase Section
Finally, returning is for working with java. Anything "type" defined on returning should be java compatible (i.e. binary-long and not 9(4)). I strongly suggest not using Returning in Cobol unless you are calling other languages.
Old Question, so i try a short Answer:
First, there is nothing wrong with using returning in MF-COBOL.
So, this is native COBOL (NetExpress as IDE, i assume). To correct ist just change the second Program:
Move PARM_C from the linkage to the working-storage section
The Procedure Division doesn't get the returning Phrase in its opening declaration. Move it instead to the goback phrase:
PROCEDURE DIVISION USING PARM_A PARM_B.
*>...
goback returning PARM_C.
I am trying to run some Xquery code in a java program and I am using the Saxon free java library for this purpose.
Now for some reason I am getting repeated "duplicate function definition" errors when I run this code-- this error is occurring for the "Functx" Xquery library which I downloaded from xqueryfunctions.com.
I dont understand what is wrong here? I am making straightforward calls to some functions in the FunctX Library.
Given below is a section of the error log- it also mentions the line numbers for the "duplicate functions"-- however, when I went to the 2 line numbers I saw that one line number corresponded to the start of that function, while the other line number closed that function.
The library that I am using is at this URL--
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.com/functx-1.0.xq
A section of the error log is given below--
Error on line 2488 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...ion the duration :) declare#:
Duplicate definition of function functx:total-days-from-duration (see line 2
484 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Error on line 2502 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...ion the duration :) declare#:
Duplicate definition of function functx:total-hours-from-duration (see line
2498 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Error on line 2516 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...ion the duration :) declare#:
Duplicate definition of function functx:total-minutes-from-duration (see lin
e 2512 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Error on line 2530 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...ion the duration :) declare#:
Duplicate definition of function functx:total-months-from-duration (see line
2526 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Error on line 2544 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...ion the duration :) declare#:
Duplicate definition of function functx:total-seconds-from-duration (see lin
e 2540 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Error on line 2558 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...e string to trim :) declare#:
Duplicate definition of function functx:total-years-from-duration (see line
2554 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Now, looking at the last error as shown above-- the line numbers for the duplicate function definition error in functx-1.0.xq are "2558" and "2554"
The relevant code from the file functx-1.0.xq for lines 2554-2558 is now given below--
declare function functx:total-years-from-duration
( $duration as xs:yearMonthDuration? ) as xs:decimal? {
$duration div xs:yearMonthDuration('P1Y')
} ;
How do I resolve this error?
When you use xquery engine in a loop for example (my case) and you use one single object to execute multiple xquery that import the same function the engine will try to import the function each time, so you have duplicate the second loop.
To solve that I simply reset the object configuration each time I execute the xquery (in my Java problem I created a class that run the xquery engine and do al lthe configuration from 0 each time, so that previous run does not mess up the new run).
I'm learning the Flex command-line debugger, and I haven't been able to find information on this particular use case.
I'd like to add a breakpoint to a specific line in one of my class files. I can add breakpoints at the start of a function in a class, but I can't figure out how to set it at a specific line (e.g. line 117 in Foo.as)?
When I try to set one for a file on a given line, I get one at a different location:
(fdb) break Foo 111
Breakpoint 1 at 0x######: file Foo.as, line 115
I've verified the line # I'm specifying is valid, so I don't think the FDB is trying to compensate.
Am I doing something wrong? Is this possible in FDB?
Abso-lutely,
check out the help in fdb, it's fairly helpful :). Just type help or type help then a command. help break gives the output below, lots of nice ways to hook in there, the syntax your using is just missing a colon in between the class and the line number specified, just tried with an MXML file and it worked fine.
Set breakpoint at specified line or function.
Examples:
break 87
Sets a breakpoint at line 87 of the current file.
break myapp.mxml:56
Sets a breakpoint at line 56 of myapp.mxml.
break #3:29
Sets a breakpoint at line 29 of file #3.
break doThis
Sets a breakpoint at function doThis() in the current file.
break myapp.mxml:doThat
Sets a breakpoint at function doThat() in file myapp.mxml.
break #3:doOther
Sets a breakpoint at function doOther() in file #3.
break
Sets a breakpoint at the current execution address in the
current stack frame. This is useful for breaking on return
to a stack frame.
To see file names and numbers, do 'info sources' or 'info files'.
To see function names, do 'info functions'.
Abbreviated file names and function names are accepted if unambiguous.
If line number is specified, break at start of code for that line.
If function is specified, break at start of code for that function.
See 'commands' and 'condition' for further breakpoint control.