BPX2TYN (ttyname) example

The following code retrieves the pathname for the standard error output file. For the callable service, see ttyname (BPX1TYN, BPX4TYN) (POSIX version) — Get the name of a terminal. AMODE 64 callers use BPX4TYN (ttyname) example.
                                              
         MVC   BUFLENA,=A(1023)      Maximum pathname                   
         CALL  BPX2TYN,              Determine terminal name           +
               (=A(STDERR_FILENO),   Input: File descriptor            +
               BUFLENA,              Length of buffer for pathname     +
               BUFFERA,              Buffer for pathname of terminal   +
               RETVAL,               Return value: 0, -1               +
               RETCODE,              Return code: describes why VAL=-1 +
               RSNCODE),             Reason code: qualifier on RETCODE +
               VL,MF=(E,PLIST)       ----------------------------------