Get a line number at runtime - 1 -

[Autolink] Menu

 
/* code sequence to get the no. of a sourceline at runtime            */
/* Note that this code also functions in compiled REXX programs       */
/* and in REXX programs loaded in the macro space.                    */
/* Usage example:                                                     */
/* You can use this technique in your programs to write an error      */
/* handler which ignores errors in some lines but not in all.         */
/* (see the routines I!.__CallUserProc and I!.__ErrorAbort in     */
/* the TEMPLATE.CMD.)                                                 */

/** DO NOT CHANGE, ADD OR DELETE ANY OF THE FOLLOWING FOUR LINES!    **/
  SIGNAL I!.__CallUserProc1
I!.__CallUserProc1:
  LineNo = sigl+2     /* no. of THIS line                             */
  say "This is the line no. " || LineNo+1 || " of the source code."
/** DO NOT CHANGE, ADD OR DELETE ANY OF THE PRECEDING FOUR LINES!    **/


[Back: Check if a program is in the macro space]
[Next: Get a line number at runtime - 2 -]