Skip to main content

[Migrated content. Thread originally posted on 05 January 2012]

Hello,



I have this piece of code in a Visual Cobol program.
This works correctly; it display the first line from the result of execute the next command: “cd outEcl;ls -lo 2>/dev/null|awk '/^-r/{print $8}'”



       ...     
       SELECT MANIOBRA
       ASSIGN TO INPUT LOC-MANIOBRA
       ORGANIZATION LINE SEQUENTIAL.
       ...
       FD  MANIOBRA
           LABEL RECORD STANDARD.
       01  ART-MANIOBRA            PIC X(25).
       ...

            INITIALIZE LOC-MANIOBRA.
                STRING "
                "outEcl"           DELIMITED BY " "
                ";ls -lo"          DELIMITED BY SIZE
                " 2>/dev/null|awk '/^-r/{print $8}' "
                                   DELIMITED BY SIZE
                INTO LOC-MANIOBRA
            END-STRING.
            OPEN INPUT MANIOBRA.
            READ MANIOBRA NEXT.
            DISPLAY ART-MANIOBRA.

            CLOSE MANIOBRA.


I have configured the program in VisualCobol to work with the RM/COBOL File Handler (using CALLFH(ACUFH) compiler directive, etc.), and then the programs returns the next error:

I/O error : file '
error code: 3/5 (ANS85), pc=0, call=1, seg=0                                   
13    File not found     


Is it possible that I need any additional configuration??


Thank you

[Migrated content. Thread originally posted on 05 January 2012]

Hello,



I have this piece of code in a Visual Cobol program.
This works correctly; it display the first line from the result of execute the next command: “cd outEcl;ls -lo 2>/dev/null|awk '/^-r/{print $8}'”



       ...     
       SELECT MANIOBRA
       ASSIGN TO INPUT LOC-MANIOBRA
       ORGANIZATION LINE SEQUENTIAL.
       ...
       FD  MANIOBRA
           LABEL RECORD STANDARD.
       01  ART-MANIOBRA            PIC X(25).
       ...

            INITIALIZE LOC-MANIOBRA.
                STRING "
                "outEcl"           DELIMITED BY " "
                ";ls -lo"          DELIMITED BY SIZE
                " 2>/dev/null|awk '/^-r/{print $8}' "
                                   DELIMITED BY SIZE
                INTO LOC-MANIOBRA
            END-STRING.
            OPEN INPUT MANIOBRA.
            READ MANIOBRA NEXT.
            DISPLAY ART-MANIOBRA.

            CLOSE MANIOBRA.


I have configured the program in VisualCobol to work with the RM/COBOL File Handler (using CALLFH(ACUFH) compiler directive, etc.), and then the programs returns the next error:

I/O error : file '
error code: 3/5 (ANS85), pc=0, call=1, seg=0                                   
13    File not found     


Is it possible that I need any additional configuration??


Thank you
It looks like the "OPEN INPUT" is failing, giving an error 35 i.e. 3/5.
Is it possible it thinks the file it is opening is named '

35 An OPEN operation with the I-O, INPUT, or EXTEND phrases has been tried on a non-OPTIONAL file that is not present.

[Migrated content. Thread originally posted on 05 January 2012]

Hello,



I have this piece of code in a Visual Cobol program.
This works correctly; it display the first line from the result of execute the next command: “cd outEcl;ls -lo 2>/dev/null|awk '/^-r/{print $8}'”



       ...     
       SELECT MANIOBRA
       ASSIGN TO INPUT LOC-MANIOBRA
       ORGANIZATION LINE SEQUENTIAL.
       ...
       FD  MANIOBRA
           LABEL RECORD STANDARD.
       01  ART-MANIOBRA            PIC X(25).
       ...

            INITIALIZE LOC-MANIOBRA.
                STRING "
                "outEcl"           DELIMITED BY " "
                ";ls -lo"          DELIMITED BY SIZE
                " 2>/dev/null|awk '/^-r/{print $8}' "
                                   DELIMITED BY SIZE
                INTO LOC-MANIOBRA
            END-STRING.
            OPEN INPUT MANIOBRA.
            READ MANIOBRA NEXT.
            DISPLAY ART-MANIOBRA.

            CLOSE MANIOBRA.


I have configured the program in VisualCobol to work with the RM/COBOL File Handler (using CALLFH(ACUFH) compiler directive, etc.), and then the programs returns the next error:

I/O error : file '
error code: 3/5 (ANS85), pc=0, call=1, seg=0                                   
13    File not found     


Is it possible that I need any additional configuration??


Thank you
This appears to be a problem with the Vision File Handler as it works correctly when not using the CALLFH"ACUFH" directive.

This fails when using both ACU Vision files and RM/COBOL files and works when using the default Visual COBOL file handler.

