YES!
The ON EXCEPTION clause of UNSTRING combined with increasing the
occurs of datatab, may help this to be more variable.
You'll still have a maximum limit, as with all things good.
On 06/03/2013 07:52 AM, Bruce M. Axtens wrote:
I did find a better way, but it still involves knowing beforehand
how many items are going to be pulled out of the string.
identification division.
program-id. unsinto.
environment division.
data division.
working-storage section.
01 datatable.
03 datatab pic 9(9) occurs 5 times indexed by dat.
01 cnt pic 99.
01 ptr pic 99.
01 datastring pic x(10) value "9,8,7,6,5".
01 flow-control pic 9 value 0.
88 nothing-left value 1.
01 items usage computational-1.
procedure division.
move 1 to ptr.
divide length of datatable by length of datatab giving
items
perform until nothing-left
unstring datastring delimited by "," into
datatab(dat) with pointer ptr tallying in cnt
set dat up by 1
if cnt = items
exit perform
end-if
display dat " " datatab(dat) " " ptr " " cnt "
length of datatab=" items
end-perform.
display datatable.
goback.
.
Does COBOL do dynamic arrays?
Kind regards,
Bruce.
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
open-cobol-list mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/open-cobol-list
|