Highlighted
Absent Member.
Absent Member.
3037 views

[archive] Memory access violation

[Migrated content. Thread originally posted on 17 August 2010]

We have a small sub-program which we call to display a progress bar while we are setting up a mail merge for Microsoft Word. Sometimes (we don't really don't know when) we get a Memory Access Violation which APPEARS to be at the exit program instruction. We have been chasing this smoke ring for over a year now and are no nearer to finding a solution. We are using Acucobol 7.2. Here is the acucobol listing of the main loop of the program showing addresses, the error occurs at address 00033. This call (88 level = show-destroy-window) destroys the progress bar when Word is ready to be used. Can anyone help please?

Main-Logic.
00000A if show-destroy-window
000019 if screen1-handle not = null
000022 accept event before time 1
000030 destroy screen1-handle
end-if
000033 exit program
end-if.
000035 initialize ws-counts
frame-title.
00004D if wait-msg-only
00005C move 0 to ws-percent
000060 move "Processing - Please wait ..." to frame-title
else
00006A compute ws-percent rounded = (wait-curr-rec
/ wait-num-recs)
* 100
00008B move ws-percent to disp-percent
000091 string disp-percent
" % Processed"
into frame-title
end-string
end-if.
00009D if screen1-handle = null
0000A6 perform acu-screen1-create-win
end-if.
0000A9 modify screen1-progress fill-percent = ws-percent
title frame-title.
0000C8 modify screen1-handle title wait-title.
main-logic-exit.
0000DA exit program.

Regards

Nick Brook
CCS (2002) Limited
0 Likes
8 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Memory access violation

Can you post the entire program Nick?
And state exactly how this progress indicator display is called?

Do you use AcuBench by the way?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Memory access violation

Zipped up source listing attached. The program is called using a parameter block which essentially determines how much of the progress bar to fill by dividing wait-num-recs by wait-curr-rec to get a percentage to fill it. The wait-percent-bar parameter is set to "2" to show both the progress bar and a percentage. Once the waiting is over (doesn't MS Word just take forever to do things?) then the program is called with wait-percent-bar set to 3 to destroy the progress bar (window). This program is used all day every day by our users and just occasionally dies with the memory access violation error.

Yes we are using Acubench.

There is a Tufty badge for anyone who can fix it (if you're old enough to know what one is!)
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Memory access violation

OK
Wherever its called from - is that as a result of an event or an exception?
For example does the user click a button which does something and you perform code and an event-cmd-clicked?

Do you use threads?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Memory access violation

We do use threads. We have a main menu for our system (debt recovery software) and every program that the user selects to run, starts in a new thread. In this case the user has selected the Screen Enquiry program (which will run in its own thread) and then requested that they produce a letter. This will call a letter subprogram (in the same thread) which does all the setup required to present the user with a mail merged letter

The ccsgwait program is called during this setup of an MS Word mailmerge. So....
10% = loading word
create application of word handle in word-handle
20% = copying files to PC
then a series of C$COPY calls
30% = setting up document template
more activex calls to word to open a file using a template
40% Selecting document
activex call to Word to select document
50% = setting parameters
activex call to set datasource
60% = merging document
activex call to merge document
70% = closing files
activex call to close unwanted word files
80% = saving letter
activex call to save letter
[90% = printing letter
activex call to print letter if required]

Then put a 3 in wait-percent-bar and call a final time to destroy the progress bar and present the user with a visible word document for them to edit/print etc.

This means that the user is watching a progress bar whilst waiting for Uncle Bill to do his thing with Word, rather than watching a blank screen.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Memory access violation

OK then - threads.
Just because this program chucks the error doesn't mean its at fault.
We'll not in my experience of ACU anyway.

We had a long battle with MAV's.
We get the odd one now and again whereas a couple of years ago our biggest customer (80 user system of our ERP product) would have probably been getting 10+ a day - every day.

Couple more questions
The selected screen enquiry program - how does the main menu call this?

What version are you working with

Do you use the thin client software.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Memory access violation

The main menu does:--

perform thread start-task handle in tt-perform-thread (task-sub)

and start-task does:-

blah, blah, blah
call call-program
using tt-send-message (task-sub)
tt-receive-message (task-sub)
on exception go to pc-200
blah, blah, blah

We are running 7.2 and yes we do use acuthin, this is how all our users connect to our central server
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Memory access violation

There was a bug in context of COM causing MAVs with 7.0/7.1. This was corrected in 7.2.2 and later. It is known as ecn 3622.

See if you can get your hands on a 7.2.2 or later to test if the problem is gone.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Memory access violation

Thank you. I will contact my sales guy and see if we can get the update.

Many thanks for the help
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.