I have created an RPI for development to look at.

A possible workaround would be to call a subprogram which was not compiled with CALLFH"ACUFH" and have it do the file processing for this particular file.

I tried this here and it worked fine for me.

[Migrated content. Thread originally posted on 05 January 2012]

Hello,



I have this piece of code in a Visual Cobol program.
This works correctly; it display the first line from the result of execute the next command: “cd outEcl;ls -lo 2>/dev/null|awk '/^-r/{print $8}'”



       ...     
       SELECT MANIOBRA
       ASSIGN TO INPUT LOC-MANIOBRA
       ORGANIZATION LINE SEQUENTIAL.
       ...
       FD  MANIOBRA
           LABEL RECORD STANDARD.
       01  ART-MANIOBRA            PIC X(25).
       ...

            INITIALIZE LOC-MANIOBRA.
                STRING "
                "outEcl"           DELIMITED BY " "
                ";ls -lo"          DELIMITED BY SIZE
                " 2>/dev/null|awk '/^-r/{print $8}' "
                                   DELIMITED BY SIZE
                INTO LOC-MANIOBRA
            END-STRING.
            OPEN INPUT MANIOBRA.
            READ MANIOBRA NEXT.
            DISPLAY ART-MANIOBRA.

            CLOSE MANIOBRA.


I have configured the program in VisualCobol to work with the RM/COBOL File Handler (using CALLFH(ACUFH) compiler directive, etc.), and then the programs returns the next error:

I/O error : file '
error code: 3/5 (ANS85), pc=0, call=1, seg=0                                   
13    File not found     


Is it possible that I need any additional configuration??


Thank you
Look at this:
I/O error : file '
error code: 3/5 (ANS85), pc=0, call=1, seg=0                                   
13    File not found

What is COBOL unable to find?
file '
The character '
STRING "
... should be a pipeline '|' instead.
Please, try again...

[Migrated content. Thread originally posted on 05 January 2012]

Hello,



I have this piece of code in a Visual Cobol program.
This works correctly; it display the first line from the result of execute the next command: “cd outEcl;ls -lo 2>/dev/null|awk '/^-r/{print $8}'”



       ...     
       SELECT MANIOBRA
       ASSIGN TO INPUT LOC-MANIOBRA
       ORGANIZATION LINE SEQUENTIAL.
       ...
       FD  MANIOBRA
           LABEL RECORD STANDARD.
       01  ART-MANIOBRA            PIC X(25).
       ...

            INITIALIZE LOC-MANIOBRA.
                STRING "
                "outEcl"           DELIMITED BY " "
                ";ls -lo"          DELIMITED BY SIZE
                " 2>/dev/null|awk '/^-r/{print $8}' "
                                   DELIMITED BY SIZE
                INTO LOC-MANIOBRA
            END-STRING.
            OPEN INPUT MANIOBRA.
            READ MANIOBRA NEXT.
            DISPLAY ART-MANIOBRA.

            CLOSE MANIOBRA.


I have configured the program in VisualCobol to work with the RM/COBOL File Handler (using CALLFH(ACUFH) compiler directive, etc.), and then the programs returns the next error:

I/O error : file '
error code: 3/5 (ANS85), pc=0, call=1, seg=0                                   
13    File not found     


Is it possible that I need any additional configuration??


Thank you
No, this should work as specified as it is actually redirecting the stdout output from the "ls" command to the open so the READ next will read a line at a time of the output.

The pipe symbol "|" connects the output to the next command in the pipe so would be used to send output of a write statement to the stdin of another command.

Without CALLFH"ACUFH" it works correctly as specified.

[Migrated content. Thread originally posted on 05 January 2012]

Hello,



I have this piece of code in a Visual Cobol program.
This works correctly; it display the first line from the result of execute the next command: “cd outEcl;ls -lo 2>/dev/null|awk '/^-r/{print $8}'”



       ...     
       SELECT MANIOBRA
       ASSIGN TO INPUT LOC-MANIOBRA
       ORGANIZATION LINE SEQUENTIAL.
       ...
       FD  MANIOBRA
           LABEL RECORD STANDARD.
       01  ART-MANIOBRA            PIC X(25).
       ...

            INITIALIZE LOC-MANIOBRA.
                STRING "
                "outEcl"           DELIMITED BY " "
                ";ls -lo"          DELIMITED BY SIZE
                " 2>/dev/null|awk '/^-r/{print $8}' "
                                   DELIMITED BY SIZE
                INTO LOC-MANIOBRA
            END-STRING.
            OPEN INPUT MANIOBRA.
            READ MANIOBRA NEXT.
            DISPLAY ART-MANIOBRA.

            CLOSE MANIOBRA.


