Highlighted
Absent Member.
Absent Member.
3173 views

SELECT & TO DISC in Visual COBOL for Unix

Jump to solution

[Migrated content. Thread originally posted on 08 March 2012]

Hello,

We have noticed that the following definition:
           SELECT OPTIONAL TRABSEQ
                  ASSIGN TO DISC LOC-TRABSEQ
                  ORGANIZATION IS LINE SEQUENTIAL
                  FILE STATUS IS STAT-TRABSEQ.

shows an unpredictable behavior, whereas the same instruction -without DISC- works as expected.

We are using the following directives:
SHOW-DIR
CALLFH(ACUFH)
RM "GIVING"
RM "ANSI"
REMOVE"TIMEOUT"
PERFORM-TYPE"RM"
OLDNEXTSENTENCE
0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: SELECT & TO DISC in Visual COBOL for Unix

Jump to solution
The word "DISC" is not recognized by the Visual COBOL compiler.
According to the documentation for the File-Control entry the keyword should be "DISK" and not "DISC".

File-Control Entry

The compiler is interpreting the word "DISC" as being a data-item name that should contain the name of the file when it is opened. Since "DISC" does not exist in the working-storage section the compiler generates the data-item automatically.

When I use the following syntax in Visual COBOL:

select optional test-file assign to DISC FILENAME

it gives me a warning that FILENAME will be treated as documentary even though it is a valid data-item in working-storage because the compiler interprets this statement as having two data items in the assign clause which is allowed but the second item will be treated as documentary.

If you change "DISC" to "DISK" it works as expected.

View solution in original post

0 Likes
5 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: SELECT & TO DISC in Visual COBOL for Unix

Jump to solution
Can you please elaborate on what you mean by "unpredictable behavior"?

Exactly what is it that is occurring in your application?

Thanks.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: SELECT & TO DISC in Visual COBOL for Unix

Jump to solution
For example, in the code below, the information is written but the read operation does not return anything. If you remove the clause, it wors fine.
      $SET USE"/MNG/DESA/FUENTES/EQBASE/VC/CFG/myDirectives.dir"
       IDENTIFICATION DIVISION.
       PROGRAM-ID. PRDISC.
       AUTHOR. mossa.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       SOURCE-COMPUTER. LEVEL-6.
       OBJECT-COMPUTER. LEVEL-6.
       SPECIAL-NAMES.
VC         call-convention 0 is VisualCOBOLcall
           DECIMAL-POINT COMMA.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT OPTIONAL TRABSEQ
                  ASSIGN TO DISC LOC-TRABSEQ
                  ORGANIZATION IS LINE SEQUENTIAL
                  FILE STATUS IS STAT-TRABSEQ.
      /
       DATA DIVISION.
       FILE SECTION.
       FD  TRABSEQ
           LABEL RECORD IS STANDARD
           DATA RECORD IS ART-TRSEQ.
       01 ART-TRSEQ                    PIC X(80).

       WORKING-STORAGE SECTION.
       COPY "FWOR4SB.CPY".
       77 LOC-TRABSEQ               PIC X(128) VALUE SPACES.
       77 STAT-TRABSEQ              PIC XX.
       
       01  WENTRADA                    PIC X(74).
       01  ENTORNO-W                   PIC X(10).
           88 ENTORNO-REAL-W              VALUE "/MNG".
           88 ENTORNO-PRUEBAS-W           VALUE "/MNG1".
       
      * ////////////////////////////////////////////////////////////////
      * ////////////////////////////////////////////////////////////////
       PROCEDURE DIVISION.

      ***********************
      * SECCION DE ENTRADA. *
      ***********************
       INICIO SECTION.
      *---------------
       INI-1.
           MOVE "/MNG/EXPL/TMP/TEST.TXT" TO LOC-TRABSEQ.
           OPEN OUTPUT TRABSEQ.
           MOVE "CACA" TO ART-TRSEQ.
           WRITE ART-TRSEQ.
           CLOSE TRABSEQ.
           ACCEPT FP-Z.
           OPEN INPUT TRABSEQ.
           READ TRABSEQ AT END
               MOVE HIGH-VALUES TO ART-TRSEQ
           END-READ.
           DISPLAY ART-TRSEQ.
           CLOSE TRABSEQ.

        FIN-PROGRAMA.
           GOBACK.


       COPY "FPROC4SB.CPY".
       
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: SELECT & TO DISC in Visual COBOL for Unix

Jump to solution
The word "DISC" is not recognized by the Visual COBOL compiler.
According to the documentation for the File-Control entry the keyword should be "DISK" and not "DISC".

File-Control Entry

The compiler is interpreting the word "DISC" as being a data-item name that should contain the name of the file when it is opened. Since "DISC" does not exist in the working-storage section the compiler generates the data-item automatically.

When I use the following syntax in Visual COBOL:

select optional test-file assign to DISC FILENAME

it gives me a warning that FILENAME will be treated as documentary even though it is a valid data-item in working-storage because the compiler interprets this statement as having two data items in the assign clause which is allowed but the second item will be treated as documentary.

If you change "DISC" to "DISK" it works as expected.

View solution in original post

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: SELECT & TO DISC in Visual COBOL for Unix

Jump to solution
You could also use the checker directive:

addsyn"disk"="disc"

If you did not want to change your code.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: SELECT & TO DISC in Visual COBOL for Unix

Jump to solution
Thanks a lot!
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.