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

RE: Record Locking in Visual Cobol

$
0
0

This worked. Could there be another directive that allows a program that's open for input to ignore the lock anyways?  Seems to us that even if it is open for I-o in one program, the program open for input only should not have been affected - with out needing to use the "ignore lock" phrase.


RE: Record Locking in Visual Cobol

$
0
0

I don't think there is a compiler directive, but there is a file handler configuration option for ignoring locks at run time when a file is open for input.  The default name for the file handler configuration file is extfh.cfg or you can set the EXTFH environment variable to point to a file of your choosing, as in, "set EXTFH=c:\mydir\test.cfg".  The format of the configuration file is explained in the documentation (square backets surround tags).  There are tagged sections that let you set an option based on the file's extension, file's folder,  file's name, file's path and name,   An example would be, if all your data files are in folder c:\files\app1datafiles\, then the configuration file would contain (note the doubled "\" characters):

[FOLDER:C:\\files\\appl1datafiles]
IGNORELOCK=ON

or, if the files all have the same extension ".inx":

[*.inx]
IGNORELOCK=ON

The configuration file could be added to the customer site(s) without having to redistribute your application.  (I know still a nuisance, but likely easier than a full distribution.)

Here's the documentation on the IGNORELOCK configuration option:

IGNORELOCK

The IGNORELOCK option specifies whether to ignore locks when reading files open for input.

Syntax:

IGNORELOCK= { ON } { OFF }

Parameters:

ON
Ignore locks when reading files open for input.
OFF
Do not ignore locks when reading files open for input.

Properties:

Default:OFF

Record Locking in Visual Cobol

$
0
0

We have just converted to Visual Cobol from RM.  Since we've gone live about a week ago we have users calling to complain that they are locked up in programs.  We're finding if one user is in a program that opens a record for I-O and another user is trying to run a report that uses the same record, the report program gets locked up, even though the report is only opening the file for Input.  RM did not display this behavior - in RM as long as the reporting program was opening the file for input then the report could be ran.  We're looking for a way around this. We found Visual Cobol documentation on line that references doing a read next-record with ignore locks  but we get a compile error on the word ignore. 

We are running native code on Red Hat Linux.

RE: Consuming WCF in NAtive Code via Managed Code in Visual COBOL

$
0
0

Because the project which is calling the WCF service is a Class library so that it can be registered for COM it does not pick up the app.config file which is generated by adding the service reference. Only main programs read and use app.config so it is ignored.

To get around this you can set the endpoint parameters dynamically within the COM program when it instantiates the service:

Example:

       class-id WcfCOMTest.Class1.
       
       working-storage section.
       method-id callWCFTest.
       local-storage section.
       01 wcfservice type ServiceReference1.Service1Client.
       01 remoteAddress type System.ServiceModel.EndpointAddress value new System.ServiceModel.EndpointAddress("http://localhost:62048/Service1.svc").
             
       procedure division using by value theValue as binary-long
                          returning theString as string.

           set wcfservice to new ServiceReference1.Service1Client(new type System.ServiceModel.BasicHttpBinding(), remoteAddress)
           set theString to wcfservice::GetData(theValue)
           
           goback.
       end method.

RE: Consuming a WCF Service Created in .NET 4.5 in Visual COBOL.

$
0
0

I do not know of another way to consume the WCF service other than the two approaches you mention here.

I have added an example to your other posts which shows how to get the COM approach working.

RE: Consuming a WCF Service Created in .NET 4.5 in Visual COBOL.

RE: Missing CBLRTSS.dll

$
0
0

Hello,

cblrtsS.dll was the single-threaded runtime module in Net Express, which is no longer supported in Visual COBOL where everything is built with the multi-threaded runtime module, i.e. cblrtsM.dll.

If your program is looking for cblrtss.dll after recompiled with Visual COBOL, it is possible that it is called by your program. Or is it possible you have the cblrtss.lib file from Net Express linked with your program?

Regards,

RE: Missing CBLRTSS.dll

$
0
0

This is the startup program for my system, I have a single .exe, where the error occurs,  that call multiple .dll.  How could I check to see if the cblrtss.lib file is being linked?  This error was after the recompile.


RE: Missing CBLRTSS.dll

$
0
0

Have you recompiled the .dll files with Visual COBOL as well? Or are they built with Net Express?

