Page 1 of 1

Data range input

PostPosted: Thu Mar 18, 2010 6:18 pm
by pcs2smf
I've been asked to modify a routine that reads in a set of acceptable return codes like:
PARSE UPPER VAR CCS CC1 CC2 CC3 CC4 CC5 CC6 CC7 CC8 CC9 CC10
the modification should be able to read a range of data to extend the input say from
0,4,8,50,60,70,80,90,92,95
to
0,4,8,50,60-70,80,90,92,95
anyone have any ideas?

Re: Data range input

PostPosted: Fri Mar 19, 2010 1:08 pm
by enrico-sorichetti
we might have if You had cared to explain better the requirement

Re: Data range input

PostPosted: Fri Mar 19, 2010 5:17 pm
by pcs2smf
The parse statement reads a string of numbers on a line - theres only rom for 10 numbers as there are 3 other fields. So in order to add more customer would like to add a range. This is an audit routine reading acceptable return codes. Probably a poor setup but thats what I'm stuck with. The 60-70 would then be CC11 CC12 ..... CC21 and this would have no limit. Any help would be appreciated.

Re: Data range input

PostPosted: Fri Mar 19, 2010 5:39 pm
by enrico-sorichetti
the explanation keeps getting more confused!
the parse instruction as written will assign to the specified variables the blank separated substrings
it will not care about the content

fr = "01 02 04-09 14 19"
parce var fr a b c d e

will result in
a = "01"
b = "02"
c = "04-09"
d = "14"
e = "19"

nothing more, nothing less
then You will have to decide the format of a range token
and analyze each substring for it

if You really want some help learn to explain better Your requisites

Re: Data range input

PostPosted: Sat Mar 20, 2010 12:03 am
by dick scherrer
Hello,

You might consider changing the code to accept a range in every CCn. If only 1 value is provided, the range starts and ends with that value. If 2 values are provided, they are the start and end. . . The user might not ever use this, but i believe it would be easier to support one set of code rather than multiple. . .