Sort command is not respecting the "Record" parame

General development discussion.

Moderators: Susan Smith, admin, Gabriel

Post Reply
HolmstromB
Posts: 3
Joined: Tue Jun 15, 2010 12:37 pm

Sort command is not respecting the "Record" parame

Post by HolmstromB »

Good morning - I am having difficulty making a sort respect the line that informs the sort that we only want 'x' records. Any insight is greatly appreciated.

Here is the line I am using for the "record sort"

12106 WRITE #H_Sortfile,USING SORT_FORM: 'RECORD I,'&Str$(Rec_Pos)&',8,C,"'&'GFILE1 '&'","'&'GFILE1 '&'"'

This is returing every record from the file. ????

Thanks in advance

Bryan
Attachments
SORTCHANGE.WB
Sample of program
(18.82 KiB) Downloaded 442 times
Bryan Holmstrom
gtisdale
Posts: 218
Joined: Sun Jun 07, 2009 7:54 am
Location: Concord, Massachusetts
Contact:

Post by gtisdale »

I think your problem involves the nested quotes. After creating your sort control file load it into a text editor like EditPadPro and see what actually exists.

I use a function to do sorts as follows (it is embedded in FNSNAP.dll):

02110 DEF LIBRARY FNBLDSORT(INNM$*100,OUTNM$*100,ABR$,MASK$*128;MAT RECORD$,_INDIR$,_INDRV$,_OUTDIR$,_OUTDRV$) !:
! ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿!:
! ³ Build a sort control file, then sort the file and erase ³!:
! ³ the sort control file. ³!:
! ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ!
02120 ! --------------------------------
02130 ! INNM$ File name to be sorted, can include path !:
! OUTNM$ File name top be created by sort, can include path !:
! ABR$ Type of output file !:
! A=Address in PD3 format !:
! B=Address in B4 format !:
! R=Record out (the default)
02140 ! MASK$ The mask statement for the sort excluding the word "MASK" !:
! ex "123,1,C,A" !:
! Mat RECORD$ An array containing the Inlude and/or Exclude statements !:
! ex LET RECORD$(1)='I,162,1,C,"""&low$&""","""&high$&"""' !:
! INDIR$,INDRV$,OUTDIR$ and OUTDRV$ are intended to NOT be included !:
! and will therefore be set to NULL !
02150 DIM SRTCNT$*100
02160 LET SRTCNT=10
02170 IF FILE(SRTCNT)>-1 THEN LET SRTCNT+=1 : GOTO 2170
02180 OPEN #SRTCNT: "name="&ENV$("TEMP")&"\srtcnt."&WSID$&",recl=128,replace",INTERNAL,OUTPUT
02190 LET SRTCNT$=FILE$(SRTCNT)
02200 GOTO 2220
02210 FOR A=1 TO 4 !:
WRITE #SRTCNT,USING "form C 128": "!"&RPT$(" ",126)&"!" !:
NEXT A
02220 WRITE #SRTCNT,USING "form c 128": "FILE "&INNM$&","&_INDIR$&","&_INDRV$&","&OUTNM$&","&_OUTDIR$&","&_OUTDRV$&","&ENV$("TEMP")&",,"&ABR$&",N,REPLACE"
02230 FOR A=1 TO UDIM(RECORD$)
02240 IF TRIM$(RECORD$(A))>"" THEN !:
WRITE #SRTCNT,USING "form c 128": "RECORD "&RECORD$(A) !:
! I,49,1,C,"""&" "&""","""&" "&""""
02250 NEXT A
02260 WRITE #SRTCNT,USING "form c 128": "MASK "&MASK$ !:
! 11,5,C,A,23,3,C,A,26,4,PD,A,16,7,C,A"
02270 CLOSE #SRTCNT: !
02280 EXECUTE "SORT "&SRTCNT$
02290 ! FRMSRT: FORM PD 3
02300 EXECUTE "free "&SRTCNT$ IOERR 2310
02310 FNEND


FNGeorge[/code]
HolmstromB
Posts: 3
Joined: Tue Jun 15, 2010 12:37 pm

Its all in the Quotes

Post by HolmstromB »

Your were correct...the quotes were the problem......thanks for the help.
Bryan Holmstrom
Post Reply