Skip to main content

Hi Guys

Stupid question here but ....

I have a "simple" piece of code to test the commit statement which has left me somewhat surprised by its functionality.
I'm probably asking too much if at line 6 when the pgm (stops) I delete the file TEMP from another terminal and then allow the code to continue.
I then get (unexpectantly) 

I would have expected the commit line to execute and report the error???
Am I asking too much?

I'm running:



------------------------------
Stefano Gallotta
Managing Member
Simply Red Open Systems
Milnerton ZA
------------------------------

Hi Guys

Stupid question here but ....

I have a "simple" piece of code to test the commit statement which has left me somewhat surprised by its functionality.
I'm probably asking too much if at line 6 when the pgm (stops) I delete the file TEMP from another terminal and then allow the code to continue.
I then get (unexpectantly) 

I would have expected the commit line to execute and report the error???
Am I asking too much?

I'm running:



------------------------------
Stefano Gallotta
Managing Member
Simply Red Open Systems
Milnerton ZA
------------------------------

Yes, you're asking too much. Take out the "begin" and "commit" statements and you'll see the same behavior. When you deleted the file, did it say something about the file being open?



------------------------------
Brian S. Cram
Principal Technical Support Engineer
Rocket Software
------------------------------

Yes, you're asking too much. Take out the "begin" and "commit" statements and you'll see the same behavior. When you deleted the file, did it say something about the file being open?



------------------------------
Brian S. Cram
Principal Technical Support Engineer
Rocket Software
------------------------------
Hi Brian

OK, my stupid question requires context.

My client here in South Africa works on a distributed network with Linux
machines hosting both their Oracle DB and applications as well as the
bespoke D3 application.

I’m embarking on the transition of their D3 applications to feed the Oracle
applications as much as possible without disruption.

For example, in order to do so, we will “continue” to say the execution of
commission statements in D3 but feed the Oracle accounting system with
transactions suitable for its (Oracle) processing, and effectively get
Oracle to produce the commission statements they would get from D3.

So, in essence, let D3 do the “heavy lifting” and provide Oracle with the
transactions to produce commission statements!

This we hope to achieve using OpenDB.

Now, if one considers that the process between OpenDB and D3 to Oracle via
ODBC and each can be on a separate machine (albeit virtual) this may
(repeat) may present a problem should (repeat should) the network fail for
whatever reason (and in South Africa this does occur with the problem of
load shedding etc)

So, in testing what the commit work statement does, I had a look at the D3
ref manual (
https://www3.rocketsoftware.com/rocketd3/support/documentation/d3nt/92/refman/
)

My code would then mimic a loss of network (delete file) and I was
expecting the error condition (commit work else print "Could not update")

How would one test this and force the rollback?



--

*Stefano Gallotta*

*Cellular +27 (0)83 250 SRED (ZA - WhatsApp or SMS only)*

* +44 (0)97 283 71932 (UK)*

*e-Mail* stefano@simplyred.co.za

Hi Brian

OK, my stupid question requires context.

My client here in South Africa works on a distributed network with Linux
machines hosting both their Oracle DB and applications as well as the
bespoke D3 application.

I’m embarking on the transition of their D3 applications to feed the Oracle
applications as much as possible without disruption.

For example, in order to do so, we will “continue” to say the execution of
commission statements in D3 but feed the Oracle accounting system with
transactions suitable for its (Oracle) processing, and effectively get
Oracle to produce the commission statements they would get from D3.

So, in essence, let D3 do the “heavy lifting” and provide Oracle with the
transactions to produce commission statements!

This we hope to achieve using OpenDB.

Now, if one considers that the process between OpenDB and D3 to Oracle via
ODBC and each can be on a separate machine (albeit virtual) this may
(repeat) may present a problem should (repeat should) the network fail for
whatever reason (and in South Africa this does occur with the problem of
load shedding etc)

So, in testing what the commit work statement does, I had a look at the D3
ref manual (
https://www3.rocketsoftware.com/rocketd3/support/documentation/d3nt/92/refman/
)

My code would then mimic a loss of network (delete file) and I was
expecting the error condition (commit work else print "Could not update")

How would one test this and force the rollback?



--

*Stefano Gallotta*

*Cellular +27 (0)83 250 SRED (ZA - WhatsApp or SMS only)*

* +44 (0)97 283 71932 (UK)*

*e-Mail* stefano@simplyred.co.za

I tried to call, but no answer. Here's an excerpt from a document I wrote on OSFI open/read/write/close programming. Maybe this will help?

OSFI programming recommendations:

 

·      Any program (foreground or phantom) that opens OSFI files should have the following statements executed before opening, reading or writing OSFI files:

o  EXECUTE \\NET-ERRORS (SL\\ CAPTURING JUNK

§  The L options tells the system "log RFSE's, don't stop and prompt the user for intervention, don't drop to debugger".

§  The S option suppresses echoing of the NET-ERRORS state, probably redundant with CAPTURING JUNK clause.

o  EXECUTE \\SET-REMOTE-CLOSE (N\\ CAPTURING JUNK

§  Normally when remote files are opened, the file handle is cached by D3 and never explicitly closed, even by a CLOSE statement. This was done to enhance throughput. Setting remote close on allows explicit closing of remote files so that cached handles for no-longer-available resources do not linger to cause problems, as in a temporary network problem.

·      Any program accessing OSFI files should keep them open for as narrow a window as practically dictated by throughput need. Ideally when a single record is going to be read and then written, the flow should be:

o  Open

o  Read and/or Write

o  Close

within the inner loop, not opened at the top of the program and closed at program termination. Exceptions would be when processing a significant number of records in a short period of time where the preferred flow should be:

o  Open

o  Read and/or Write all records

o  Close

within the inner loop.

·      In programs that open more than one OSFI file, it's a good idea for any OPEN/ELSE logic to close all OSFI files opened in the program to make sure that none get missed. Example:

o  OPEN RMTFLE1 TO FILE1 ELSE GOTO EXIT

o  OPEN RMTFLE2 TO FILE2 ELSE GOTO EXIT

Then at exit:

o  CLOSE FILE1

o  CLOSE FILE2

In the event that the first OPEN was successful and the second OPEN failed, the first file needs to be closed on exit, and it doesn't hurt anything to close a file that was never successfully opened.

·      All WRITEs performed on OSFI files should use the ON ERROR clause to recover from a failed write.

o  Any ELSE clause on a failed OSFI OPEN or ON ERROR clause on a failed OSFI WRITE should handle a graceful close of all OSFI files and exit from the program, and optionally a wait and retry cycle. To the degree that an ELSE clause on a failed read can be certainly attributed to a network error (and not merely a record that genuinely does not exist) should follow the same cleanup and exit path and optional wait and retry cycle.



------------------------------
Brian S. Cram
Principal Technical Support Engineer
Rocket Software
------------------------------

I tried to call, but no answer. Here's an excerpt from a document I wrote on OSFI open/read/write/close programming. Maybe this will help?

OSFI programming recommendations:

 

·      Any program (foreground or phantom) that opens OSFI files should have the following statements executed before opening, reading or writing OSFI files:

o  EXECUTE \\NET-ERRORS (SL\\ CAPTURING JUNK

§  The L options tells the system "log RFSE's, don't stop and prompt the user for intervention, don't drop to debugger".

§  The S option suppresses echoing of the NET-ERRORS state, probably redundant with CAPTURING JUNK clause.

o  EXECUTE \\SET-REMOTE-CLOSE (N\\ CAPTURING JUNK

§  Normally when remote files are opened, the file handle is cached by D3 and never explicitly closed, even by a CLOSE statement. This was done to enhance throughput. Setting remote close on allows explicit closing of remote files so that cached handles for no-longer-available resources do not linger to cause problems, as in a temporary network problem.

·      Any program accessing OSFI files should keep them open for as narrow a window as practically dictated by throughput need. Ideally when a single record is going to be read and then written, the flow should be:

o  Open

o  Read and/or Write

o  Close

within the inner loop, not opened at the top of the program and closed at program termination. Exceptions would be when processing a significant number of records in a short period of time where the preferred flow should be:

o  Open

o  Read and/or Write all records

o  Close

within the inner loop.

·      In programs that open more than one OSFI file, it's a good idea for any OPEN/ELSE logic to close all OSFI files opened in the program to make sure that none get missed. Example:

o  OPEN RMTFLE1 TO FILE1 ELSE GOTO EXIT

o  OPEN RMTFLE2 TO FILE2 ELSE GOTO EXIT

Then at exit:

o  CLOSE FILE1

o  CLOSE FILE2

In the event that the first OPEN was successful and the second OPEN failed, the first file needs to be closed on exit, and it doesn't hurt anything to close a file that was never successfully opened.

·      All WRITEs performed on OSFI files should use the ON ERROR clause to recover from a failed write.

o  Any ELSE clause on a failed OSFI OPEN or ON ERROR clause on a failed OSFI WRITE should handle a graceful close of all OSFI files and exit from the program, and optionally a wait and retry cycle. To the degree that an ELSE clause on a failed read can be certainly attributed to a network error (and not merely a record that genuinely does not exist) should follow the same cleanup and exit path and optional wait and retry cycle.



------------------------------
Brian S. Cram
Principal Technical Support Engineer
Rocket Software
------------------------------

so those statements
EXECUTE \\NET-ERRORS (SL\\ CAPTURING JUNK
EXECUTE \\SET-REMOTE-CLOSE (N\\ CAPTURING JUNK
should be in every program ? even if they are sub-routines?
or can put only in the main program?



------------------------------
Alberto Leal
System Analyst
Millano Distribuidora de Auto Pecas Ltda
Varzea Grande MT BR
------------------------------

so those statements
EXECUTE \\NET-ERRORS (SL\\ CAPTURING JUNK
EXECUTE \\SET-REMOTE-CLOSE (N\\ CAPTURING JUNK
should be in every program ? even if they are sub-routines?
or can put only in the main program?



------------------------------
Alberto Leal
System Analyst
Millano Distribuidora de Auto Pecas Ltda
Varzea Grande MT BR
------------------------------

Just in the main program. And you should consider adding EXECUTE \\SET-REMOTE-CLOSE (F\\ CAPTURING JUNK at the main program's exit point to turn it off.



------------------------------
Brian S. Cram
Principal Technical Support Engineer
Rocket Software
------------------------------