!--------------------------------------------------------------------------
!
!                                 NOTICE
!
!  This program in all or in part may be used by all AMUS members.
!
! (c) Copyright 1988 - Stephen Caldwell
!
!--------------------------------------------------------------------------
! Edit History:
!
! .100   5/18/88       Original Version        Stephen Caldwell  (CALD/AM)
!                                              (213) 947-3771
!--------------------------------------------------------------------------
! Purpose:
!
!      Returns users jobname. (USES NO EXTERNAL SUBROUTINES)
!
! Usage:
!
!      .RUN CCJNAM  (cr)
!
! Note:
!
!  If you would like to see more of this type of basic routines, send me
!  mail or call me and let me know.
!
!                                     sdc
!
!--------------------------------------------------------------------------
program CCJNAM,1.0A(100)

START: JCB=65536*word(1052)+word(1054)         ! Job Control Block Addr.

      N=word(JCB+8)                           ! Get 1st word in RAD50.

      call UPKR50                             ! Go unpack.

      JN$=A$                                  ! Save 1st 3 chrs in JN$.

      N=word(JCB+10)                          ! Get 2nd word RAD50.

      call UPKR50                             ! Go unpack.

      JN$=JN$+A$                              ! Combine all characters.

      SP=instr(1,JN$,chr(32))                 ! Trailing spaces?

      if SP>0 then &
              JN$=JN$[1,(SP-1)]               ! Yes, dump 'em.

      ? "Your job name is ";JN$               ! Screen output.

EXIT:  end

!
! Unpack RAD50 three characters at a time.
!
UPKR50:
      A$=chr(0)

      A=int(N/1600)
      call UPK1

      A=int((N-1600*A)/40)
      call UPK1

      A=N-40*int(N/40)

UPK1:  A$=A$+" ABCDEFGHIJKLMNOPQRSTUVWXYZ$.%0123456789"[A+1;1]

      return