DDE INITIATE failed. (3153) - openedge

Progress ABL : OpenEdge Release 11.6
Operation System: Windows 7
Microsoft Office: 2013
Description:
That is a Reporting Project. The Progress 4GL is used by report generation with the Office Word. And the DDE initiate is failed. I don't known what is the happen.
I reference the Progress Document, which said same the problem is solved by OpenEdge Release 11.5.1. But I don't think so. Now I hope every body give the help. Thanks
DDE INITIATE failed
DDE TESTING code
Issue Coding:
DEFINE VARIABLE ddeid AS INTEGER NO-UNDO.
DEFINE VARIABLE frame-handle AS HANDLE NO-UNDO.
CREATE FRAME frame-handle
ASSIGN visible = TRUE
hidden = TRUE.
DDE INITIATE ddeid FRAME frame-handle
APPLICATION "Excel" TOPIC "System".

Found the reason and solved
Missing the winword.exe path
Missing WinExec Procedure
Coding:
DEFINE VARIABLE ddeid AS INTEGER NO-UNDO.
DEFINE VARIABLE frame-handle AS HANDLE NO-UNDO.
DEFINE VARIABLE return-code AS INT NO-UNDO.
CREATE FRAME frame-handle
ASSIGN visible = TRUE
hidden = TRUE.
PROCEDURE WinExec EXTERNAL "KERNEL32.DLL":
DEFINE INPUT PARAMETER ProgramName AS CHARACTER.
DEFINE INPUT PARAMETER VisualStyle AS LONG.
DEFINE RETURN PARAMETER StatusCode AS LONG.
END PROCEDURE.
RUN WinExec(INPUT "C:\Program Files\Microsoft Office\Office15\winword.exe", INPUT 1, OUTPUT return-code).
DDE INITIATE ddeid FRAME frame-handle
APPLICATION "Winword" TOPIC "System".

Related

Best practice to determine the codepage of an unkown file? (with Progress-4GL Openedeg)

What is the best way to identify the codepage of a file?
I hoped i can use DetectInputCodepage but i dont know how to implement it with progress.
I don't know what led you down that rabbit hole - the link you provided led to outdated documentation for Internet Explorer.
However. This problem is non trivial. See https://community.progress.com/s/article/000057930
Also
How can I detect the encoding/codepage of a text file?
Based on the answer above (on Stackoverflow) you can download the mentioned Nu-package and extract the dll (using any zip-tool).
Add the ude.dll-file to your assemblies and then you can do like this (error checking etc missing in this example):
USING Ude.*.
USING System.IO.*.
DEFINE VARIABLE fs AS FileStream NO-UNDO.
DEFINE VARIABLE ude AS CharsetDetector NO-UNDO.
fs = NEW FileStream( "c:/temp/test.txt", FileMode:Open).
ude = NEW CharsetDetector().
ude:Feed(fs).
ude:DataEnd().
IF ude:Charset <> ? THEN
MESSAGE SUBSTITUTE("Charset &1, confidence &2", ude:Charset, ude:Confidence) VIEW-AS ALERT-BOX.
ELSE
MESSAGE "Failed" VIEW-AS ALERT-BOX.
fs:Close().
DELETE OBJECT fs.
DELETE OBJECT ude.

How to understand a Int-Proc entry, mentioned in client.mon file?

I'm dealing with a list of errors while trying to open a *.w file in the appBuilder. I managed to find a previous version of that file, which opens fine, and I see following differences between both files:
Per procedure segment information
---------------------------------
File Segment #Segments Total-Size
---- ------- --------- ----------
Good_version.w
...
Int-Proc: 19 1 26232
...
Bad_version.w
...
Int-Proc: 19 1 32712
As you can see, "Int-Proc" number 19 seems to be the one, exceeding the segment size (above 32K) and hence is the one causing the problem.
Now the obvious question: how can I know the meaning of "Int-Proc" number 19? I have some procedures inside my code but the number does not correspond with the total number of "Int-Proc" (very naïvely: I have 38 "Int-Proc" entries in client.mon but only 21 End procedure. entries in my source code).
Edit
The action to take in case of exceeding 32K limit is splitting the procedure, which grows too large, into smaller pieces. However, between Bad_version.w and Good_version.w, it seems that in total 5 procedures have been expanded, and I'd like to know which one I need to split.
Disclaimer: I have never used the AppBuilder.
client.mon is for r-code statistics, so I think that instead of .w there should be a .r there. The AppBuilder has a 32000 byte (= maximum size of a character variable) limit for internal procedures. 32000 new lines will also break the AppBuilder view, but compile to 0 bytes (or so).
I /thought/ the AppBuilder would complain about an internal procedure being too large upon selecting the procedure that is too large. If not you will need to get the /text/ content size of block of your .w between procedure and end procedure and you know which are your problem.
Something like:
def var lcw as longchar no-undo.
def var iprocs as integer no-undo.
def var lcproc as longchar no-undo.
def var cc as character no-undo.
def var ic as integer no-undo.
cc = chr(1).
copy-lob from file "my.w" to lcw.
assign
lcw = replace( lcw, 'procedure ', cc )
lcw = replace( lcw, 'end procedure', cc )
iprocs = num-entries( lcw, cc )
.
do ic = 1 to iprocs:
lcproc = entry( ic, lcw, cc ).
if length( lcproc ) > 31000 then
message substring( lcproc, 1, 100 ) view-as alert-box.
end.
Intrigued by how the AppBuilder really complains:
started the AppBuilder
created a Smart Window
opened the first procedure section (it was a trigger)
added // some comment
saved the .w
opened the .w with Notepad++ and blew up // some comment to be larger than 32000 bytes
Opened .w with AppBuilder, endless errors.
Quit.
-> Added -debugalert to my shortcut.
On first error started debugger.
Debugger tries to start, but does not (remember the hidden procedures post)
-> Added -zn to my shortcut.
On first error started debugger.
It starts. While I cannot see any source code since I have not extracted the source code pls, I can see and view all variable and buffers.
Since I had blown up a trigger, the error reported _trg. Viewing _trg:
And:

Progress 4GL: Regarding OUTPUT TO statement

What happens when I don't give directory path? Where the file is exported?
DEFINE VARIABLE cPath AS CHARACTER NO-UNDO.
cPath = STRING(MTIME) + "_user.out".
OUTPUT TO VALUE (cPath).
MESSAGE "In side a file".
OUTPUT CLOSE.
The file is exported to your client's working directory. That is typically the directory where you've been in when you have started the client process (_progres, prowin, prowin32).
You can use FILE-INFO to find out:
DEFINE VARIABLE cPath AS CHARACTER NO-UNDO.
cPath = STRING(MTIME) + "_user.out".
OUTPUT TO VALUE (cPath).
MESSAGE "In side a file".
OUTPUT CLOSE.
file-info:file-name = "./" + cPath.
message cPath file-info:full-pathname.
By the way - if you are hoping that using MTIME() to prefix the file name is going to result in a unique file name then you may be disappointed. Multiple processes running at the same time could have collisions. Or you may have old stale files left over from crashed sessions.

Using COM from a R script

I woud like to be able to start and call a COM object from within a R script (in Windows obviously). There is a library called RDCOM http://www.omegahat.net/RDCOMClient/ but
it does not support VARIANT data types - and the COM object
expects VARIANT as parameters and returns arrays in them
is it maintained? are there active alternatives?
What I need to call is a function defined like this in the .idl file (the idl file gets compiled to create a COM object - not important except if you want to know the exact deeclaration of the object)
[id(3), helpstring("method GetQuestionList")] HRESULT GetQuestionList([out] VARIANT* nQuestionCount,[out] VARIANT* arrNames, [out] VARIANT* arrIndents, [out] VARIANT* arrTypes);
In this method the fields are passed by reference - in VB you would call it like this
Dim myObject = CreateObject("AskiaAPI.Analyse")
Dim arrIndents, nQuestionCount, arrNames, arrTypes As Object
myObject.GetQuestionList(nQuestionCount, arrNames, arrIndents, arrTypes)
Dim nQuestion
For nQuestion = 0 To nQuestionCount - 1
lstResults.Items.Add(nQuestion & ": " & arrNames(nQuestion))
Next nQuestion
In the code above, the variables nQuestionCount, arrNames, arrIndents, arrTypes are initialised by GetQuestionList (that's why they are passed by reference). In that example, lstResults would be a ListBox used to display the content of one of the parameters.
Any hint or idea is welcome!

Package input parameter SQL Developer

I am trying to create a package in Oracle SQL Developer and want to have a public input parameter that another user can input a date to. I tried the following code -
Create PACKAGE Assignment_1_Pack is
vstartDate date := to_date('&startDate', 'DD/MM/YYYY');
vendDate date := to_date('endDAte', 'DD/MM/YYYY');
END;
When I try to run it I get the following message
Empty package Assignment_1_pack definition (no public members).
I was expecting the window that pops up to prompt for an input but I haven't used packages before so I am not sure what it is I am doing wrong
run set define on;
Use a command create OR REPLACE package Assignment_1_Pack ...
SET DEFINE ON/OFF toggles the substitution variables on or off. Probably the substitution of variables was turned off, so SQLDeveloper doesn't ask for the value
See this for details: https://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12040.htm#sthref2736
SET DEF[INE] {& | c | ON | OFF} Sets the character used to prefix
substitution variables to c.
ON or OFF controls whether SQL*Plus will scan commands for
substitution variables and replace them with their values. ON changes
the value of c back to the default '&', not the most recently used
character. The setting of DEFINE to OFF overrides the setting of the
SCAN variable.
create OR REPLACE package ... prevents from errors in a case when the package has already been created. Simple CREATE PACKAGE xxx command fails if the package already exists. If you create the package for the first time, then all subsequent attempts will fail. Create OR REPLACE ... drops the package if it already exists, and then creates it again, so it newer fails.

Resources