The cblrtss.lib file is not available in Visual COBOL, so the only way to have it linked in the .exe file is that the file was copied from the Net Express installation.

I guess the question is to know if you get the error when you run the .exe or when the .exe calls one of the .dll.

RE: Missing CBLRTSS.dll

$
0
0

I get the error when I start the .exe.  I have recompile all of the programs in Visual Cobol.  Let me look at the programs to see if maybe we have a hard link in one of the .dll

RE: Missing CBLRTSS.dll

$
0
0

You might want to debug the .exe to see if it fails as soon as you debug the .exe or at a specific call to one of the .dll's.

Missing CBLRTSS.dll

$
0
0

I have just converted a NetExpress to Visual Cobol 2012, and when I start the project, I get an error message that CBLRTSS.dll is not found.  I have looked in the BIN64 folder and it is not there.  Did I miss a download or a directive in the conversion?

RE: Listing a Folder's contents

$
0
0

This sample return folder content: documentation.microfocus.com/.../HRCLRHCALL7I.html

Is there a way to get folder and sub-folders content by using CBL_DIR_SCAN_START, CBL_DIR_SCAN_READ or any other way? I need to get a file list in all sub-folders. I am using ED 2.2 Micro Focus dialect and running ES 2.2.

RE: Listing a Folder's contents

$
0
0

You should be able to do this simply by changing the flag used in the CBL_DIR_SCAN_START from:

compute search-attributes =                  

  find-file +                  

  find-directory +                  

  find-neither.        

to

compute search-attributes =                  

  find-directory

or you could check the flag on the CBL_DIR_SCAN_READ for the return value to check if it is a folder.

RE: Listing a Folder's contents

$
0
0

Hi Chris,