I have configured the program in VisualCobol to work with the RM/COBOL File Handler (using CALLFH(ACUFH) compiler directive, etc.), and then the programs returns the next error:

I/O error : file '
error code: 3/5 (ANS85), pc=0, call=1, seg=0                                   
13    File not found     


Is it possible that I need any additional configuration??


Thank you
I was trusting my memory, but now I am at the office, and found several examples using the pipeline:
              INITIALIZE LOC-FICHCMD
              STRING "|ls -rt " FICH331-PROPIA2-W
                     "/*.idx 2>/dev/null"
                     DELIMITED BY SIZE
                INTO LOC-FICHCMD
              END-STRING

           STRING  "|ls -F "                        DELIMITED BY SIZE
                   BUZON-REFERENCIAS                DELIMITED BY SPACE
                   "*INVENTORY*41231.CSV"           DELIMITED BY SIZE
                   " 2>/dev/null"                   DELIMITED BY SIZE
             INTO LOC-FICHCMD
           END-STRING.

           MOVE SPACES TO LOC-FICHCMD.
           STRING "| ps -ef | grep "   DELIMITED BY SIZE
                  TTY-3                DELIMITED BY SPACE
                  "/"                  DELIMITED BY SIZE
                  TTY-4                DELIMITED BY SPACE
                     INTO LOC-FICHCMD
           END-STRING

For some reason, I never used the redirection with "

When mikmng arrives, we will have a try on this, nevertheless (he is my co-worker) :-)

[Migrated content. Thread originally posted on 05 January 2012]

Hello,



I have this piece of code in a Visual Cobol program.
This works correctly; it display the first line from the result of execute the next command: “cd outEcl;ls -lo 2>/dev/null|awk '/^-r/{print $8}'”



       ...     
       SELECT MANIOBRA
       ASSIGN TO INPUT LOC-MANIOBRA
       ORGANIZATION LINE SEQUENTIAL.
       ...
       FD  MANIOBRA
           LABEL RECORD STANDARD.
       01  ART-MANIOBRA            PIC X(25).
       ...

            INITIALIZE LOC-MANIOBRA.
                STRING "
                "outEcl"           DELIMITED BY " "
                ";ls -lo"          DELIMITED BY SIZE
                " 2>/dev/null|awk '/^-r/{print $8}' "
                                   DELIMITED BY SIZE
                INTO LOC-MANIOBRA
            END-STRING.
            OPEN INPUT MANIOBRA.
            READ MANIOBRA NEXT.
            DISPLAY ART-MANIOBRA.

            CLOSE MANIOBRA.


I have configured the program in VisualCobol to work with the RM/COBOL File Handler (using CALLFH(ACUFH) compiler directive, etc.), and then the programs returns the next error:

I/O error : file '
error code: 3/5 (ANS85), pc=0, call=1, seg=0                                   
13    File not found     


Is it possible that I need any additional configuration??


Thank you
I was trusting my memory, but now I am at the office, and found several examples using the pipeline:
              INITIALIZE LOC-FICHCMD
              STRING "|ls -rt " FICH331-PROPIA2-W
                     "/*.idx 2>/dev/null"
                     DELIMITED BY SIZE
                INTO LOC-FICHCMD
              END-STRING

           STRING  "|ls -F "                        DELIMITED BY SIZE
                   BUZON-REFERENCIAS                DELIMITED BY SPACE
                   "*INVENTORY*41231.CSV"           DELIMITED BY SIZE
                   " 2>/dev/null"                   DELIMITED BY SIZE
             INTO LOC-FICHCMD
           END-STRING.

           MOVE SPACES TO LOC-FICHCMD.
           STRING "| ps -ef | grep "   DELIMITED BY SIZE
                  TTY-3                DELIMITED BY SPACE
                  "/"                  DELIMITED BY SIZE
                  TTY-4                DELIMITED BY SPACE
                     INTO LOC-FICHCMD
           END-STRING

For some reason, I never used the redirection with "

When mikmng arrives, we will have a try on this, nevertheless (he is my co-worker) :-)

[Migrated content. Thread originally posted on 05 January 2012]

Hello,



I have this piece of code in a Visual Cobol program.
This works correctly; it display the first line from the result of execute the next command: “cd outEcl;ls -lo 2>/dev/null|awk '/^-r/{print $8}'”



       ...     
       SELECT MANIOBRA
       ASSIGN TO INPUT LOC-MANIOBRA
       ORGANIZATION LINE SEQUENTIAL.
       ...
       FD  MANIOBRA
           LABEL RECORD STANDARD.
       01  ART-MANIOBRA            PIC X(25).
       ...

            INITIALIZE LOC-MANIOBRA.
                STRING "
                "outEcl"           DELIMITED BY " "
                ";ls -lo"          DELIMITED BY SIZE
                " 2>/dev/null|awk '/^-r/{print $8}' "
                                   DELIMITED BY SIZE
                INTO LOC-MANIOBRA
            END-STRING.
            OPEN INPUT MANIOBRA.
            READ MANIOBRA NEXT.
            DISPLAY ART-MANIOBRA.

            CLOSE MANIOBRA.


