Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SORT-MERGE FILE CAN ONLY SPECIFY FILE-IDENTIFIER IN ASSIGN CLAUSE

Status
Not open for further replies.

coblan19

Programmer
Dec 10, 2003
3
CR
write a code source using sort in fujistu cobol85 V30L10 ,when I compile it ,there is always a error message:"SORT-MERGE FILE CAN ONLY SPECIFY FILE-IDENTIFIER IN ASSIGN CLAUSE."


SELECT ARCH-SORT ASSIGN TO DISK.

FILE-CONTROL.
SELECT TABLA ASSIGN TO DISK
ORGANIZATION IS INDEXED
ACCESS MODE IS RANDOM
RECORD KEY IS NOMBRE-ID.
SELECT ARCH-SORT ASSIGN TO DISK.
SELECT SALIDA ASSIGN TO DISK
ORGANIZATION IS LINE SEQUENTIAL.
SELECT EQUIPOS ASSIGN TO DISK
ORGANIZATION IS RELATIVE
ACCESS MODE IS RANDOM
RELATIVE KEY CODIGO-EQ.
SELECT MOVIMIENTOS ASSIGN TO DISK
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
SD ARCH-SORT.
01 REG-ARCH-SORT.
03 NOMBRE-0 PIC X(10).
03 GOLESF-0 PIC 99.
03 GOLESC-0 PIC 99.
03 TOTAL-PO PIC 99.
FD TABLA.
01 REG-TABLA.
03 NOMBRE-ID PIC X(10).
03 GOLES-F PIC 99.
03 GOLES-C PIC 99.
03 TOTAL-PUNTOS PIC 99.
FD SALIDA.
01 REG-SALIDA.
03 NOMBRE-SAL PIC X(10).
03 GOLESF-SAL PIC 99.
03 GOLESC-SAL PIC 99.
03 TOTAL-PUNTOS-SAL PIC 99.
FD EQUIPOS.
01 REG-EQUIPOS.
03 CODIGO-EQUIPO PIC 99.
03 DESCRIPCION PIC X(10).
FD MOVIMIENTOS.
01 REG-MOVIMIENTOS.
03 CODIGO-MOV-1 PIC 99.
03 RESULTADO-1 PIC 99.
03 CODIGO-MOV-2 PIC 99.
03 RESULTADO-2 PIC 99.
 
I have not used sort with the Fujitsu Compiler however, Here is what Version 7 compiler documentation says about your ASSIGN clause:
-----------------------------
ASSIGN Clause (Sort-merge and Report Writer)

This clause associates a file with an external medium.
[Format]
file-identifier-1
[ASSIGN TO ...]
File-identifier-literal-1

Syntax Rules
The format of file-identifier-1 is shown below.
[comment-]name
Specify an external file name in “name.” “name” must be a
character-string not exceeding eight characters and consist of only alphabetic and numeric characters. The first character in “name” must be an alphabetic character.

General Rules
1. file-identifier-1 specifies the physical file name of the file to be referenced.
2. When more than one file-identifier-1 descriptions has been specified, the second and subsequent descriptions are regarded as comments.
3. The ASSIGN clause of a sort-merge file is treated as a comment.
-----------------------
The above looks as if "DISK" is not valid on a sort merge file. There are other comments in my documentation that says Sort/Merge allocates it's own internal file and ignores your file name specified in the Select clause.

Try:

SELECT ARCH-SORT ASSIGN TO "MYSORT".

etom
 
Another way is this

Select sort-file assign to srtfile1.

srtfile1 does not need to be defined anywhere else. This works with version 5, 6, and 7. If you are using the PowerCobol it cannot be defined global.

bawstl
 
Here is a sort program that worked in Fujirsu 3.0

the work file can be a name of up to 8 characters like SORTWORK and the input/output files specify a file-name-character-string
or the name of an 01 variable area in working storage that contains the character-string.

Hope this helps.


000010****************************************************************
000020* START OF THE IDENTIFICATION DIVISION *
000030****************************************************************
000040 IDENTIFICATION DIVISION.
000050 PROGRAM-ID. ASORTTRY.
000060****************************************************************
000070* START OF THE ENVIRONMENT DIVISION *
000080****************************************************************
000090 ENVIRONMENT DIVISION.
000100 CONFIGURATION SECTION.
000110 INPUT-OUTPUT SECTION.
000120 FILE-CONTROL.
000130 SELECT SORT-WORK-FILE
000140 ASSIGN TO SORTWORK.
000150 SELECT FILE-IN
000160 ASSIGN TO "C:\COBOL\INV_RPT.TXT"
000170 ORGANIZATION IS LINE SEQUENTIAL.
000180 SELECT FILE-OUT
000190 ASSIGN TO "C:\COBOL\INV_RPTX.SRT"
000200 ORGANIZATION IS LINE SEQUENTIAL.
000210****************************************************************
000220* START OF THE DATA DIVISION *
000230****************************************************************
000240 DATA DIVISION.
000250 FILE SECTION.
000260 SD SORT-WORK-FILE.
000270 01 SORT-RECORD.
000280 03 ITEM PIC X(6).
000290 03 DESCRIPTION PIC X(20).
000300 03 UNITCOST PIC 99V99.
000310 03 UNITSELL PIC 99V99.
000320 03 ONHAND PIC 9(4).
000330 03 ONORDER PIC 9(4).
000340 03 ORDERPOINT PIC 9(4).
000350 03 FILLER PIC X(34).
000360 FD FILE-IN.
000370 01 INPUT-RECORD.
000380 03 ITEM PIC X(6).
000390 03 DESCRIPTION PIC X(20).
000400 03 UNITCOST PIC 99V99.
000410 03 UNITSELL PIC 99V99.
000420 03 ONHAND PIC 9(4).
000430 03 ONORDER PIC 9(4).
000440 03 ORDERPOINT PIC 9(4).
000450 03 FILLER PIC X(34).
000460 FD FILE-OUT.
000470 01 OUTPUT-RECORD.
000480 03 ITEM PIC X(6).
000490 03 DESCRIPTION PIC X(20).
000500 03 UNITCOST PIC 99V99.
000510 03 UNITSELL PIC 99V99.
000520 03 ONHAND PIC 9(4).
000530 03 ONORDER PIC 9(4).
000540 03 ORDERPOINT PIC 9(4).
000550 03 FILLER PIC X(34).
000560 WORKING-STORAGE SECTION.
000590****************************************************************
000600* START OF THE PROCEDURE DIVISION *
000610****************************************************************
000620 PROCEDURE DIVISION.
000660 MAINLINE.
000670 SORT SORT-WORK-FILE
000680 ON ASCENDING KEY ITEM IN SORT-RECORD
000690 USING FILE-IN
000700 GIVING FILE-OUT.
000710 STOP RUN.
000720 END PROGRAM ASORTTRY.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top