      CHARACTER*80 STRING
      CHARACTER*128 ARGGG,FN,FNI,FNO
      INTEGER*2 NSTATUS,NTEMP
      PRINT*,' INSIDE MAKESUB'
      NUMARGS=NARGS()
      NREAD=5
      IF(NUMARGS.EQ.2)THEN
        NTEMP=1
        CALL GETARG(NTEMP,ARGGG,NSTATUS)
        FN=ARGGG(:NSTATUS)
        IT=INDEX(FN,' ')
        ITP=INDEX(FN,'.')
        IF(ITP.GT.0)IT=MIN0(IT,ITP)
        FNI=FN(1:IT-1)//'.JOB'
        PRINT*,'JOB FILE IS ',FNI(1:64)
        OPEN(1,FILE=FNI)
        NREAD=1
      ENDIF
      FNO='job.sub'
      OPEN(2,FILE=FNO)
5     READ(NREAD,'(A)',END=20,ERR=20)STRING
      PRINT*,STRING(:75)
      IF(STRING(1:5).EQ.'/*EOF')GOTO 20
      IF(STRING(1:10).EQ.'/*INCLUDE ')THEN
        OPEN(3,FILE=STRING(11:),STATUS='OLD',ERR=27)
        PRINT*,' OPENED FILE = ',STRING(11:56)
10      READ(3,'(A)',END=5,ERR=5)STRING
        WRITE(2,'(A)')STRING
        GOTO 10
      ELSE
        WRITE(2,'(A)')STRING
        GOTO 5
      ENDIF
20    CONTINUE
      PRINT*,' THE CODE READY FOR MVS IS IN '
      PRINT*,FNO(1:76)
      STOP
27    PRINT*,' COULD NOT OPEN ',STRING(11:)
      END
