Yes, thanks for catching the wrong END-PERFORM, I meant to suggest this -  

PERFORM UNTIL GET-NEXT-REC(NEXT-RECORD) = 0
    <PROCESS MY RECORD logic>
END-PERFORM

As far as updating parameters passed to functions - there is no real functional 
difference between passing parameters to functions vs called subroutines as 
they are both just entry names to be resolved by either the compiler or the 
linker.

And we all know that subroutines can update passed parameters [e.g. COMMAREA on 
a CICS LINK].    

-Victor-

=========================
Indeed, Victor, you are quite correct!  And as soon as Enterprise COBOL 
supports user-written functions I will start using them!


FWIW, I don't think your code would work as-in even then, because END-PERFORM 
is only for inline performs, but you are doing an "out of line" perform.  You'd 
really have to use one of the following:


PERFORM PROCESS-MY-RECORD
    UNTIL GET-NEXT-REC(NEXT-RECORD) = 0


PERFORM UNTIL GET-NEXT-REC(NEXT-RECORD) = 0

    PERFORM PROCESS-MY-RECORD
END-PERFORM


The first option, even if it works, looks (to me) "a bit weird", because 
structurally it looks like PROCESS-MY-RECORD is done prior to GET-NEXT-REC(), 
so I would stick with the second option; even if its a bit more verbose.


Now that I think about it, though, I'm not sure if this would work.  The above 
assumes that function GET-NEXT-REC not only returns a result, where 0 means 
"end of file", but it also assumes that the parameter is passed by reference 
and can be updated by the function.  Are we sure the COBOL standard allows for 
that?  I'll look at some point, but not right this.


Frank

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to