I have configured the program in VisualCobol to work with the RM/COBOL File Handler (using CALLFH(ACUFH) compiler directive, etc.), and then the programs returns the next error:

I/O error : file '
error code: 3/5 (ANS85), pc=0, call=1, seg=0                                   
13    File not found     


Is it possible that I need any additional configuration??


Thank you
Chris: as always you are right. This seem to be a problem in Visual COBOL, and does not matter if you are using "

I have tried a similar thing under Windows and, surprisingly, it does not work in Visual COBOL neither in RM.

[Migrated content. Thread originally posted on 05 January 2012]

Hello,



I have this piece of code in a Visual Cobol program.
This works correctly; it display the first line from the result of execute the next command: “cd outEcl;ls -lo 2>/dev/null|awk '/^-r/{print $8}'”



       ...     
       SELECT MANIOBRA
       ASSIGN TO INPUT LOC-MANIOBRA
       ORGANIZATION LINE SEQUENTIAL.
       ...
       FD  MANIOBRA
           LABEL RECORD STANDARD.
       01  ART-MANIOBRA            PIC X(25).
       ...

            INITIALIZE LOC-MANIOBRA.
                STRING "
                "outEcl"           DELIMITED BY " "
                ";ls -lo"          DELIMITED BY SIZE
                " 2>/dev/null|awk '/^-r/{print $8}' "
                                   DELIMITED BY SIZE
                INTO LOC-MANIOBRA
            END-STRING.
            OPEN INPUT MANIOBRA.
            READ MANIOBRA NEXT.
            DISPLAY ART-MANIOBRA.

            CLOSE MANIOBRA.


I have configured the program in VisualCobol to work with the RM/COBOL File Handler (using CALLFH(ACUFH) compiler directive, etc.), and then the programs returns the next error:

I/O error : file '
error code: 3/5 (ANS85), pc=0, call=1, seg=0                                   
13    File not found     


Is it possible that I need any additional configuration??


Thank you
Under Windows you need to specify the command processor "CMD /C" as part of the command to execute:

The following works under Windows:


       identification division.
       program-id. Program1.

       environment division.
       configuration section.
           select test-file assign to field1
                            organization is line sequential
                            file status is file-status.
       data division.
       file section.
       fd test-file.
       01 test-record    pic x(80).
       working-storage section.
       01 field1   pic x(20) value "
       01 file-status pic x(2).
       procedure division.

           open input test-file
           display file-status
           read test-file
              at end
                 display "at end"
           end-read
           display file-status
           display test-record
           goback.

       end program Program1.

[Migrated content. Thread originally posted on 05 January 2012]

Hello,



I have this piece of code in a Visual Cobol program.
This works correctly; it display the first line from the result of execute the next command: “cd outEcl;ls -lo 2>/dev/null|awk '/^-r/{print $8}'”



       ...     
       SELECT MANIOBRA
       ASSIGN TO INPUT LOC-MANIOBRA
       ORGANIZATION LINE SEQUENTIAL.
       ...
       FD  MANIOBRA
           LABEL RECORD STANDARD.
       01  ART-MANIOBRA            PIC X(25).
       ...

            INITIALIZE LOC-MANIOBRA.
                STRING "
                "outEcl"           DELIMITED BY " "
                ";ls -lo"          DELIMITED BY SIZE
                " 2>/dev/null|awk '/^-r/{print $8}' "
                                   DELIMITED BY SIZE
                INTO LOC-MANIOBRA
            END-STRING.
            OPEN INPUT MANIOBRA.
            READ MANIOBRA NEXT.
            DISPLAY ART-MANIOBRA.

            CLOSE MANIOBRA.


I have configured the program in VisualCobol to work with the RM/COBOL File Handler (using CALLFH(ACUFH) compiler directive, etc.), and then the programs returns the next error:

I/O error : file '
error code: 3/5 (ANS85), pc=0, call=1, seg=0                                   
13    File not found     


Is it possible that I need any additional configuration??


Thank you
This functionality to assign to pipes when using CALLFH"ACUFH" will be added to a future release of Visual COBOL.

As a workaround you could place your code that accesses the pipes into a subprogram which is compiled without the directive CALLFH"ACUFH" and then call this from your program that is compiled with CALLFH"ACUFH".

In this manner you could still access ACU/RMCOBOL files in your main program and you could access these pipes in the subprogram because they will each use their own file handler.

I tested this here and it worked correctly.