Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

perform TIMES with varying? 1

Status
Not open for further replies.

scallosa

ISP
Mar 7, 2002
76
US
I'm got a count of how many times I want to do a process,
but i also need an index into the table,
so can I combine PERFORM TIMES with VARYING?

perform 999-process x-cnt times
varying sub 1 by 1
until sub > 99.
This way I can say
--> move widgit(sub)....

Is this possible?

Thanks.
 
How about:

perform 999-process
varying sub 1 by 1
until sub > x-cnt.
 
Hi scallosa,

...or,
Code:
    move zero to p-cnt
    perform 999-process x-cnt times 
    .
999-process.  
    add +1 p-cnt 
    .
    move xxx to tbl-ent(p-cnt)
    .
    .
    .
There may be advantages (but I doubt it). I prefer Crox's way, too. But, there it is, a choice.

Regards, Jack
 
Clive, I see what you mean. Coming from C, I did not understand the arcane connection between actions to be performed and syntax. (huh?)
Hello Slade, first time we've met, I've admired your understanding of cobol. Would you believe that I went to Barnes ane Noble (eat and read) and found only 1 cobol book?
It was a Sam's 30 day book
Maybe, I, and 50,000 other, cobol programmers should just
quit right now! ( right!)
I explained to the salesperson, that yes, he could enroll for the local college, but behind the scenes, a huge 50 ton mainframe was maintaining all the data and serving it out, but by then his eyes had glassed over.

Alley oop



 
Hi scallosa,

Thanx for the attaboy. Take a look at half.com, they have tons of COBOL, etc. books and cheep too. I got Sam's 24 hr cobol for 12 bucks, I think.

Clive, sorry for mistaking you for Crox, not that that's a bad thing. :)

Regards, Jack

 
Hi,

just an other example of a perform varying that sorts a table:

Code:
003000     PERFORM VARYING SUB  FROM +1 BY +1 UNTIL SUB  > T - 1 AFTER
003100                     SUB2 FROM T-MIN-1 BY -1 UNTIL SUB2 < SUB + 1
003200         IF XT-FACTOR (SUB) > XT-FACTOR (SUB2)
003300             MOVE XT-FACTOR (SUB)  TO HULP-XT-FACTOR
003400             MOVE XT-FACTOR (SUB2) TO XT-FACTOR (SUB)
003500             MOVE HULP-XT-FACTOR   TO XT-FACTOR (SUB2)
003600         END-IF
003700     END-PERFORM.

Regards,

Crox
 
Hi Scallosa,

Now YOU owe CROX an aplology. :)

Jack
 
I think there is at least one COBOL compiler on the market which allows you to use TIMES with VARYING.
The next standard will permit you to sort TABLES in your program. Of course, this is a waste of time unless you are going to have many accesses on the sorted table...

You can download the complete draft standard at

Stephen J Spiro
Member, ANSI COBOL Standards Committee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top