The file exists, has been read, but is unable to be sorted hereby.
Any ideas? (& thanks!)
*> Mission: EXTERNAL FILE SORTING.*> Demonstrate "FILE CHAR SORT" (EXTERNAL)*> cobc -x -j -free EX_SORT_FILE_CHARS2.cob*> STATUS: error: invalid SORT filename IDENTIFICATIONDIVISION.PROGRAM-ID.EX_SORT_FILE_CHARS2.ENVIRONMENTDIVISION.INPUT-OUTPUTSECTION.FILE-CONTROL.*> THE-CHARS.SDF = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ\n'*> od -a THE-CHARS.SDF*> 0000000 A B C D E F G H I J K L M N O P*> 0000020 Q R S T U V W X Y Z nl*> 0000033SELECTCOBOL-FILEASSIGNTO 'THE-CHARS.SDF'FILESTATUSISFS-COBOL.*> SORTING.TMP = Not CreatedSELECTSORT-FILEASSIGNTO 'SORTING.TMP'FILESTATUSISFS-TMP.*> SORTED.SDF = Not CreatedSELECTSORTED-FILEASSIGNTO 'SORTED.SDF'FILESTATUSISFS-SORTED.DATADIVISION.FILESECTION.FDCOBOL-FILERECORDCONTAINS1 CHARACTERSDATARECORDISZ-BUFFER.01 Z-BUFFER.05 CHAR-ONEPIC X.FDSORT-FILERECORDCONTAINS1 CHARACTERSDATARECORDISBUFFER2.01 BUFFER2.05 CHAR2PIC X.FDSORTED-FILERECORDCONTAINS1 CHARACTERSDATARECORDISBUFFER3.01 BUFFER3.05 CHAR3PIC X.WORKING-STORAGESECTION.01 FS-COBOLPIC 99.01 FS-SORTEDPIC 99.01 FS-TMPPIC 99.PROCEDUREDIVISION.DISPLAY 'Begin.'SORTSORT-FILEDESCENDINGKEYCHAR2USINGCOBOL-FILEGIVINGSORTED-FILE.DISPLAY 'Done: 'FS-COBOL.STOPRUN.
"<command-line>: warning: "_FORTIFY_SOURCE" redefined
<command-line>: note: this is the location of the previous definition"</command-line></command-line>
?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well without the context I can't say. The Redefined error is just a warning, it could be redefining something with a different record length. The other may have something to do with it or something completely different. Good Luck!
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The file exists, has been read, but is unable to be sorted hereby.
Any ideas? (& thanks!)
Last edit: Simon Sobisch 2024-12-06
try changing:
SELECT SORT-FILE
ASSIGN TO 'SORTING.TMP'
FILE STATUS IS FS-TMP.
change to: select sort-file assign to dummy.
And change the FD for the sort-file to an SD.
Works well now - thank you!
p.s. Any idea what is meant by either / any:
"<command-line>: warning: "_FORTIFY_SOURCE" redefined
<command-line>: note: this is the location of the previous definition"</command-line></command-line>
?
Well without the context I can't say. The Redefined error is just a warning, it could be redefining something with a different record length. The other may have something to do with it or something completely different. Good Luck!
That is a warning message by the C preprocessor.
How did you install GnuCOBOL - and what is the output of
cobc -xv -free EX_SORT_FILE_CHARS2.cob
?Last edit: Simon Sobisch 2024-12-06
Installed:
sudo apt-get install gcc make perl
sudo apt-get install gnucobol3
Diag:
cobc -xv -free EX_SORT_FILE_CHARS2.cob
cobc (GnuCOBOL) 3.1.2.0
Built Apr 14 2024 07:59:15 Packaged Dec 23 2020 12:04:58 UTC
C version "13.2.0"
loading standard configuration file 'default.conf'
command line: cobc -xv -free EX_SORT_FILE_CHARS2.cob
preprocessing: EX_SORT_FILE_CHARS2.cob -> /tmp/cob3250_0.cob
return status: 0
parsing: /tmp/cob3250_0.cob (EX_SORT_FILE_CHARS2.cob)
return status: 0
translating: /tmp/cob3250_0.cob -> /tmp/cob3250_0.c (EX_SORT_FILE_CHARS2.cob)
executing: gcc -c -finline-functions -D_FORTIFY_SOURCE=2 -ggdb3 -pipe
-Wdate-time -D_FORTIFY_SOURCE=3 -Wno-unused -fsigned-char
-Wno-pointer-sign -o "/tmp/cob3250_0.o" "/tmp/cob3250_0.c"
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<command-line>: note: this is the location of the previous definition
return status: 0
executing: gcc -Wl,--export-dynamic -o "EX_SORT_FILE_CHARS2"
"/tmp/cob3250_0.o" -Wl,-Bsymbolic-functions -flto=auto
-ffat-lto-objects -Wl,-z,relro -L/usr/lib/x86_64-linux-gnu
-lcob -lm
return status: 0</command-line></command-line>
Using an older Ubuntu VM I archived awhile back solved the problem:
/media/sf_d_drive/cob$ cobc -xv -free EX_SORT_FILE_CHARS2.cob
cobc (GnuCOBOL) 2.2.0
Built Jul 17 2018 20:29:40 Packaged Sep 06 2017 18:48:43 UTC
C version "8.1.0"
loading standard configuration file 'default.conf'
command line: cobc -xv -free EX_SORT_FILE_CHARS2.cob
preprocessing: EX_SORT_FILE_CHARS2.cob -> /tmp/cob2107_0.cob
return status: 0
parsing: /tmp/cob2107_0.cob (EX_SORT_FILE_CHARS2.cob)
return status: 0
translating: /tmp/cob2107_0.cob -> /tmp/cob2107_0.c (EX_SORT_FILE_CHARS2.cob)
executing: gcc -c -Wno-unused -fsigned-char -Wno-pointer-sign -Wdate-time
-finline-functions -U_FORTIFY_SOURCE -pipe -o
"/tmp/cob2107_0.o" "/tmp/cob2107_0.c"
return status: 0
executing: gcc -Wl,--export-dynamic -o "EX_SORT_FILE_CHARS2"
"/tmp/cob2107_0.o" -Wl,-Bsymbolic-functions -Wl,-z,relro
-Wl,-Bsymbolic-functions -Wl,-z,relro
-L/usr/lib/x86_64-linux-gnu -lcob -lm -lgmp -lncursesw
-ldb-5.3 -ldl
return status: 0
/media/sf_d_drive/cob$
Last edit: Randall Nagy 2024-12-21