If you want to parse results, it might be better to use the RETURNING clause:
EXECUTE "COUNT…." RETURNING RSLT
RSLT will contain a dynamic array of all the messages that the command
produced, so for a COUNT might look like:
407]11905]QLNUMCNT
or
401]]QLBADFILE
The message usually contains 3 values. The first is the "ERRMSG" code. These
are the same codes that you would use with a STOP or PRINTERR statement, for
example
OPEN "somefile" TO FP ELSE STOP 201,"somefile"
and the other values are parameters. If you executed a program with my OPEN
example in it with RETURNING, you would get back something like:
201]somefile]
In the example above that begins with 407, 407 is the code for the "items
counted" message, and the argument 11905 is the number of items counted. In the
other example, 401 is the code for no items counted, the first arguments is
blank, and the second argument "QLBADFILE" identifies why nothing was counted
(I used a non-existent filename)
Sometimes there can be multiple codes returned. In that case each code string
is separated by an attribute mark.
In this case is would be easiest to use the @SYSTEM.RETURN.CODE variable. COUNT
and SELECT commands return @SYSTEM.RETURN.CODE set to the number of items
counted or selected. If you use a SELECT instead of a COUNT then the system
variable @SELECTED will be set to the number of items selected.
On Jul 11, 2012, at 6:57 AM, Tony Gravagno wrote:
> Unless there is some syntax I'm not aware of, you don't want "NUM.FT =
> EXECUTE"
> Try:
>
> EXECUTE "COUNT …." CAPTURING RESULT
> * Parse result here with something like
> NUM.FT = FIELD(RESULT<1>," ",1)
> IF NUM(NUM.FT) AND NUM.FT GT 0 THEN …
>
>
> HTH
>
> From: Simon Verona
>
> Hi
>
> You need to add a capuring clause as below.
>
> PROGRAM TEST
> NUM.FT = EXECUTE "COUNT FBNK.FUNDS.TRANSFER$NAU WITH CO.CODE EQ XX0010001"
> CAPTURING RESULT
> IF NUM.FT GT 0 THEN
> DISPLAY "FT ": NUM.FT
> END
> END
>
> You get the full message back, so you can't just check the number - but you
> should be able to work that bit out
>
> Regards
> Simon
>
>
> --
> IMPORTANT: T24/Globus posts are no longer accepted on this forum.
>
> To post, send email to [email protected]
> To unsubscribe, send email to [email protected]
> For more options, visit this group at
> http://groups.google.com/group/jBASE?hl=en
--
IMPORTANT: T24/Globus posts are no longer accepted on this forum.
To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en