MicroFocus PC_WIN_SET_PDEFAULT Runtime Abort 
Author Message
 MicroFocus PC_WIN_SET_PDEFAULT Runtime Abort

Hello all,

I'm running MF 4.0.32 and using the PC_WIN_SET_PDEFAULT to set the
default printer.  I have the name of the printer in an INI file.  I'm
checking the return code on the call to detect if there is a problem.
However, if the user changes printers and the name in the INI file no
longer exists, the program aborts with:

error code: 114, pc=0, call=1, seg=0
114 Attempt to access item beyond bounds of memory (Signal 11)

In other words, I don't a chance to detect the problem before the
program aborts.  Is there a compiler option or something else I need
to specify in order to trap runtime errors so I can deal with them
programmatically?

Thanks,
Doug Blaze



Tue, 04 Dec 2001 03:00:00 GMT  
 MicroFocus PC_WIN_SET_PDEFAULT Runtime Abort
Hi Doug,

There is a Win32 api call "EnumPrinters" that will return details on the
printers defined to the system. You check the INI file definitions against
the details from the API call and deal with it according.

You could also look at CBL_ERROR_PROC which allows you to trap the RTS
Errors.

Hope this helps.
David.

Quote:

>Hello all,

>I'm running MF 4.0.32 and using the PC_WIN_SET_PDEFAULT to set the
>default printer.  I have the name of the printer in an INI file.  I'm
>checking the return code on the call to detect if there is a problem.
>However, if the user changes printers and the name in the INI file no
>longer exists, the program aborts with:

>error code: 114, pc=0, call=1, seg=0
>114 Attempt to access item beyond bounds of memory (Signal 11)

>In other words, I don't a chance to detect the problem before the
>program aborts.  Is there a compiler option or something else I need
>to specify in order to trap runtime errors so I can deal with them
>programmatically?

>Thanks,
>Doug Blaze



Tue, 04 Dec 2001 03:00:00 GMT  
 MicroFocus PC_WIN_SET_PDEFAULT Runtime Abort
Doug,

