Highlighted
Absent Member.
Absent Member.
4226 views

Viscual COBOL ACCEPT vs RM/COBOL ACCEPT

Jump to solution

[Migrated content. Thread originally posted on 26 October 2011]

Hello,

I have found a sticky problem working with Visual COBOL R4, regarding the ACCEPT behavior. When we usually execute an ACCEPT with UPDATE, we see the field contents while editing, but we are not able to see them when we are working with Visual COBOL.

I have tried 'Adis Configuration Utility' in order to change that configuration but, unfortunately, with no results at all.

Could you please give any clues to deal with this problem?

Thank you
0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Viscual COBOL ACCEPT vs RM/COBOL ACCEPT

Jump to solution

The CURSOR clause of the ACCEPT statement has not yet been implemented in Visual COBOL.

View solution in original post

0 Likes
7 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Viscual COBOL ACCEPT vs RM/COBOL ACCEPT

Jump to solution
I am not seeing this behavior.

If I compile and run the following program, the accept statements with UPDATE specified do predisplay the contents of the field while the ones without UPDATE do not.

I modified the ADISCTRL file to use RM compatibility and predisplay all fields.

I have attached a zip file here which contains the project for this program along with the modified ADISCTRL file which is in the bin\x86\debug folder.

Please try this program and let me know if you get the same results.

Thanks.


      $set rm"ANSI"
       identification division.
       program-id. Program1.
       working-storage section.
       01 field-1     pic x(5)  value "12345".
       01 field-2     pic 9(5)  value 12345.
       01 any-key     pic x.
       procedure division.
       
           display "without update"  line 5 position 2 erase
           accept field-1 line 5 position 18
           display "with update"  line 6 position 2
           accept field-1 line 6 position 18 update
           
           display "without update"  line 8 position 2
           accept field-2 line 8 position 18
           display "with update"  line 9 position 2
           accept field-2 line 9 position 18 update
           accept any-key
           
           goback.

       end program Program1.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Viscual COBOL ACCEPT vs RM/COBOL ACCEPT

Jump to solution
I am sorry, Chris. Obviously, your program works well.

The problem was the way the routine I am testing was builded. It seems that in these days the clausule UPDATE didn't exist and I put it there in any moment when I was starting my modifications.

To simulate the UPDATE they were showing the field in the same position and then accepting an empty field instead. If the user pressed the ENTER key, they did move the old value to the new var. If do not, they simply stay with the new value.

In other words, I was confused and made a mistake. Sorry for the inconveniende, and apologize for your waste of time.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Viscual COBOL ACCEPT vs RM/COBOL ACCEPT

Jump to solution
Geez, it is some more complicated. I removed the update and still have the problem.

I will be checking this more deeply. When I have a more clear vision of what the problem really is, I will post again.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Viscual COBOL ACCEPT vs RM/COBOL ACCEPT

Jump to solution
Please, click in this link to see the execution of the program (at left, the VC version): execution

As you could see, the RM version (right) shows the value showed before the ACCEPT while editing.


Visual COBOL version:

      $SET CALLFH("ACUFH")
      $SET RETRYLOCK
      $SET RM"ANSI"
       identification division.
       program-id. Program1.

       environment division.
       configuration section.

       data division.
       working-storage section.
       01 field-1     pic x(5)  value "12345".
       01 field-2     pic 9(5)  value 12345.
       01 any-key     pic x.
       01 IDENT5      PIC 99.
       01 TECLA-FUNCION             PIC 99.
       01 WCONTROL                  PIC X(80).

       procedure division.

              DISPLAY "testacpt" LINE 1 COL 1 SIZE 80 LOW
                   CONTROL "FCOLOR = WHITE, BCOLOR = BLUE".

              MOVE "REVERSE" TO WCONTROL.
              MOVE 0 TO IDENT5.
              display field-1 line 6 position 30 control wcontrol.
              display "without update"  line 6 position 2.
              display field-1 line 6 col 18 size 5 control "low,reverse".
              move spaces to field-1.
              ACCEPT field-1 LINE 6
                     POSITION 18
                     SIZE 5 NO BEEP LOW ECHO
                     CURSOR IDENT5
                     CONTROL WCONTROL
                     ON EXCEPTION TECLA-FUNCION GO end-of-program.
              display field-1 line 6 position 30.

              display "press any key" line 8 col 2.
              accept any-key.
       end-of-program.
           goback.

       end program Program1.



RM/COBOL version:

       identification division.
       program-id. testacpt.

       environment division.
       configuration section.

       data division.
       working-storage section.
       01 field-1     pic x(5)  value "12345".
       01 field-2     pic 9(5)  value 12345.
       01 any-key     pic x.
       01 IDENT5      PIC 99.
       01 TECLA-FUNCION             PIC 99.
       01 WCONTROL                  PIC X(80).

       procedure division.
       
       entry-point section.
       main-entrance.

              DISPLAY "testacpt" LINE 1 COL 1 SIZE 80 LOW
                   CONTROL "FCOLOR = WHITE, BCOLOR = BLUE".

              MOVE "REVERSE" TO WCONTROL.
              MOVE 0 TO IDENT5.
              display field-1 line 6 position 30 control wcontrol.
              display "without update"  line 6 position 2.
              display field-1 line 6 col 18 size 5 control "low,reverse".
              move spaces to field-1.
              ACCEPT field-1 LINE 6
                     POSITION 18
                     SIZE 5 NO BEEP LOW ECHO
                     CURSOR IDENT5
                     CONTROL WCONTROL
                     ON EXCEPTION TECLA-FUNCION GO end-of-program.
              display field-1 line 6 position 30.

              display "press any key" line 8 col 2.
              accept any-key.
       end-of-program.
           goback.



Here below the two projects:

Visual COBOL version

RM/COBOL version

In order to execute the RM/COBOL version, you must write these commands:

To set up the environment:
cd \test\liant
rmcobol /regserver
runcobol /regserver


To compile:
cd \test\fuentes
cobol9 testacpt


To execute:

cd \test\fuentes
run9 testacpt


Regards
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Viscual COBOL ACCEPT vs RM/COBOL ACCEPT

Jump to solution
I found that I can get the desired behavior by changing two options in the ADISCTRL file.

Open up a Visual COBOL command prompt from Start Menu-->All Programs-->Micro Focus Visual COBOL-->Visual COBOL Tools-->Visual COBOL Command Prompt 32-bit

Change directories to the bin\x86\debug folder containing ADISCTRL file.
Start adiscf

Press F3 to load configuration, enter 3 and press Enter.
Press F2 to Alter
Press F3 for Accept/Display options
Press F3 for individual options
Use down arrow to highlight option and press enter to modify the following:

5. Predisplay of fields before ACCEPT = 2
29. Control of Read screen option = 2

When done press ESC key 3 times
Press F4 to Save
Press F3 to overwrite existing configuration
Enter 3 and press Enter
Press ESC to exit

Try again...


0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Viscual COBOL ACCEPT vs RM/COBOL ACCEPT

Jump to solution
At first sight, works perfect.

But I found that the value I get in the var IDENT5 is zero, being 1 in RM/COBOL:

              ACCEPT field-1 LINE 6
                     POSITION 18
                     SIZE 5 NO BEEP LOW ECHO
                     CURSOR IDENT5
                     CONTROL WCONTROL
                     ON EXCEPTION TECLA-FUNCION GO end-of-program.
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Viscual COBOL ACCEPT vs RM/COBOL ACCEPT

Jump to solution

The CURSOR clause of the ACCEPT statement has not yet been implemented in Visual COBOL.

View solution in original post

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.