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

RE: COBOL Web Application, no errors, but build fails

$
0
0

To follow up, when I remove the web application from the new solution, the Start_up project builds and starts properly. So I know it's the other application that is the culprit. I'm just not sure where to start looking, because there isn't a build error.


RE: Textbox value Highlighted on Tab

RE: COBOL Web Application, no errors, but build fails

$
0
0

I increased the verbosity of the output window during a build. Got that from this link:

blogs.msdn.com/.../did-you-know-you-can-configure-the-msbuild-verbosity-in-the-output-window-329.aspx

This enabled me to see that some of the code wasn't being added to TFS when created in Visual Studio. Specifically the designer and the cbl codebehind for Web Forms generated from Visual Studio in COBOL. You have to add those manually. Perhaps this is a bug in the Visual Studio add ins for Microfocus and Team Foundation Server?

If you add a webform in visual studio, the ASPX is added to TFS, but the designer and codebehind are not.

COBOL Web Application, no errors, but build fails

$
0
0

I am having an issue with a web application. We are migrating from a mainframe environment to a Microfocus web application. We have web applications for different transactions. There are several web applications in TFS, linked together with a Start_up menu type application. I have one application on my local computer, working fine, local IIS set up, builds correctly. One of the other developers has another application on their computer, working. But getting the source code from TFS to build hers on mine fails. There are no errors in the build, but it fails.

I'm wondering what steps I need to go through to determine where the error is occuring that is causing the build to fail, even though there is no errors in it. There are warnings, but of the not enough parameters in a call variety, which work ok on other applications. Again, the Start_up web application works for me on my local machine with another web app, but not the one downloaded from another developer.

Visual Cobol Compile Error

$
0
0

Just installed Visual Cobol and was working through the course to learn to use it.  When I got to the WebDemo program I get the error Message that says "Make sure that the class defined in this code file matches the "inherits" attribute, and that Default.aspx.cbl it extends the correct base class (e.g. Page or UserControl)."  So to see what the issue was I created a blank one, much to my surprise I received the same results.  I am using Visual Studio 2012 and the latest Visual Cobol Personal Edition.  Any help would be appreciated. 

Below is the code

class-id _Default is partial
                 inherits type System.Web.UI.Page.

       working-storage section.

       method-id Page_Load protected.
       local-storage section.
       procedure division using by value param-sender as object
                                         param-e as type System.EventArgs.
           goback.
       end method.


       method-id btnOK_Click protected.
       01  name-entered     pic x(20).
       01  response         pic x(20).
      
       procedure division using by value lnkSender as object lnkEvent as type System.EventArgs.
           move txtName::Text to name-entered
           string "Hello " delimited by size
                  name-entered delimited by space
               into response
           move response to lblResponse::Text   
           .      
       end method.

       end class.

Below is the Default.aspx

<%@ Import Namespace="System.Web.UI.Page" %>

<%@ Page Language="COBOL" AutoEventWireup="true"  CodeFile="Default.aspx.cbl" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div id="MyForm">
   
        <asp:Label ID="lblIntro" runat="server"
            Text="Please enter your name and press OK"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
        <br />
        <br />
        <br />
        <asp:Button ID="btnOK" runat="server" onclick="btnOK_Click" Text="OK" />
&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Label ID="lblResponse" runat="server" ForeColor="Red"></asp:Label>
   
    </div>
    </form>
</body>
</html>

RE: Visual Cobol Compile Error

$
0
0

This appears to be a problem when using the Visual Studio 2012 Shell and trying to create an ASP.NET Web Site. This works fine when using a full version of Visual Studio 2012 like professional, premium, etc. but fails when using Visual Studio 2012 Shell.

You should be able to create an ASP.NET Web Application using New-->Project-->Web but the Web Site type of project is failing.

I would recommend either using a full version of Visual Studio 2012, using the ASP.NET Web Application template instead of the Web Site or just skipping this section of the learning guide until a fix becomes available.

Sorry about that...

RE: Visual Cobol Compile Error

$
0
0

Chris, I have Visual Studio Professional 2012 Version 11.0.50727.1 RTMREL.

Visual Cobol for Eclipse Windows

$
0
0

Hi, i try install Visual Cobol for Eclipse in two Win7 differents.


All instalations see this error in execution Eclipse:

