home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga MA Magazine 1998 #3
/
amigamamagazinepolishissue1998.iso
/
bazy
/
intra2_17
/
rexx
/
sort.irx
< prev
Wrap
Text File
|
1995-08-05
|
2KB
|
78 lines
/* INTRA_sort.irx by Frank Maesen */
/* $VER: INTRA_sort.irx 1.1 (5.8.1995) */
/* Example Arexx program for controlling INTRA by Bart Vanhaeren */
/* This demo sorts out an invoice database file by date. */
/* It is very slow, but it shows you how you can use the GETDATA */
/* and SETDATA commands. */
OPTIONS RESULTS
IF POS('rexxsupport.library',SHOW('libs'))=0 THEN
nill=ADDLIB('rexxsupport.library',0,-30,0)
IF POS('INTRAREXX', SHOW('PORTS'))=0 THEN DO
SAY "*** Start INTRA first !!!"
EXIT(0)
END
ADDRESS (TRIM(SUBSTR(SHOW('PORTS'),POS('INTRAREXX',SHOW('PORTS')),12)))
SCREENTOFRONT
LOCKGUI NORENDER
REQUESTNOTIFY PROMPT "ARexx script start ..."
REQUESTRESPONSE PROMPT "This script will sort all invoices by date !!!"
IF RESULT=0 THEN DO
REQUESTNOTIFY PROMPT "Quitting ARexx script ..."
UNLOCKGUI
EXIT(0)
END
INVOICES
IF RC~=0 THEN DO
OPEN
IF RC~=0 | RESULT=0 THEN DO
REQUESTNOTIFY PROMPT "Quitting ARexx script ..."
UNLOCKGUI
EXIT(0)
END
END
INVOICES
number=RESULT
IF number > 1 THEN DO
DO i=number-1 TO 1 BY -1
DO j=1 to i
READ j
GETDATA DATE TRADER DESCRIPTION AMOUNT
record1=RESULT
PARSE VAR RESULT '"'data1'"' nill
data1=RIGHT(data1,2)||RIGHT(LEFT(data1,5),2)||LEFT(data1,2)
READ j+1
GETDATA DATE TRADER DESCRIPTION AMOUNT
record2=RESULT
PARSE VAR RESULT '"'data2'"' nill
data2=RIGHT(data2,2)||RIGHT(LEFT(data2,5),2)||LEFT(data2,2)
IF data1 > data2 THEN DO
PARSE VAR record1 '"'dat1'"' '"'tra1'"' '"'des1'"' '"'amo1'"'
SETDATA DATE dat1 TRADER '"'tra1'"' DESCRIPTION '"'des1'"' AMOUNT amo1
REWRITE j+1
READ j
PARSE VAR record2 '"'dat2'"' '"'tra2'"' '"'des2'"' '"'amo2'"'
SETDATA DATE dat2 TRADER '"'tra2'"' DESCRIPTION '"'des2'"' AMOUNT amo2
REWRITE j
END
END
END
END
POSITION BOF
REQUESTNOTIFY PROMPT "ARexx script is done ..."
UNLOCKGUI
EXIT(0)