Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

Flat Files in Codebehind

$
0
0

I'm trying to read and right from flat files in codebehind in a web app project. It works the first time through. Subsequent executions create the error message below until the default app pool is recycled in IIS.

I've heard from other users that maybe flat files can't be used in codebehind. Is this true? Do I need to call a separate COBOL program to use a flat file? I would like to avoid making a call every time I want to access a file, because each call requires several lines of code to use a rununit to handle multiple users accessing the webpage simultaneously.

Here's the code causing the issue:

       class-id WebStressTest.LOGON is partial

                inherits type System.Web.UI.Page public.

         

       ENVIRONMENT DIVISION.

       CONFIGURATION SECTION.

       repository.

           CLASS MF-EX AS  "MicroFocus.COBOL.COBOLException"

           class Sql-Connection as "System.Data.SqlClient.SqlConnection"

           class Sql-Command as "System.Data.SqlClient.SqlCommand"

           class Sql-Exception as "System.Data.SqlClient.SqlException"

           class Sql-Reader as "System.Data.SqlClient.SqlDataReader"

           class cls-exception as "System.Exception"

           class clsHttpContext as "System.Web.HttpContext".

                

       INPUT-OUTPUT SECTION.

       FILE-CONTROL. 

           SELECT MSGQUE-FILE ASSIGN MSGQUE-FILE-NAME

                  ORGANIZATION IS SEQUENTIAL                                  

                  ACCESS MODE IS SEQUENTIAL                                    

                  FILE STATUS IS FILESTAT.

           SELECT PASSPARMS-FILE ASSIGN PASSPARMS-FILE-NAME

                  ORGANIZATION IS SEQUENTIAL                                  

                  ACCESS MODE IS SEQUENTIAL                                    

                  FILE STATUS IS FILESTAT.      

       DATA DIVISION.

       FILE SECTION.

       FD  MSGQUE-FILE.

       01  MSGQUE-RECORD.

           02  MSG-NAME PIC X(200).

           02  MSG-TEXT PIC X(9000).

       FD  PASSPARMS-FILE.

       01  PASSPARMS-RECORD PIC X(25000).

           

       working-storage section.

Error message:

Server Error in '/WebStressTest' Application.


Unable to execute static method or constructor when multiple run-units are present

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: MicroFocus.COBOL.COBOLRuntimeException: Unable to execute static method or constructor when multiple run-units are present

Source Error:

[No relevant source lines]


Source File: C:\SOURCE\ProjectPlanCode\Test\WebStressTest\WebStressTest\LOGON.aspx.cbl   Line: 0

Stack Trace:

[COBOLRuntimeException: Unable to execute static method or constructor when multiple run-units are present]
   MicroFocus.COBOL.Runtime.Common.RunUnit.GetCurrentRunUnit(IObjectControl pgInstance) +331
   MicroFocus.COBOL.Program.Reference.GetPointer32(Byte[] addrBytes, Int32 addrIndex, Int32 ptrType, IObjectControl pgInstance) +34
   WebStressTest.LOGON._MF_INITOBJ0() in C:\SOURCE\ProjectPlanCode\Test\WebStressTest\WebStressTest\LOGON.aspx.cbl:0
   WebStressTest.LOGON..ctor() in C:\SOURCE\ProjectPlanCode\Test\WebStressTest\WebStressTest\LOGON.aspx.designer.cbl:0
   ASP.logon_aspx..ctor() +37
   __ASP.FastObjectFactory_app_web_logon_aspx_cdcab7d2_wfzsb56h.Create_ASP_logon_aspx() +47
   System.Web.Compilation.BuildResultCompiledType.CreateInstance() +32
   System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp) +109
   System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +31
   System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path) +37
   System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +334
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

 


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>