Rev 4158 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | !if $wims_read_parm!=slib_header |
2 | !goto proc |
||
3 | !endif |
||
4 | slib_title=Take a random line of a data file |
||
5 | slib_parms=1\ |
||
6 | ,name of the data file in the module |
||
7 | slib_author=Gang Xiao |
||
8 | slib_out=the random line (empty if error) |
||
9 | slib_comment=The length of the data file is limited. |
||
10 | !exit |
||
11 | |||
12 | :proc |
||
13 | !if ...adm/ isin ...$module or .. isin $wims_read_parm or $wims_read_parm=$empty |
||
14 | !exit |
||
15 | !endif |
||
16 | slib_fname=!items2words $wims_read_parm |
||
17 | slib_fname=!word 1 of $slib_fname |
||
18 | slib_out=!record 0 of $slib_fname |
||
19 | !if $slib_out=$empty |
||
20 | !exit |
||
21 | !endif |
||
22 | slib_out=!nonempty lines $slib_out |
||
23 | slib_n=!linecnt $slib_out |
||
24 | slib_n=!randint 1,$slib_n |
||
25 | slib_out=!line $slib_n of $slib_out |
||
26 |