User Tools

Site Tools


cdc:nos2.source:opl871:sort

Table of Contents

SORT

Table Of Contents

  • [00010] SORT - FILE SORT ROUTINE
  • [00012] FILE SORT ROUTINE
  • [00087] MAIN PROGRAM.
  • [00157] SUBROUTINES.
  • [00159] GLT - GENERATE LINE NUMBER TABLE.
  • [00254] MER - MERGE LAST SORTED SEGMENT WITH NEW INPUT USING DATA
  • [00393] ELK - END OF LINE CHECK
  • [00462] PRESET.

Source Code

SORT.txt
  1. IDENT SORT,FETS,SORT
  2. ABS
  3. SST
  4. ENTRY SORT
  5. ENTRY MFL=
  6. ENTRY SSM=
  7. SYSCOM B1 DEFINE (B1) = 1
  8. *COMMENT SORT - FILE SORT ROUTINE.
  9. COMMENT COPYRIGHT CONTROL DATA SYSTEMS INC. 1992.
  10. TITLE SORT - FILE SORT ROUTINE
  11. SPACE 4
  12. *** SORT - FILE SORT ROUTINE
  13. * W.T. SACKETT 71/03/01.
  14. *
  15. * SORT READS THE INPUT FILE IN SEGMENTS, SORTS THEM AND MERGES
  16. * RESULT WITH THE PREVIOUSLY SORTED PORTION OF THE FILE.
  17. * THE SORT IS BASED ON THE FIRST *NC* (DEFAULT = 5) CHARACTERS
  18. * OF THE LINE NUMBER FOR EACH LINE. THE LINE NUMBER ENTERED
  19. * LAST BEING THE CORRECTION LINE, REPLACING ANY LINES HAVING
  20. * THE SAME LINE NUMBER. A LINE NUMBER FOLLOWED BY AN EMPTY
  21. * LINE IS CONSIDERED A LINE DELETE.
  22. * NOTES 1) LINE NUMBER, ONE BLANK, CARRAIGE RETURN IS ALSO
  23. * CONSIDERED A LINE DELETE. 2) A LINE NUMBER HAVING MORE THAN
  24. * *NC* CHARACTERS IS NOT CHECKED FOR LINE DELETE SO TO DELETE
  25. * SUCH LINES TYPE ONLY *NC* CHARACTERS THEN CARRAIGE RETURN.
  26. * 3) DIRECT ACCESS FILES MAY BE SORTED.
  27. SPACE 4
  28. *** COMMAND CALL.
  29. *
  30. * SORT,I. I = NAME OF INPUT FILE TO BE SORTED.
  31. *
  32. * OR, SORT,I,NC=N. IN WHICH CASE THE SORT IS DONE ONLY ON
  33. * THE FIRST N ( .LE. 10 ) CHARACTERS OF THE LINE NUMBER.
  34. * IF NO NC PARAMETER IS SPECIFIED N IS ASSUMED TO BE 5.
  35. SPACE 4
  36. *** DAYFILE MESSAGES.
  37. *
  38. * * NO LINE NUMBER ON SORT FILE.* = SOME LINE ON INPUT FILE
  39. * IS MISSING A LINE NUMBER. CAN ALSO MEAN A LINE WAS TOO LONG,
  40. * (160 CHARACTER MAX LINE SIZE). SORT FILE IS NOT REWRITTEN.
  41. *
  42. * * INCORRECT SORT PARAMETER.* = SORT COMMAND IS INCORRECT.
  43. *
  44. * * EMPTY SORT INPUT FILE.*
  45. *
  46. * * INCORRECT WRITE ON READ ONLY FILE.* (CIO ERROR 03) = DIRECT
  47. * ACCESS INPUT FILE WAS NOT ATTACHED IN WRITE MODE.
  48. *
  49. * * RESERVED FILE NAME.* - FILE NAME SPECIFIED ON *SORT*
  50. * CONTROL CARD IS RESERVED FOR USE BY THE EDITOR (ZZZZZG0,
  51. * ZZZZZG1).
  52. SPACE 4,10
  53. *CALL COMCMAC
  54. *CALL COMCCMD
  55. *CALL COMSREM
  56. SPACE 4,10
  57. ORG 110B
  58. FETS BSS 0
  59.  
  60.  
  61. ** ASSEMBLY CONSTANTS.
  62.  
  63. DAF CON 0 FILE TYPE FLAG (0 = DIRECT ACCESS)
  64. ELAD CON 0 ADDRESS OF PARTIAL LINE
  65. ELCH CON 0 NUMBER OF WORDS IN PARTIAL LINE
  66. LS CON -1 LAST LINE NUMBER ON MERGE FILE (ZZZZZG1)
  67. NC CON 5 NUMBER OF DIGITS TO SORT ON
  68. NMZZZG1 VFD 42/0LZZZZZG1,18/15B
  69. BUFL EQU 2001B LENGTH OF SCRATCH *CIO* BUFFERS
  70. WL EQU VXLL/5+1 WORKING BUFFER LENGTH
  71. SPACE 4
  72. ** FET DEFINITIONS.
  73.  
  74. ZZZZZG1 RFILEB G1BUF,BUFL,(FET=7)
  75. ZZZZZG0 RFILEB G0BUF,BUFL,(FET=7)
  76. I RFILEB IBUF,1,(FET=7)
  77. RPB SPACE 4,10
  78. * *REPRIEVE* PARAMETER BLOCK.
  79.  
  80.  
  81. RPB BSS 0
  82. VFD 36/0,12/RPBL,12/0
  83. VFD 30/0,30/PIT
  84. BSSZ 7
  85. BSSZ 16 EXCHANGE PACKAGE
  86. RPBL EQU *-RPB
  87. TITLE MAIN PROGRAM.
  88. SPACE 4
  89. SORT SB1 1
  90. RJ PRS PRESET SORT
  91. EQ SOR2 READ FILE
  92.  
  93. SOR1 WRITE ZZZZZG0 FLUSH SORTED DATA
  94. SA3 I+1
  95. SX6 X3
  96. SA6 A3+B1 RESET IN AND OUT TO FIRST
  97. SA6 A6+B1
  98. SA3 ELCH
  99. ZR X3,SOR2 IF NO PARTIAL LINE IN LAST SEGMENT
  100. SA4 ELAD MOVE PARTIAL LINE TO START OF INPUT BUFFER
  101. WRITEW I,X4,X3
  102. SOR2 READEI I,R NEXT SEGMENT FROM INPUT
  103. RECALL ZZZZZG0
  104. SA1 X2
  105. LX1 59-20 CHECK IF NAME IS ZZZZZG1
  106. PL X1,SOR3 IF ZZZZZG0 ALREADY HAS ITS OWN FNT NAME
  107. SA4 ZZZZZG0+6
  108. RENAME ZZZZZG0,ZZZZZG1
  109. RECALL ZZZZZG0
  110. BX6 X4 RESTORE RANDOM ADDRESS
  111. SA6 A4+
  112. SOR3 RJ ELK CHECK END OF BUFFER FOR END OF LINE
  113. SA1 I+2 READ *IN*
  114. SA2 A1+B1 READ *OUT*
  115. BX3 X2-X1
  116. NZ X3,SOR4 IF DATA READ
  117. SA4 GLTA
  118. ZR X4,ERR1 IF EMPTY FILE
  119. EQ SOR5 CHECK FOR EOI
  120.  
  121. SOR4 RJ GLT GENERATE LINE NUMBER TABLE
  122. RJ MER MERGE ZZZZZG1 AND I TO ZZZZZG0
  123. SOR5 SA1 I
  124. LX1 59-9
  125. PL X1,SOR1 IF NOT *EOI* ON INPUT FILE
  126. WRITER ZZZZZG0,R
  127. SA1 DAF
  128. ZR X1,SOR6 IF INPUT FILE WAS DIRECT ACCESS
  129. SA4 X2+6
  130. RENAME X2,I
  131. RECALL X2
  132. BX6 X4 RESTORE RANDOM ADDRESS
  133. SA6 A4
  134. EQ SOR8 END
  135.  
  136. SOR6 REWIND X2,R COPY ZZZZZG0 TO INPUT
  137. READEI X2
  138. SA0 PRS FWA OF WORKING BUFFER
  139. REWIND I,R
  140. SOR7 READW ZZZZZG0,PRS,BUFL-1
  141. SB7 B6-PRS NUMBER OF WORDS TRANSFERRED
  142. SX2 I
  143. BX5 X1
  144. WRITEW X2,A0,B7
  145. PL X5,SOR7 IF COPY NOT COMPLETE
  146. WRITER X2 EMPTY BUFFER
  147. SOR8 MESSAGE =0,1 CLEAR *MS1W* MESSAGE
  148. RETURN ZZZZZG1
  149. ENDRUN
  150.  
  151. ERR MESSAGE (=C* NO LINE NUMBER ON SORT FILE.*),,R
  152. EQ ERR2 ABORT
  153.  
  154. ERR1 MESSAGE (=C* EMPTY SORT INPUT FILE.*),,R
  155. ERR2 REWIND I
  156. ABORT
  157. TITLE SUBROUTINES.
  158. GLT SPACE 4
  159. ** GLT - GENERATE LINE NUMBER TABLE.
  160. *
  161. *T 1/ ,40/ CONVERTED NUMBER ,18/ BUFFER ADDRESS ,1/D
  162. * D = NULL (DELETE) LINE FLAG (SET FOR DELETE)
  163. *
  164. * MAIN LOOP IS IN STACK ON 6600.
  165. *
  166. * ENTRY (X1) = *IN*.
  167. * (X2) = *OUT*.
  168. *
  169. * EXIT (X0) = FWA OF LINE NUMBER TABLE.
  170. * (GLTA) = 1.
  171. *
  172. * USES A - 2, 3, 4, 6, 7.
  173. * B - ALL.
  174. * X - ALL.
  175. *
  176. * CALLS SST.
  177.  
  178.  
  179. GLT SUBR ENTRY/EXIT
  180. SX6 B1
  181. SA6 GLTA SET DATA READ FLAG
  182. SB7 X1 SET STARTING ADDRESS OF LINE NUMBERS
  183. SA2 X2 GET FIRST LINE
  184. MX5 48
  185. BX3 X3-X3
  186. SA4 NC NUMBER OF DIGITS TO SORT ON
  187. BX6 X6-X6
  188. SB4 -1R+ (B4) = -1R+
  189. SB5 X4+B1
  190. NX7,B3 X3 INITIALIZE (X7)=0, (B3)=48
  191. BX1 X2
  192. SB6 B3-B5 (B6) = 48-*NC*-1
  193. MX0 54
  194. SB5 -1R0 (B5) = -1R0
  195. SA7 B7+ PRESET LINE NUMBER TABLE BUFFER ADDRESS
  196. GLT1 IX6 X6+X3 ACCUMULATE LINE NUMBER
  197. LX1 6
  198. BX3 -X0*X1 GET NEXT CHARACTER
  199. SX7 X3+B4 CHECK IF NOT ALPHANUMERIC
  200. BX1 X0*X1 CLEAR CHARACTER BEING PROCESSED
  201. SX3 X3+B5 CHECK IF ALPHABETIC
  202. LX6 4 NOTE - LINE NUMBER CONVERTED TO HEXADECIMAL
  203. BX7 -X7+X3
  204. SB3 B3-B1 COUNT CHARACTER
  205. PL X7,GLT1 LOOP IF NUMERIC
  206. LX6 18-4
  207. LT B3,B6,GLT4 IF OVER MAX NUMBER OF DIGITS TO SORT
  208. ZR X1,GLT5 IF POSSIBLE NULL LINE
  209. GLT2 SX7 A2 SET BUFFER ADDRESS
  210. BX6 X6+X7 BUILD TABLE ENTRY
  211. LX7 X6,B1
  212. SA7 A7+B1 STORE LINE NUMBER TABLE ENTRY
  213. GLT3 BX6 -X5*X2
  214. SA2 A2+B1 READ NEXT WORD
  215. NZ X6,GLT3 IF NOT END OF LINE
  216. BX1 X2
  217. NX3,B3 X6 RE-INITIALIZE (X3)=0, (B3)=48
  218. NZ X2,GLT1 LOOP TO END OF BUFFER
  219. SX0 B7+B1 SET ADDRESS OF LINE NUMBER TABLE
  220. SB2 A2
  221. SA6 A7+B1 SET TERMINATOR
  222. SX1 A6-B7 SET TABLE LENGTH
  223. NE B2,B7,ERR IF END OF BUFFER NOT REACHED
  224. RJ SST= SORT TABLE
  225. EQ GLTX EXIT
  226.  
  227. GLT4 AX6 4 PROCESS ONLY *NC* DIGITS
  228. SB3 B3+B1
  229. LT B3,B6,GLT4 IF STILL NOT LESS THAN *NC* DIGITS
  230. MX7 42
  231. BX6 X7*X6 MASK OFF EXCESS DIGITS
  232. EQ GLT2 LOOP
  233.  
  234. GLT5 SX7 X3+1R0
  235. SX1 X3+1R0-1R LAST CHARACTER BLANK CONSIDERED A DELETE
  236. ZR X7,GLT6 IF PROBABLE DELETE LINE
  237. NZ X1,GLT2 IF NOT DELETE
  238. GLT6 SB2 B3-38
  239. GE B2,B1,GLT7 IF LINE NUMBER LESS THAN 9 DIGITS
  240. SA3 A2+B1
  241. ZR X3,GLT7 IF LINE DELETE
  242. LX3 6
  243. PL B2,GLT2 IF 9 DIGITS
  244. SX7 1R PROCESS 10 DIGIT LINE NUMBERS
  245. BX7 X3-X7
  246. NZ X7,GLT2 IF NOT DELETE
  247. GLT7 MX1 1 SET DELETE FLAG
  248. BX6 X6+X1
  249. EQ GLT2 LOOP
  250.  
  251. GLTA CON 0 DATA READ FLAG
  252. EJECT
  253. SPACE 4
  254. ** MER - MERGE LAST SORTED SEGMENT WITH NEW INPUT USING DATA
  255. * FROM LINE NUMBER TABLE TO WRITE TO ZZZZZG0.
  256. *
  257. * ENTRY (X0) = FIRST WORD ADDRESS OF LINE NUMBER TABLE.
  258. * (LS) = -1 ON FIRST ENTRY SO NO MERGE IS DONE AFTER
  259. * PROCESSING THE FIRST LINE NUMBER TABLE.
  260. *
  261. * USES ALL REGISTERS
  262.  
  263.  
  264. MER SUBR ENTRY/EXIT
  265.  
  266. * GET M, LINE NUMBER FROM GLT TABLE FOR FILE TO BE MERGED,
  267. * AND CHECK FOR ZERO LINE NUMBERS OR LINES WITHOUT NUMBERS.
  268.  
  269. SA5 X0 FIRST ENTRY IN LINE NUMBER TABLE
  270. MX0 41
  271. SA1 LS LAST LINE NUMBER ON FILE PREVIOUSLY SORTED
  272. BX6 X0*X5
  273. NZ X6,MER2 IF NO ZERO LINE NUMBERS
  274. SA2 A5
  275. MER1 LX2 59-0
  276. SA3 X2 GET LINE FROM INPUT BUFFER
  277. AX3 54
  278. SA2 A2+B1 GET NEXT LINE NUMBER TABLE ENTRY
  279. SX4 X3-1R0
  280. NZ X4,ERR IF NO LINE NUMBER ON LINE
  281. BX6 X0*X2
  282. ZR X6,MER1 IF LINE NUMBER = 0
  283. SA5 A2-B1 RESET A5
  284. MER2 LX5 59-0
  285. SA0 X5 (A0) = BUFFER ADDRESS OF LINE M
  286. PL X5,MER3 IF NOT NULL LINE
  287. SA0 -1 LINE DELETE FLAG
  288. MX7 1
  289. BX5 X7-X5 WIPE OUT SIGN EXTENSION
  290. MER3 AX5 18 (X5) = M, LINE NUMBER FOR MERGE FILE
  291. IX4 X1-X5
  292. NG X4,MERA IF LINE NUMBER > LAST LINE NUMBER
  293. SA3 NMZZZG1
  294. WRITER ZZZZZG0 EMPTY ZZZZZG0 BUFFER
  295. REWIND X2,R
  296. BX6 X3
  297. SA6 X2 ZZZZZG0 FNT NAME ZZZZZG1
  298. SA3 ZZZZZG1+B1 SET IN=OUT=FIRST FOR ZZZZZG1
  299. SX6 X3
  300. SA6 A3+B1
  301. SA6 A6+B1
  302. READ A3-B1 READ ZZZZZG1
  303.  
  304. * GET LINE NUMBER, S, FROM ZZZZZG1 AND WRITE LINE TO WS
  305.  
  306. MER4 READC ZZZZZG1,WS
  307. NZ X1,MER12 IF EOR ON ZZZZZG1
  308. SA2 WS GET LINE
  309. MX0 0
  310. SB3 B0
  311. SA4 NC
  312. SB5 -1R+
  313. MX7 54 LINE NUMBER MASK
  314. SB6 X4
  315. MER5 LX2 6
  316. BX3 -X7*X2 NEXT CHARACTER
  317. SB3 B3+B1 COUNT CHARACTER
  318. BX0 X0+X1 ACCUMULATE LINE NUMBER
  319. SX1 X3-1R0
  320. SX3 X3+B5
  321. BX3 -X3+X1 CHECK IF NUMERIC
  322. BX2 X7*X2 CLEAR CHARACTER BEING PROCESSED
  323. LX0 4 MULTIPLY BY 16( TO PUT IN GLT FORM)
  324. PL X3,MER5 GET REST OF LINE NUMBER
  325. MER6 AX0 4 PROCESS ONLY *NC* DIGITS
  326. SB3 B3-B1
  327. GT B3,B6,MER6 IF STILL MORE THAN *NC* CHARACTERS
  328. MER7 IX4 X5-X0 M - S
  329. NG X4,MER8 IF M>S
  330. ZR X4,MER4 M = S SO READ NEXT S
  331. SA3 LS LAST LINE NUMBER ON LAST SORTED SEGMENT
  332. IX4 X3-X5
  333. NG X4,MER11 IF M>LS
  334. WRITEC ZZZZZG0,WS TRANSFER LINE S OF ZZZZZG1 TO ZZZZZG0
  335. EQ MER4
  336.  
  337. * CHECK LINE NUMBER AND MERGE.
  338.  
  339. MER8 SB7 A0 BUFFER ADDRESS FOR MERGE FILE
  340. BX4 X5
  341. SA5 A5+B1 GET NEXT M
  342. LX5 59-0
  343. ZR X5,MER10 IF END OF LINE NUMBER TABLE
  344. SA0 X5 BUFFER ADDRESS
  345. PL X5,MER9 IF NO LINE DELETE
  346. SA0 -B1 LINE DELETE FLAG
  347. MX7 1 REMOVE SIGN EXTENSION
  348. BX5 X7-X5
  349. MER9 AX5 18 NEXT M TO X5
  350. BX2 X5-X4 CHECK IF SAME LINE NUMBERS
  351. ZR X2,MER8 IF SAME, DELETE EARLIER LINE
  352. NG B7,MER7 IF LINE DELETE REQUIRED
  353. WRITEC ZZZZZG0,B7 TRANSFER LINE M TO ZZZZZG0
  354. EQ MER7 CHECK NEXT LINE
  355.  
  356. * DUMP REST OF ZZZZZG1 TO ZZZZZG0.
  357.  
  358. MER10 NG B7,MER11 IF NULL LINE
  359. WRITEC ZZZZZG0,B7 WRITE LAST LINE OF LINE NUMBER TABLE
  360. MER11 WRITEC ZZZZZG0,WS WRITE NEXT LINE FROM ZZZZZG1
  361. READC ZZZZZG1,WS
  362. ZR X1,MER11 IF NOT EOR ON SORTED SEGMENT
  363.  
  364. * DUMP OF LINE NUMBER TABLE TO ZZZZZG0.
  365.  
  366. MER12 ZR X5,MER14 IF END OF LINE NUMBER TABLE
  367. MERA SB7 A0
  368. BX0 X5 CHECK MERGE
  369. SA5 A5+B1 NEXT LINE FROM LINE NUMBER TABLE
  370. LX5 59-0
  371. SA0 X5 BUFFER ADDRESS
  372. PL X5,MER13 IF NO LINE DELETE
  373. SA0 -B1 LINE DELETE FLAG
  374. MX7 1 REMOVE SIGN EXTENSION
  375. BX5 X7-X5
  376. MER13 AX5 18 NEXT M TO X5
  377. BX3 X5-X0
  378. ZR X3,MER12 IF SAME LINE NUMBER
  379. NG B7,MER12 IF LINE DELETE
  380. WRITEC ZZZZZG0,B7 TRANSFER LINE M TO ZZZZZG0
  381. EQ MER12 DUMP REST OF TABLE
  382.  
  383. * EXIT.
  384.  
  385. MER14 BX6 X0
  386. SA3 LS LAST LINE NUMBER FROM PREVIOUS SEGMENT
  387. IX4 X6-X3
  388. NG X4,MERX IF LAST LINE MERGED < LS
  389. SA6 A3
  390. EQ MERX EXIT
  391. EJECT
  392. SPACE 4
  393. ** ELK - END OF LINE CHECK
  394. *
  395. * WHEN MERGING THE LAST READ MAY HAVE LEFT A PARTIAL LINE IN
  396. * THE INPUT BUFFER. ELK SAVES THE PARTIAL LINE IN WE.
  397. *
  398. * EXIT (ELCH) = NUMBER OF WORDS IN PARTIAL LINE.
  399. * (ELAD) = ADDRESS OF BEGINNING OF PARTIAL LINE.
  400.  
  401.  
  402. ELK2 BX7 X4
  403. SA7 A4 RESET *IN* IN I
  404. SX7 A6
  405. BX6 X5
  406. SA6 ELCH
  407.  
  408. SA7 ELAD STORE ADDRESS OF PARTIAL LINE
  409.  
  410. ELK SUBR ENTRY/EXIT
  411. SA2 I
  412. LX2 59-9 CHECK IF LAST READ
  413. NG X2,ELKX IF LAST READ
  414. SB4 WE+WL
  415. SA4 A2+2 IN
  416. MX2 -12
  417. MX5 0
  418. ELK1 SA3 X4-1 GET LINE FROM BUFFER
  419. BX6 -X2*X3
  420. ZR X6,ELK2 IF END OF LIN FOUND
  421. BX6 X3
  422. SA6 B4-B1 STORE FROM BOTTOM UP
  423. SB4 B4-B1
  424. SX5 X5+B1 NUMBER OF WORDS TRANSFERRED
  425. SX6 B4-WE-1
  426. SX4 X4-1
  427. PL X6,ELK1 GET REST OF LINE
  428. EQ ERR IF LINE TOO LONG - ERROR EXIT
  429. PIT SPACE 4,10
  430. ** PIT PROCESS TERMINAL INTERRUPTS.
  431. *
  432. * ENTRY TERMINAL INTERRUPT SENSED.
  433. *
  434. * EXIT TERMINAL INTERRUPT IGNORED.
  435. *
  436. * MACROS REPRIEVE.
  437.  
  438.  
  439. PIT BSS 0
  440. REPRIEVE RPB,RESUME,200B RESUME PROCESSING
  441. SPACE 4
  442. * COMMON DECKS.
  443.  
  444.  
  445. *CALL COMCSST
  446. *CALL COMCLFM
  447. *CALL COMCCIO
  448. *CALL COMCSYS
  449. *CALL COMCRDC
  450. *CALL COMCWTC
  451. *CALL COMCRDW
  452. *CALL COMCWTW
  453. SPACE 4
  454. USE BUFFERS
  455. WS EQU * WORKING STORAGE FOR ZZZZZG0 AND ZZZZZG1
  456. WE EQU *+WL PARTIAL LINE BUFFER
  457. G1BUF EQU WE+WL BUFFER FOR ZZZZZG1
  458. G0BUF EQU G1BUF+BUFL BUFFER FOR ZZZZZG0
  459. IBUF EQU G0BUF+BUFL BUFFER FOR I
  460. MFL= EQU 14000B SORT NOMINAL FL
  461. SSM= EQU 0 SUPRESS MEMORY CLEAR
  462. TITLE PRESET.
  463. PRS SPACE 4
  464. ** PRESET.
  465. *
  466. * ENTRY (A0) = FIELD LENGTH.
  467. * ARGR = ADDRESS OF INPUT FILE NAME LEFT JUST ZERO FILL
  468. *
  469. * EXIT FETS INITIALIZED.
  470.  
  471.  
  472. PRS SUBR ENTRY/EXIT
  473. REPRIEVE RPB,SET,200B SET *REPRIEVE* PROCESSING
  474. SA0 A0-100B ADJUST FL TO ALLOW FOR *CLB=* DATA
  475. SA1 ARGR SET SORT FILE NAME
  476. MX5 42
  477. BX1 X5*X1 MASK OFF FILE NAME
  478. SA3 =7LZZZZZG0
  479. BX7 X3-X1
  480. ZR X7,PRS4 IF MATCHES SCRATCH FILE NAME ZZZZZG0
  481. SA3 =7LZZZZZG1
  482. BX7 X3-X1
  483. ZR X7,PRS4 IF MATCHES SCRATCH FILE NAME ZZZZZG1
  484. PRS1 SA3 =7LZZZZZG0
  485. SX5 B1
  486. BX7 X3+X5
  487. SA7 ZZZZZG1 ZZZZZG1 ALWAYS HAS FNT NAME OF ZZZZZG0
  488. SX1 MFL= ENSURE FIELD LENGTH FOR LOCAL FILE TESTING
  489. SX4 A0 FIELD LENGTH
  490. IX6 X4-X1
  491. PL X6,PRS2 IF SUFFICIENT MEMORY AVAILABLE
  492. SX4 X1+
  493. MEMORY ,,,X1 INSURE SPACE FOR BUFFERS
  494. PRS2 SA3 I+2 IN
  495. IX7 X4-X3
  496. AX2 X7,B1 SET LIMIT = REMAINING FIELD LENGTH/2
  497. IX7 X2+X3
  498. SA1 ARGR STORE FILE NAME IN INPUT FET
  499. BX6 X1+X5
  500. SA6 I
  501. SA7 A6+4 INPUT LIMIT
  502. SA4 ACTR
  503. SB4 X4
  504. REWIND A6 REWIND INPUT FILE
  505. STATUS X2,P CHECK FILE TYPE
  506. SA1 I+5
  507. MX0 -6
  508. BX7 X7-X7
  509. AX1 6
  510. BX2 -X0*X1
  511. SA7 I+6 CLEAR RANDOM INDEX
  512. SX6 X2-PMFT
  513. SA6 DAF DIRECT ACCESS FILE FLAG
  514. RETURN ZZZZZG0
  515. EQ B4,B1,PRSX IF ONE PARAMETER
  516. SA3 ARGR+B1 CHECK NEXT ARGUMENT
  517. LX3 12
  518. SA5 A3+B1 GET NUMBER OF DIGITS
  519. SX2 X3-3R=NC
  520. NZ X2,PRS3 IF NOT NUMBER OF DIGITS PARAMETER
  521. SB7 -1 SET DECIMAL CONVERSION
  522. RJ DXB CONVERT DISPLAY TO BINARY
  523. NZ X4,PRS3 IF ERROR ENCOUNTERED
  524. SA6 NC NUMBER OF DIGITS TO SORT ON
  525. ZR X6,PRS3 IF NC = 0
  526. SX4 X6-11
  527. PL X4,PRS3 IF NC GREATER THAN 10 DIGITS
  528. EQ PRSX RETURN
  529.  
  530. PRS3 MESSAGE (=C* INCORRECT SORT PARAMETER.*),,R
  531. ABORT
  532.  
  533. PRS4 MESSAGE (=C* RESERVED FILE NAME.*),,R
  534. ABORT
  535. SPACE 4
  536. * PRESET COMMON DECKS.
  537.  
  538.  
  539. *CALL COMCDXB
  540. SPACE 4
  541. END
cdc/nos2.source/opl871/sort.txt ยท Last modified: 2023/08/05 17:24 by Site Administrator