|
» |
|
|
|
This program shows how to sort an input file (formal designator FTN21)
to an output file (formal designator FTN22) using
the SORTINIT intrinsic call.
1 $CONTROL USLINIT,FILE=21-22
2 PROGRAM EXMP
3 INTEGER FNUM
4 INTEGER N(4)
5 INTEGER KEYS (3)
6 INTEGER CSEQ (2)
7 SYSTEM INTRINSIC SORTINIT, SORTEND
8 C
9 C KEY (3) = 9 character type key
10 C CSEQ(2) = 12 Spanish collating sequence
11 C
12 KEYS (1) = 1
13 KEYS (2) = 4
14 KEYS (3) = 9
15 CSEQ (1) = 1
16 CSEQ (2) = 12
17 C
18 C Sort file FTN21 into FTN22
19 C
20 N (1) = FNUM (21)
21 N (3) = FNUM (22)
22 N (2) = 0
23 N (4) = 0
24 CALL SORTINIT (N(1),N(3),,,,1,KEYS,,,,,,,,CSEQ)
25 CALL SORTEND
26 STOP
27 END
|
In the example execution, the input and output
files are associated with the terminal ($STDIN and $STDLIST):
:FILE FTN21=$STDIN
:FILE FTN22=$STDLIST
:RUN PROGRAM;MAXDATA=12000
character
credit
DEBIT
:EOD
credit
character
DEBIT
END OF PROGRAM
:
|
|