Assinatura do problema:
  Nome do Evento de Problema:    APPCRASH
  Nome da aplicação:    eclipse.exe
  Versão da aplicação:    0.0.0.0
  Carimbo de Data/Hora da Aplicação:    4fad6d40
  Nome do Módulo com Falhas:    msvcrt.dll
  Versão do Módulo com Falhas:    7.0.7600.16385
  Carimbo de Data/Hora do Módulo com Falhas:    4a5bda6f
  Código de excepção:    c0000005
  Desvio de Excepção:    0000e8a6
  Versão do SO:    6.1.7601.2.1.0.256.48
  ID de Região:    1046
  Informações Adicionais 1:    b28b
  Informações Adicionais 2:    b28bfaf039d448f61e1d460add93368d
  Informações Adicionais 3:    f7b8
  Informações Adicionais 4:    f7b84bb33a6be21e4b80fe0888c4c0f0

Leia a nossa declaração de privacidade online:
  http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0816

Se a declaração de privacidade online não estiver disponível, leia a declaração de privacidade offline:
  C:\Windows\system32\pt-PT\erofflps.txt


RE: Visual Cobol for Eclipse Windows

$
0
0

Which Visual COBOL product version number are you installing?

Please try downloading the product again. saving the download to disk and then running the installer from there as it appears that you may have a corrupt install file.

Thanks.

RE: Visual Cobol Compile Error

$
0
0

Yes, I tried this on a different computer using Visual Studio 2012 Premium and was able to reproduce the problem so it appears to be related to specific environments instead of the Shell version.

I am investigating.

Thanks.

RE: Validating cell datagridview

$
0
0

You can use the CellValidating event to do this.

I found the following example in the Microsoft docs and converted to COBOL:

method-id dataGridView1_CellValidating final private.
       procedure division using by value sender as object e as type System.Windows.Forms.DataGridViewCellValidatingEventArgs.
       
          set dataGridView1::Rows[e::RowIndex]::ErrorText to ""
          declare newInteger as binary-long

         *> Don't try to validate the 'new row' until finished  
         *> editing since there 
         *> is not any point in validating its initial value. 
           if (dataGridView1::Rows[e::RowIndex]::IsNewRow) 
              goback
           else
              if not (type Int32::TryParse(e::FormattedValue::ToString, newInteger))
                 set e::Cancel to true
                 set dataGridView1::Rows[e::RowIndex]::ErrorText to "the value must be numeric"
              end-if
           end-if
       end method.
      

Validating cell datagridview

$
0
0

Hi guys

How to lock a cell of datagridview to accept only numbers. Otherwise, to ignore the change.

Confused

RE: Validating cell datagridview

$
0
0

Hi Chris,

I had to make some adjustments because this code validates a blank line and I needed to validate the data change. Follows the working code.

Thank you, I couldn’’t have done it without you
Thank you, I couldn’’t have done it without you

    method-id dataGridView1_CellValidating final private.

       procedure division using by value sender as object e as type System.Windows.Forms.DataGridViewCellValidatingEventArgs.
           declare newInteger as binary-long
           declare x as float-short
           set dataGridView1::Rows[e::RowIndex]::ErrorText to ""
                   
           if e::ColumnIndex::Equals(10)
              if not (type Int32::TryParse(e::FormattedValue::ToString, newInteger))
                 set e::Cancel to true
                 set dataGridView1::Rows[e::RowIndex]::ErrorText to "Erro no valor da coluna (TipoDoc)"
                 invoke type MessageBox::Show("Tipo de documento inválido. 1=CPF 2=CNPJ" "Visual Cobol.NET")
              else
                 set x to type System.Convert::ToInt32(e::FormattedValue::ToString())
                 if x < 1 or > 2
                    set e::Cancel to true
                    set dataGridView1::Rows[e::RowIndex]::ErrorText to "Erro no valor da colunha (TipoDoc)"
                    invoke type MessageBox::Show("Tipo de documento inválido. 1=CPF 2=CNPJ" "Visual Cobol.NET")
                 end-if   
              end-if
           end-if      
       end method.

Thank you, I couldn't have done it without you.

Printing

$
0
0

I am having trouble using the printer_redirection code.  My printer will act like it wants to start printing, but nothing comes out. I am testing with the testprintraw cobol project.  My printer acts like it wants to start printing, but nothing happens.  What I am looking to do is build a report, save it to a file with headers and data and then print those results to my windows printer.  I am using the Micro Focus Cobol for Visual Studio 2012 version.

