It is possible, but I do not recommend that you attempt to construct
an OPTIONS(MAIN) procedure that has multiple entry points.

You may, however, construct a multiple entry-point subroutine easily,
and some of these entries may be functions.  Consider the skeletal
multiple-stack manager

skadmin:  /* stack manager */
skactiv: procedure(paq, saq)  /* activate, create a stack */
  recursive
  reorder
  returns(pointer) ;
  . . .
  return(new_skp) ;

skpush: entry(skp, elemp) ;  /* add an element to a stack */
  . . .
  return ;

skpop: entry(skp, elemp)   /* remove an element if there is one */
  returns(aligned bit) ;
  . . .
  return(success) ;

sksize: entry(skp) returns(signed binary fixed(31,0)) ;  /* get stack's size */
  . . .
  return(in_stack_count) ;

skdeact: entry(skp) ;  /*deactivate, destroy a stack */
  . . .
  return ;

end skadmin ;   /* procedure ends */

This scheme makes C-like packages unnecessary.  The recursive
attribute specified in the procedure statement is necessary only if
one of the entries calls itself or another.

Worth noting is that there is no fall-through in this procedure.  Each
entry has its own RETURN or RETURN(<some value>) statement.  To share
code, one entry may invoke another in trivially recursive fashion.

John Gilmore, Ashland, MA 01721 - USA

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to