gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] for i in ..... or work around?


From: Michael Anderson
Subject: Re: [open-cobol-list] for i in ..... or work around?
Date: Sun, 05 May 2013 18:19:12 -0500
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

Patrick,

Using an "OCCURS 15 times", combined with a "Perform Varying", to iterate through the array/table of 15 numbers.

Example:

01 my-numbers.
     02 numidx
     02 numentries.
          03 numentry occurs 15.
              04 mynum pic s9(9) comp.


Perform Varying numidx from 1 by 1 until numidx > 15
   Evaluate mynum(numidx)
        When 1
                   Do something
        When 2
                   Do something
        *> and so n.....
         When other
                   Do something else
    End-Evaluate
End-Perform.

--
mike.

On 05/05/2013 04:38 PM, Patrick wrote:
Hi Everyone

I have been working hard on my first non-trivial program.

I have 15 fields that contain numbers that I would like to convert to
certain text via an evaluate statement.

I guess I can copy the evaluate statement 15 times and then edit the
control variable to one of each of these fields but I can if I can avoid
a lot of copy and paste code, that would likely be best.

I was hoping to use a statement that looks roughly like this in bash

for field1 field2 field3 ; do something $i ; done

If I could put an evaluate statement inside it, I should be able to
avoid a big copy paste operation.

Does anyone know if this is possible or if there is a workaround?

Thanks for reading-Patrick



------------------------------------------------------------------------------
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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]