You are missing the entry point in working storage that is necessary
along with the SET to set the addres of "mfwinp32" (that might be
wrong, but it's cose) to that entry point.  Get those in there and
it'll work.  Read PRINT.DOC in the docs directory and it'll explain
it.



Quote:
> Hello all,

> I'm running MF 4.0.32 and using the PC_WIN_SET_PDEFAULT to set the
> default printer.  I have the name of the printer in an INI file.  I'm
> checking the return code on the call to detect if there is a problem.
> However, if the user changes printers and the name in the INI file no
> longer exists, the program aborts with:

> error code: 114, pc=0, call=1, seg=0
> 114 Attempt to access item beyond bounds of memory (Signal 11)

> In other words, I don't a chance to detect the problem before the
> program aborts.  Is there a compiler option or something else I need
> to specify in order to trap runtime errors so I can deal with them
> programmatically?

> Thanks,
> Doug Blaze

-------------------------
Trust the computer industry to shorten "Year 2000" to Y2K.  It was
this
kind of thinking that caused the problem in the first place.

Try a better search engine: http://www.google.com

Visit my updated website at
http://www.geocities.com/Eureka/2006/



Tue, 04 Dec 2001 03:00:00 GMT  
 MicroFocus PC_WIN_SET_PDEFAULT Runtime Abort
Hi Thane,

Sorry, but no joy.  The only PRINT.TXT file I can find is in 16-bit
version, not the 32-bit that I'm using.  However, I followed the
sample in the PRINT.TXT file and still get the 114 RTS.  It made no
difference if I did the SET MFPRN-PTR TO ENTRY "MFPRNT32" as the first
statement in the Procedure Division or just before I tried to use the
PC_WIN_SET_PDEFAULT call.

Any other ideas?

Doug

Quote:
>Doug,

>You are missing the entry point in working storage that is necessary
>along with the SET to set the addres of "mfwinp32" (that might be
>wrong, but it's cose) to that entry point.  Get those in there and
>it'll work.  Read PRINT.DOC in the docs directory and it'll explain
>it.



>> Hello all,

>> I'm running MF 4.0.32 and using the PC_WIN_SET_PDEFAULT to set the
>> default printer.  I have the name of the printer in an INI file.  I'm
>> checking the return code on the call to detect if there is a problem.
>> However, if the user changes printers and the name in the INI file no
>> longer exists, the program aborts with:

>> error code: 114, pc=0, call=1, seg=0
>> 114 Attempt to access item beyond bounds of memory (Signal 11)

>> In other words, I don't a chance to detect the problem before the
>> program aborts.  Is there a compiler option or something else I need
>> to specify in order to trap runtime errors so I can deal with them
>> programmatically?

>> Thanks,
>> Doug Blaze

>-------------------------
>Trust the computer industry to shorten "Year 2000" to Y2K.  It was
>this
>kind of thinking that caused the problem in the first place.

>Try a better search engine: http://www.google.com

>Visit my updated website at
>http://www.geocities.com/Eureka/2006/



Tue, 04 Dec 2001 03:00:00 GMT  
 MicroFocus PC_WIN_SET_PDEFAULT Runtime Abort


Quote:
> Hi Thane,

> Sorry, but no joy.  The only PRINT.TXT file I can find is in 16-bit
> version, not the 32-bit that I'm using.  However, I followed the
> sample in the PRINT.TXT file and still get the 114 RTS.  It made no
> difference if I did the SET MFPRN-PTR TO ENTRY "MFPRNT32" as the first
> statement in the Procedure Division or just before I tried to use the
> PC_WIN_SET_PDEFAULT call.

Make sure MFPRN-PTR is usage pointer. (I'm sure it is) The Entry point
is the only thing I know of for sure that causes the 114 right away.  
If it's not that, I'm at a loss as to the cause.

Sorry :(
-------------------------
Trust the computer industry to shorten "Year 2000" to Y2K.  It was
this
kind of thinking that caused the problem in the first place.

Try a better search engine: http://www.google.com

Visit my updated website at
http://www.geocities.com/Eureka/2006/



Tue, 04 Dec 2001 03:00:00 GMT  
 MicroFocus PC_WIN_SET_PDEFAULT Runtime Abort


Quote:


> > Hi Thane,

> > Sorry, but no joy.  The only PRINT.TXT file I can find is in 16-bit
> > version, not the 32-bit that I'm using.  However, I followed the
> > sample in the PRINT.TXT file and still get the 114 RTS.  It made no
> > difference if I did the SET MFPRN-PTR TO ENTRY "MFPRNT32" as the first
> > statement in the Procedure Division or just before I tried to use the
> > PC_WIN_SET_PDEFAULT call.

> Make sure MFPRN-PTR is usage pointer. (I'm sure it is) The Entry point
> is the only thing I know of for sure that causes the 114 right away.
> If it's not that, I'm at a loss as to the cause.

I've had this problem only with the PC_PRINT_FILE lib routine, and it drove
me nuts,
post your code, for the whole module call.

Simon Hart.



Tue, 04 Dec 2001 03:00:00 GMT  
 MicroFocus PC_WIN_SET_PDEFAULT Runtime Abort
Hello All,

Sorry to be so late posting the code for my problem, but fires will
burn!

Here's the code:

    move spaces to prt-printer-name.
    String IF-PrinterNameValue delimited by "  ", x"00"
        delimited by size into prt-printer-name.
    Call "PC_WIN_SET_PDEFAULT" using
        by reference prt-printer-name
        returning return-code
    End-Call.
    If return-code not = 0
        Perform Printer-Error
        go to print-reports-exit
    End-If.

I'm getting the 114 RTS abort and never getting a chance to check the
return-code value.  If you want to try to replicate the situation,
provide a name in 'prt-printer-name' that doesn't exist on your system
(ie:  'My Printer').  Then try the same call with a valid printer name
(ie: the EXACT name that appears when the printer dialog is invoked in
Windows).  It will work. I don't want the program to abort with the
RTS but allow me to handle my error routine.  I have to assume I don't
have a compiler option/directive set that would allow me to do this.

Thanks,
Doug Blaze

Quote:

>Hello all,

>I'm running MF 4.0.32 and using the PC_WIN_SET_PDEFAULT to set the
>default printer.  I have the name of the printer in an INI file.  I'm
>checking the return code on the call to detect if there is a problem.
>However, if the user changes printers and the name in the INI file no
>longer exists, the program aborts with:

>error code: 114, pc=0, call=1, seg=0
>114 Attempt to access item beyond bounds of memory (Signal 11)

>In other words, I don't a chance to detect the problem before the
>program aborts.  Is there a compiler option or something else I need
>to specify in order to trap runtime errors so I can deal with them
>programmatically?

>Thanks,
>Doug Blaze



Mon, 10 Dec 2001 03:00:00 GMT  
 MicroFocus PC_WIN_SET_PDEFAULT Runtime Abort
Hi all,

Here's the solution I came up with to my problem (see below).  I put a
message in on the MF AnswerLab and the response was to use the
enumerate printers API call to check your printer against the printers
defined in Windows.  The sample program looked to be far more than I
wanted to deal with and I figured there had to be an easier way.
Soooo, I looked up in the SDK about printers and saw OpenPrinter which
uses a printer name returning the handle.  I tested it with a valid
printer and got a good return code to the call (as well as the handle
of the printer ;-)  I then tested it with a dummy printer name not
defined in Windows and it gave back a bad return code.  So, I now use
OpenPrinter to verify the printer exists on the PC before using
PC_WIN_SET_PDEFAULT.  If I get a good return code back on the call, I
use ClosePrinter with the handle returned in the open.  If I get back
a bad return code, I display a dialog telling the user to re-select
the printer.  Easy huh?

Below is the call logic I used:

    Working-Storage.
    01  work-areas.
        05  prt-printer-name   pic x(11)  value "My Printer" & x"00".
        05  phHandle           pic s9(9)  comp-5 value 0.
        05  dwNull             pic s9(9)  comp-5 value 0.
        05  WReturnCode        pic s9(4)  comp-5 value 0.

    Procedure Division.
    CALL WinApi32 "OpenPrinterA" using
         by reference    prt-printer-name

         by reference    phHandle
         by value        dwNull
         returning       WReturnCode
    end-call.
    If WReturnCode < 1
        Perform Invalid-Printer-Defined
        go to print-exit
    else
        Call WinApi32 "ClosePrinter" using
             by value phHandle
             returning WReturnCode
        end-call
    End-If.

Doug

Quote:
>Hello all,

>I'm running MF 4.0.32 and using the PC_WIN_SET_PDEFAULT to set the
>default printer.  I have the name of the printer in an INI file.  I'm
>checking the return code on the call to detect if there is a problem.
>However, if the user changes printers and the name in the INI file no
>longer exists, the program aborts with:

>error code: 114, pc=0, call=1, seg=0
>114 Attempt to access item beyond bounds of memory (Signal 11)

>In other words, I don't a chance to detect the problem before the
>program aborts.  Is there a compiler option or something else I need
>to specify in order to trap runtime errors so I can deal with them
>programmatically?

>Thanks,
>Doug Blaze



Fri, 14 Dec 2001 03:00:00 GMT  
 MicroFocus PC_WIN_SET_PDEFAULT Runtime Abort

Quote:

> Here's the solution I came up with to my problem (see below).  I put a
> message in on the MF AnswerLab and the response was to use the
> enumerate printers API call to check ..... <snip>

Doug,

Just curious - saw a message in Answerlab where somebody said it was a
pain to print using APIs, so they use Crystal. My printing requirements
are simple, landscape and condensed - so I use M/F PC_PRINT routines.
Do you use APIs totally for printing ?

I know one of these days my end-user is going to throw a zinger at me.
Currently, for exception reporting, he extracts data from the system,
prepares a table and uses a colour plotter to do simple graphs. I might
just need to have "How to ...." one of these days.

Jimmy, Calgary AB



Sat, 15 Dec 2001 03:00:00 GMT  
 MicroFocus PC_WIN_SET_PDEFAULT Runtime Abort
Hi James,

No, I just use the MF PC_PRINT routines since they did what I needed
and were the most expedient.  We print just plain text and the user
has pre-selected the printer and fonts to use which I store in an INI
file.  

Do you know how the person who uses Crystal does it?  I'd be
interested to know if they are using an OCX/DLL or somehow invoking
Crystal from their MF program to do the printing.  I didn't think you
could access an OCX from MF directly.

Another option you may want to look at is Flexus's FormPrint
(www.flexus.com).  It's been discussed here quite a bit and gets great
reviews.  We're using MPACT from ESI which is based on the Flexus SP2
product.  Works great, it's very reliable and is easy to learn.

Doug

Quote:

>Just curious - saw a message in Answerlab where somebody said it was a
>pain to print using APIs, so they use Crystal. My printing requirements
>are simple, landscape and condensed - so I use M/F PC_PRINT routines.
>Do you use APIs totally for printing ?

>I know one of these days my end-user is going to throw a zinger at me.
>Currently, for exception reporting, he extracts data from the system,
>prepares a table and uses a colour plotter to do simple graphs. I might
>just need to have "How to ...." one of these days.

>Jimmy, Calgary AB



Sat, 15 Dec 2001 03:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. Aborting Tasks with abort command

2. Can't link my C programs with microFocus runtime

3. COBOL Microfocus & Runtime

4. Microfocus Unix runtime portability

5. Windows or MicroFocus NetExpress Runtime Problem?

6. Help with Microfocus personal cobol and Microfocus Level II cobol

7. Microfocus book in german and Microfocus magazin

8. Runtime object type determination/ runtime generic instantiation

9. An activeX control (3rd party data viewer) does not abort on the LabVIEW Abort Button.

10. ByteArray new: 2000000 aborts

11. error reading <<file>>, aborting

12. Help: aborting #closeWidget event for a window

 

 
Powered by phpBB® Forum Software