Visrel to generate report accessing native database.

$
0
0

Confused  Visrel is the best, I know, to generate report accessing native database.
There is a Lite option that has almost all features of the paid version. Configurar / Utilizar a versão LITE.
The Form Designer generates COBOL source to several compilers and
other languages as VB and so on. Works in character and graphic mode.
Has an example on You Tube with a little demonstration.  

[View:https://www.youtube.com/watch?v=Ue-CfnBNsKs:550:0]


smtp mail with cURL (was in wrong forum)

$
0
0

Hello,

I have been trying to send mail using cURL from Cobol. I took an example from this forum but I am stuck with the mail body:

Here is the link to the example from cURL http://curl.haxx.se/libcurl/c/smtp-mail.html.

The following code (partly taken from a previous discussion on the forum) seems to work partially :

       *> Demo showing how to make an http request from a COBOL program
       *>    using libcurl.
       *> libcurl can be found at http://sourceforge.net/projects/curl/
       *> libcurl documentation can be found at http://curl.haxx.se/libcurl/
       *>
       *> compile as follows:
       *>    cob -x urltest.cbl -L/usr/lib -lcurl -L/usr/ssl/lib -lssl -lcrypto -ldl
       *>

       Program-ID. urltest.
       Working-Storage Section.
       01  Curl-Handle                     pointer.
       01  Bad-Handle                      pointer.
       01  Recipients                      pointer.
       78  CURLOPT-NOTHING                 value     0.
       78  CURLOPT-FILE                    value 10001.
       78  CURLOPT-URL                     value 10002.
       78  CURLOPT-PORT                    value     3.
       78  CURLOPT-ERRORBUFFER             value 10010.
       78  CURLOPT-WRITEFUNCTION           value 20011.
       78  CURLOPT-CRLF                    value    27.
       78  CURLOPT-VERBOSE                 value    41.
       78  CURLOPT-HEADER                  value    42.
       78  CURLOPT-NOPROGRESS              value    43.
       78  CURLOPT-NOBODY                  value    44.
       78  CURLOPT-HEADER-YES              value     1.
       78  CURLOPT-HEADER-NO               value     0.
       
       78  CURLOPT-MAIL-FROM               value 10186.
       78  CURLOPT-MAIL-RCPT               value 10187.
       78  CURLOPT-READFUNCTION            value 20012.
       78  CURLOPT-READDATA                value 10009.
       78  CURLOPT-UPLOAD                  value 46   .
       78  CURLOPT-VERBOSE                 value 41   .
       78  CURLE-OK                        value 0    .

       78  78True  value 1.
       78  78FROM  value z"<sender@example.org>".
       78  78TO    value z"<addressee@example.net>".
       78  78CC    value z"<info@example.org>".
       
       01  Curl-URL                        pic x(256).
       01  Writefunction-Ptr               procedure-pointer.
       01  Curl-Error-Text                 pic x(256).
       01  Ws-Error                        pic x(40).
       01  Web-Data                        pic x(65536).
       01  Web-Data-Len                    pic x(04) comp-5 value 0.
       01  Web-Data-Max                    pic x(04) comp-5.
       01  Total-Size                      pic x(04) comp-5.
       01  Bytes-Read                      pic x(04) comp-5.

       Linkage Section.
       01  Data-In                         pic x(04) comp-5.
       01  Data-Elem-Size                  pic x(04) comp-5.
       01  Data-Elem-Num                   pic x(04) comp-5.
       01  Unused-Ptr                      pointer.

       Procedure Division.
           *>Curl-Handle = curl-easy-init();
           set Curl-Handle to null
           set Bad-Handle  to null
           call "curl_easy_init" returning Curl-Handle

           if Curl-Handle = Bad-Handle then
               move "Easy Init Error" to Ws-Error
               perform 9000-Error
               *> quit the program
           end-if
           
           display "Init OK"
           
           
           call "curl_easy_setopt"
               using by value     Curl-Handle
                     by value     CURLOPT-VERBOSE size 4
                     by value     78True size 4
           end-call
           if Return-Code not = 0
               move "Verbose Error" to Ws-Error
               perform 9000-Error
           else
               display "CURLOPT-VERBOSE OK"
           end-if
           
           *> This is the URL for your mailserver */
           move z"smtp://mail.example.com"   to Curl-URL
           call "curl_easy_setopt"
               using by value     Curl-Handle
                     by value     CURLOPT-URL size 4
                     by reference Curl-URL
           end-call
           if Return-Code not = CURLE-OK then
               move "Smtp Error" to Ws-Error
               perform 9000-Error
           else
               display "smtp ok"
           end-if
                     
           *> Note that this option isn't strictly required, omitting it will result in
           *> libcurl sending the MAIL FROM command with empty sender data. All
           *> autoresponses should have an empty reverse-path, and should be directed
           *> to the address in the reverse-path which triggered them. Otherwise, they
           *> could cause an endless loop. See RFC 5321 Section 4.5.5 for more details.
            
           *>curl-easy-setopt(Curl-Handle, CURLOPT-MAIL-FROM, FROM);
           move 78From to Curl-URL
           call "curl_easy_setopt"
               using by value     Curl-Handle
                     by value     CURLOPT-MAIL-FROM size 4
                     by reference Curl-URL
           end-call
           if Return-Code not = CURLE-OK then
               move "FROM Error" to Ws-Error
               perform 9000-Error
           else
               display "FROM ok"
           end-if
          
           set recipients to null
           *> Add two recipients, in this particular case they correspond to the
           *> To: and Cc: addressees in the header, but they could be any kind of
           *> recipient. */
           *>recipients = curl-slist-append(recipients, TO);
           *>recipients = curl-slist-append(recipients, CC);
           call "curl_slist_append"
               using by value     recipients
                     by reference 78TO
               returning recipients
           if Return-Code not = CURLE-OK then
               move "recipients Error" to Ws-Error
               perform 9000-Error
           else
               display "recipients ok"
           end-if

           *>curl-easy-setopt(Curl-Handle, CURLOPT_MAIL_RCPT, recipients);
           call "curl_easy_setopt"
               using by value     Curl-Handle
                     by value     CURLOPT-MAIL-RCPT size 4
                     by value     recipients
           end-call
           if Return-Code not = CURLE-OK then
               move "TO Error" to Ws-Error
               perform 9000-Error
           else
               display "TO ok"
           end-if
                     
           *> callback function
           call "curl_easy_setopt"
               using by value     Curl-Handle
                     by value     CURLOPT-ERRORBUFFER size 4
                     by reference Curl-Error-Text
           end-call
           if Return-Code not = 0
               move "Set Option ErrorBuffer Error" to Ws-Error
               perform 9000-Error
           else
               display "CURLOPT-ERRORBUFFER OK"
           end-if
           
           call "curl_easy_setopt"
               using by value     Curl-Handle
                     by value     CURLOPT-HEADER    size 4
                     by value     CURLOPT-HEADER-NO size 4
           end-call
           
           if Return-Code not = 0 then
               move "Set Option Header Error" to Ws-Error
               perform 9000-Error
           else
               display "CURLOPT-HEADER OK"
           end-if
           
           set Writefunction-Ptr to entry "curl-callback"
           
           call "curl_easy_setopt"
               using by value     Curl-Handle
                     by value     CURLOPT-WRITEFUNCTION size 4
                     by value     Writefunction-Ptr
           end-call
           
           if Return-Code not = 0 then
               move "Set Option Writefunction Error" to Ws-Error
               perform 9000-Error
           else
               display "CURLOPT-WRITEFUNCTION OK"
           end-if
           
           *> We're using a callback function to specify the payload (the headers and
           *> body of the message). You could just use the CURLOPT-READDATA option to
           *> specify a FILE pointer to read from. */
           *>curl_easy_setopt(Curl-Handle, CURLOPT-READFUNCTION, payload-source);
           *>curl_easy_setopt(Curl-Handle, CURLOPT-READDATA, &upload-ctx);
           *>curl_easy_setopt(Curl-Handle, CURLOPT-UPLOAD, 1L);
          
           *> Here I should have the body of the message
           
           *> Send the message */
           *> res = curl-easy-perform(Curl-Handle);
           call "curl_easy_perform"
               using by value     Curl-Handle
           end-call
           if Return-Code not = CURLE-OK then
               move "Perform Error" to Ws-Error
               perform 9000-Error
           else
               display "Send ok"
           end-if
          
           *> Check for errors
           *> if (res != CURLE-OK)
           *>   fprintf(stderr, "curl-easy-perform() failed: %s\n",
           *>           curl-easy-strerror(res));
           *>
           *> /* Free the list of recipients */
           *>curl-slist-free-all(recipients);
          
           *> curl won't send the QUIT command until you call cleanup, so you should be
           *> able to re-use this connection for additional messages (setting
           *> CURLOPT-MAIL-FROM and CURLOPT-MAIL-RCPT as required, and calling
           *> curl-easy-perform() again. It may not be a good idea to keep the
           *> connection open for a very long time though (more than a few minutes may
           *> result in the server timing out the connection), and you do want to clean
           *> up in the end.
           *>
           *>curl-easy-cleanup(Curl-Handle);
           call "curl_easy_cleanup" using by value Curl-Handle end-call
           if Return-Code not = CURLE-OK then
               move "Cleanup Error" to Ws-Error
               perform 9000-Error
           else
               display "cleanup ok"
           end-if

           continue
           goback.


       9000-Error.
           display Ws-Error
           display "Return-Code: " Return-Code
           display "Error Text: " Curl-Error-Text
           call "curl_easy_cleanup" using by value Curl-Handle
           goback.

       Program-Termination.
       entry "curl-callback"
           using by reference Data-In
                 by value     Data-Elem-Size
                 by value     Data-Elem-Num
                 by value     Unused-Ptr.
      
       E1000-Buffer-Data.
           compute Total-Size =   (Data-Elem-Size * Data-Elem-Num)
           compute Web-Data-Max = (length of Web-Data - Web-Data-Len)
           if Total-Size > Web-Data-Max then
               move Web-Data-Max to Total-Size
           end-if
       
           move Data-In(1:Total-Size)
                to Web-Data(Web-Data-Len + 1:Total-Size)
           add Total-Size to Web-Data-Len
           move Total-Size to Bytes-Read
           goback returning Bytes-Read.
       
       Entry-Termination.
      

When it comes to modifiying this section :

           *>curl_easy_setopt(Curl-Handle, CURLOPT-READFUNCTION, payload-source);
           *>curl_easy_setopt(Curl-Handle, CURLOPT-READDATA, &upload-ctx);
           *>curl_easy_setopt(Curl-Handle, CURLOPT-UPLOAD, 1L);

i must confess that I don't kno how to handle it in cobol


Has someone an idea on how to proceed ?


Regards,

RE: Printing

$
0
0

If you are writing the file to disk first then perhaps you could try using PC_PRINT_FILE instead of the printer redirection shown in the example which is really for writing your print line directly to the printer.

The example uses esc codes that are for a specific printer that is used in the example. You would have to replace these with codes that are applicable to your own printer if they are indeed different.

Thanks,

Method description

$
0
0
The following code is part of the ExceptionDemo. There is a description for the New method but this is not shown in Object Browser after selecting the method. Only the class Name 'TimedException' appears. What Settings are necessary to Show the description? ******************************************************************************************************** * * U s e r D e f i n e d E x c e p t i o n C l a s s * *> Definition of our very own exception class. *> All exceptions must derive from System.Exception or a descendant thereof. class-id TimedException inherits type Exception. working-storage section. *> We'll use this data member to store away the time the exception was constructed 01 obj-time type System.DateTime. *> Create a constructor that accepts the Message for the exception *>> *>> Constructor of Class TimedException. *>> *>> System.String method-id New. data division. working-storage section. procedure division using by value str as string. *> Pass the message on to the equivalent System.Exception constructor invoke super::New(str) *> and store away the time set obj-time to type System.DateTime::Now end method.

RE: Printing

$
0
0

Can that file be an external file that is created during the select assign to statement?

RE: Printing

$
0
0

Take a look at PC_PRINT_FILE routine in the docs under Library routines.

The first parameter that you pass in is a variable containing the filename to print.

This could be the same variable that you use to hold the file-name in the SELECT.

If you are assigning your file to an environment variable which is set outside of the program then you would have to read the contents of that environment variable in order to set the name.

something like the following:

select test-file assign to external MYENV

...

01 pn-name.

 03 pn-name-len   pic x(2) comp-5

 03 pn-name         pic x(256).

open output test-file

display "MYENV" upon environment-name

accept pn-name from environment-value

*>find the length of the file name

perform varying pn-name-len from length of pn-name by -1 until pn-name-len < 1

  if pn-name(pn-name-len:1) not = " "

     exit perform

  end-if

end-perform

call "PC_PRINT_FILE using pn-name...

Viewing all 4356 articles
Browse latest View live


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