home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / ibm370 / iktaux.cmd < prev    next >
OS/2 REXX Batch file  |  2020-01-01  |  4KB  |  100 lines

  1. PROC 0 CMD()                                /* PC */
  2. CONTROL ASIS
  3. /*   PC CLIST - J.F. Chandler - 1992 April                                 */
  4. /*   (Modified December to use TERMINALS instead of TERMINALR)             */
  5.  
  6. /*   Intended to be executed from inside Kermit with SYSCMD set ON.        */
  7. /*   Syntax:  %PC CMD('kermit subcommand text')                            */
  8. /*   The PC Kermit is placed in server mode via TERMINALS, then the "cmd"  */
  9. /*   is executed, and then a FINISH is executed.  NOTE: the PC Kermit      */
  10. /*   should have SERVER TIMEOUT set to a relatively small value.           */
  11.  
  12. /*   Special case:  %PC CMD('PRINT file')                                  */
  13. /*   The printer is enabled via ANSI escape sequence, the file is then     */
  14. /*   displayed, and the printer is disabled.                               */
  15.  
  16. SET &L = &LENGTH(&STR(&CMD))
  17. IF &L = 0 THEN DO
  18.   WRITE Syntax error
  19.   EXIT CODE(99)
  20.   END
  21. IF &SUBSTR(&L,&CMD)=&STR(,) THEN DO
  22.   WRITE Syntax error
  23.   EXIT CODE(99)
  24.   END
  25. SET &I = 2
  26. DO WHILE &I < &L && &SUBSTR(&I,&CMD)^=&STR( )
  27.   SET &I = &I + 1
  28.   END
  29. IF &I >= &L THEN DO
  30.   WRITE Syntax error
  31.   EXIT CODE(99)
  32.   END
  33. SET &I1 = &I - 1
  34. IF &SUBSTR(1:&I1,&CMD)=&STR(PRINT) THEN DO
  35.   SET &OPEN_CMD = &STR(XECHO ^[[5i)      /* Enable printer */
  36.   SET &CMD = &STR(XTYPE&SUBSTR(&I:&L,&CMD)
  37.   SET &CLO_CMD = &STR(XECHO ^[[4i)       /* Disable printer */
  38.   END
  39. ELSE DO
  40.   SET &OPEN_CMD = &STR(XECHO ^[[?34h    ^[[?34h) /* start server (extra) */
  41.   SET &CLO_CMD = &STR(FINISH)
  42.   END
  43. KERMIT
  44. KERMIT &OPEN_CMD
  45. KERMIT &CMD
  46. SET &R = &LASTCC
  47. KERMIT &CLO_CMD
  48. IF &R = 2  THEN WRITE Transfer cancelled
  49. IF &R = 5  THEN WRITE Bad packet count or chksum
  50. IF &R = 6  THEN WRITE Invalid packet syntax
  51. IF &R = 7  THEN WRITE Invalid packet type
  52. IF &R = 8  THEN WRITE Lost a packet
  53. IF &R = 9  THEN WRITE Micro sent a NAK
  54. IF &R = 10 THEN WRITE Micro aborted
  55. IF &R = 12 THEN WRITE File not found
  56. IF &R = 13 THEN WRITE Disk or file is full
  57. IF &R = 14 THEN WRITE Disk I/O error
  58. IF &R = 15 THEN WRITE Missing operand
  59. IF &R = 17 THEN WRITE Syntax error
  60. IF &R = 19 THEN WRITE Records truncated
  61. IF &R = 20 THEN WRITE Bad communication line
  62. IF &R = 22 THEN WRITE File too short
  63. IF &R = 23 THEN WRITE Missing start-of-packet
  64. EXIT CODE(&R)
  65. --------------------------------------------------------------
  66. PROC 1 DSN LIST()                          /* KERMAIL */
  67. CONTROL ASIS
  68.  
  69. /* Purpose:                                                             */
  70. /*    Deliver mail received from MS-Kermit via TSO-Kermit               */
  71.  
  72. /* Function:                                                            */
  73. /*    TSO-Kermit calls KERMAIL once with  DSN of "." to ensure          */
  74. /*    that KERMAIL exists.  In this case, KERMAIL returns with RC=0.    */
  75. /*    Then when TSO-Kermit has received the mail file from the PC, it   */
  76. /*    calls KERMAIL with the correct DSN.  KERMAIL now dispatches the   */
  77. /*    mail file.                                                        */
  78.  
  79. IF &DSN=&STR(.) THEN EXIT CODE(0)
  80. /*   send file as mail... */
  81. DELETE &DSN
  82. EXIT CODE (0)
  83. --------------------------------------------------------------
  84. PROC 1 DSN LIST()                          /* KERMPRT */
  85. CONTROL ASIS
  86.  
  87. /* Purpose:                                                             */
  88. /*    Print file received from MS-Kermit via TSO-Kermit                 */
  89.  
  90. /* Function:                                                            */
  91. /*    TSO-Kermit calls KERMPRT once with  DSN of "." to ensure          */
  92. /*    that KERMPRT exists.  In this case, KERMPRT returns with RC=0.    */
  93. /*    Then when TSO-Kermit has received the file from the PC, it        */
  94. /*    calls KERMPRT with the correct DSN.  KERMPRT now prints the file. */
  95.  
  96. IF &DSN=&STR(.) THEN EXIT CODE(0)
  97. /*   print the file ... */
  98. DELETE &DSN
  99. EXIT CODE (0)
  100.