i want to list files in subfolders not only subfolders. Here is mu code from sample:

      copy "cblproto.cpy".

      identification division.

      program-id. SCANDIR.

      environment division.

      configuration section.

      data division.

      working-storage section.

      01  .

          05 os-info          cblt-os-info-params.

     * Variables for CBL_DIR_SCAN_BEGIN      

     * Some used by other CBL_DIR_SCAN_ routines.      

     * The handle.

      01 dir-handle     pointer.      

     * The pattern.  I chose a null terminator instead of      

     * specified length.      

      01 dir-name-pattern.          

          10 dir-name-pattern-length     cblt-x2-comp5 value zero.

          10 dir-name-pattern-text       pic x(2048).      

     * The terminator.      

      01 pattern-terminator         pic x value low-values.      

     * Search attributes.      

      01 search-attributes     cblt-x4-comp5 value zero.          

          78 find-file         value 1.          

          78 find-directory    value 2.          

          78 find-neither      value 4.      

     * Flags      

      01 dirflags             cblt-os-flags.          

          78 escape-seq       value 1.          

          78 wildcards        value 2.      

      01 search-status        pic xx   comp-5.      

     * Variables for CBL_DIR_SCAN_READ      

     * The entry.      

      01 entry-data.          

          10 entry-data-attribute cblt-x4-comp5.          

          10 entry-data-date-stamp.              

              20 stamp-year   cblt-x4-comp5.

              20 stamp-month  cblt-x2-comp5.          

              20 stamp-day    cblt-x2-comp5.              

              20 stamp-hour   cblt-x2-comp5.              

              20 stamp-minute cblt-x2-comp5.              

              20 stamp-sec    cblt-x2-comp5.              

              20 stamp-msec   cblt-x2-comp5.              

              20 stamp-dst    cblt-x1-comp5.              

              20 stamp-size   cblt-x8-comp5.          

          10 entry-data-name.              

              20 name-length  cblt-x2-comp5 value 50.              

              20 name-text    pic x(50).      

     * Variables for CBL_DIR_SCAN_END      

     * No additional data items required.      

     * Command line argument data area      

      01 arg-pos              pic 9 value 1.      

      01 arg-text             pic x(2048) value spaces.      

     * Variables to make program Unix/Windows universal      

      01 default-path pic x(70).          

          78 win-path  value 'D:\Tutorials\JCL'.

          78 unix-path value '/var'.      

     * Parameter block for CBL_GET_OS_INFO, ignoring all but OS type      

      01 osinfo.          

          10 osinfo-length pic x(2) comp-x value 23.          

          10 os-type pic x comp-x.          

          10 osinfo-junk pic x(25).      

     * OTHER VARIABLES      

      01 attrib-work          pic x    comp-5.      

      01 attrib-text          pic x(10).      

      01 nonblank-len         pic 9(9).      

      01 terminator-position  pic 9(9).      

      01 return-val           cblt-rtncode.                

      procedure division.

     * call 'CBL_GET_OS_INFO' using os-info

     * display cblte-osi-os-type      upon console                    

     ** Find out whether this is Unix or Windows,      

     ** and set default path appropriately.          

      call 'CBL_GET_OS_INFO' using osinfo    

                      returning return-val.          

      if os-type = 128 or os-type = 129      

     ** Unix

      move unix-path to default-path            

          else      

     ** Windows, OS/2, or DOS.              

      move win-path to default-path.      

     ** Check for directory specification on command line.          

      display arg-pos upon argument-number.          

      accept arg-text from argument-value.          

          if arg-text = spaces              

               move default-path to dir-name-pattern-text              

          else              

              move arg-text to dir-name-pattern-text.      

     ** Find the nonblank length and append string terminator.          

      perform varying nonblank-len              

          from function length(dir-name-pattern-text)              

              by -1 until                  

          dir-name-pattern-text(nonblank-len:1) <> space

           or                  

          nonblank-len = 1.

          add 1 to nonblank-len giving terminator-position.          

      move pattern-terminator              

        to dir-name-pattern-text(terminator-position:1).      

     ** Set desired search attributes by name.          

      compute search-attributes =                  

     *    find-file +                  

          find-directory                    

     *    find-neither.          

      move zero to dirflags.      

     ** Start the scan -- similar to opening a file.          

      call 'CBL_DIR_SCAN_START' using                            

                         dir-handle                            

                         dir-name-pattern                            

                         search-attributes                            

                         dirflags                                      

                               returning                            

                         search-status.      

     ** Read to end, similar to reading a file.          

      perform walk-dir thru walk-dir-exit until                  

                          search-status <> zero.      

     ** At end or upon error, end the scan, similar to closing a file.

      call 'CBL_DIR_SCAN_END' using

                       dir-handle

                           returning

                       search-status.      

     ** End the program.

      display 'That''s all!' upon console.

      goback.      

      walk-dir.      

     ** Initialize name-text; function does not right-pad to length.

          move spaces to name-text.      

     ** Do the read.          

      call 'CBL_DIR_SCAN_READ' using                            

                        dir-handle                            

                        entry-data                                    

                             returning                            

                        search-status.          

      if search-status <> zero exit paragraph.      

     ** Remove all but the two rightmost bits of result.          

      move function MOD(entry-data-attribute, 3) to attrib-work.      

     ** Format result display.          

      evaluate attrib-work              

          when 1 move 'File' to attrib-text              

          when 2 move 'Directory' to attrib-text              

          when other move '???' to attrib-text.              

      display 'Next entry is: '                      

          attrib-text ' ' name-text(1:name-length) upon console.

       display  name-text upon console.  

      walk-dir-exit.

          EXIT.

      end program SCANDIR.


RE: Listing a Folder's contents

$
0
0

If you wish to find both folders and files then you should set flags to 3:

   find-file + find-directory                    

RE: Listing a Folder's contents

$
0
0

I am able to list files and folders, i not able to list files and folders recursively. Fo example i have C:\dir_A\dir_B\file_X and i set dir-name-pattern to C:\dir_A  i want to get dir_B and file_X, but since file_X is in subfolder dir_B, i only get dir_B and file_X is invisible.  

In Powershell it would be Get-ChildItem -Path C:\dir_A –Recurse

RE: Listing a Folder's contents

$
0
0

That you cannot do using these calls. You would have to do one folder level at a time and then for each subfolder you would have to do another call to cbl_dir_scan_start and read thru to end, etc. etc in order to list its set of files.

RE: Listing a Folder's contents

$
0
0

OK, thanks for confirmation. Would it be possible to invoke Powershell and get files list back to my COBOL program?

Listing a Folder's contents

$
0
0

I am looking for but cannot find a function that will return the contents of a folder (i.e. the filenames that are in the folder) back to my NATIVE COBOL program

I have looked through the File Handling Library Routines and none of those seem appropriate

The MS-DOS DIR command does this - is there a VC equivalent to the old DIR command?

I have MF VC P/Edit 2.2 with V/Studio 2012 on Windows 8.1

Viewing all 4356 articles
Browse latest View live


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