home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / ibm370 / ikxutl.asm < prev   
Assembly Source File  |  2020-01-01  |  232KB  |  2,860 lines

  1. *COPY                                                 IKXUTL            05000000
  2.          CHECKVER IKXUTL,4.3                                   @SC90072 05000500
  3. &STORDS  DSECT                                                 @SC90264 05001000
  4.          DS    (STKDWDS)D    Allow room for stack              @SC90264 05001500
  5.          DFHEIEND ,                                            @SC90264 05002000
  6.          TITLE 'CWDSET/DSPACE Routines - set/show working directory'    05002500
  7. * Set new 'working directory'                                           05003000
  8. * Entry: SCANPTR string has option                                      05003500
  9. * Exit: R15=0 if ok, R15=1 if error or help needed. ERRNUM unchanged.   05004000
  10. CWDSET   ENTER                                                 @SC86164 05004500
  11.          NTOKN N=CWDRSET,H=CWDERR                              @SC86299 05005000
  12.          CLI   0(6),C'*'                                       @SC90264 05005500
  13.          BE    CWDRSET       Any string beginning "*" is dflt  @SC90264 05006000
  14.          LA    1,0(7,6)      Point to last character           @SC90264 05006500
  15.          CLI   0(1),C''''    Is it a quote?                    @SC90264 05007000
  16.          BE    *+8           Yes, chop it off                  @SC90264 05007500
  17.           LA   7,1(,7)       No, get true token length         @SC90264 05008000
  18.          LR    5,7                                             @SC86299 05008500
  19.          ICM   7,8,BLANK                                       @SC86299 05009000
  20.          LA    0,DEST                                          @SC90264 05009500
  21.          LA    1,L'DEST      Length of field                   @SC86299 05010000
  22.          CR    5,1                                             @SC90264 05010500
  23.          BNH   *+6                                             @SC90264 05011000
  24.           LR   5,1           Claim no more than available      @SC90264 05011500
  25.          STH   5,DESTL       Set string length                 @SC90264 05012000
  26.          MVCL  0,6           Copy to filename buffer           @SC86299 05012500
  27.          TR    DEST,UPCASE   And upcase it                     @SC87034 05013000
  28.        NXTFSET DESTL,CWD,E=CWDERR                              @SC90264 05013500
  29.          KCALL KFLCWD,DESTL                                    @SC90264 05014000
  30.          B     RTRN0                                           @SC86295 05014500
  31. CWDRSET  MVI   DESTL+1,1     Set to default                    @SC90264 05015000
  32.          MVI   DEST,C'*'                                       @SC90264 05015500
  33.          KCALL KFLCWD,DESTL                                    @SC90264 05016000
  34.          B     RTRN0                                           @SC86295 05016500
  35. CWDERR   PTEXT '&CWDERRM'                                      @SC92300 05017000
  36.          MVI   DESTL+1,1     Set to default                    @SC90264 05017500
  37.          MVI   DEST,C'*'                                       @SC90264 05018000
  38.          KCALL KFLCWD,DESTL                                    @SC90264 05018500
  39.          B     SUBERR                                          @SC86295 05019000
  40. *                                                                       05019500
  41. *        DSPACE Routine - display available disk space         @SC86164 05020000
  42. *                                                                       05020500
  43. * Show space available in 'working directory' or other area             05021000
  44. * Entry: SCANPTR string has option (none => working directory)          05021500
  45. * Exit: R15=0 if ok, R15=1 if error or help needed. ERRNUM unchanged    05022000
  46. DSPACE   ENTER ALT                                             @SC86164 05022500
  47.          CLI   CURFUID,0                                       @SC90264 05023000
  48.          BNE   DSP2                                            @SC90264 05023500
  49.          PTEXT '&NODIRDF'                                      @SC90264 05024000
  50.          B     SUBERR                                          @SC86299 05024500
  51. DSP2     L     4,LIMKFS      Quota                             @SC90264 05025000
  52.          LA    15,CMD                                          @SC90264 05025500
  53.          BAL   2,EDDEC       Format number                     @SC90264 05026000
  54.          INITSTR '&BYTSALW'                                    @SC92300 05026500
  55.          L     4,USRTOTL     Amount used                       @SC90264 05027500
  56.          BAL   2,EDDEC       Format number                     @SC90264 05028000
  57.          INITSTR '&BYTSUSD'                                    @SC92300 05028500
  58.          MVC   0(LFUID,15),CURFUID                             @SC92300 05029000
  59.          LA    0,LFUID(,15)  End of message                    @SC92300 05029500
  60.          BAL   2,STAPMSG                                       @SC90264 05030000
  61.          B     RTRN0                                           @SC86295 05030500
  62.          LOCALS ,                                              @SC86295 05031000
  63.          EXIT  ,                                               @SC86295 05031500
  64.          TITLE 'FSPEC Routine - extract filespec from scan string'      05032000
  65. *                                                                       05032500
  66. * Entry: R1->name field, R0=flags selecting operation (see below)       05033000
  67. *        For parse operations, SCANPTR defines the input string.        05033500
  68. *        For getting foreign or display filespec, R7->output buffer     05034000
  69. * Exit: if not FFNEW, then R15=0 if ok, 1 if ?, 2 if bad.               05034500
  70. *        For R15=1 or 2 R3,R4 give message.  ERRNUM may be leftover.    05035000
  71. *                                                                       05035500
  72. *                                 Flags:                  Notes:        05036000
  73. *   Tasks:               FFRCF FFSND FFGET FFNEW                        05036500
  74. * Parse RECV               X                     set ROVR properly      05037000
  75. * Parse SEND 1st                 X                                      05037500
  76. * Parse SEND 2nd           X     X                                      05038000
  77. * Parse GET 1st                        X                                05038500
  78. * Parse GET 2nd            X           X         set ROVR properly      05039000
  79. * Parse F-packet   (FFHDR) X     X     X                                05039500
  80. * Parse for Generic(FFUTL)       X     X         FFWLD: allow partial   05040000
  81. * Parse TAKE                                                            05040500
  82. *                                                                       05041000
  83. * Get unique name                            X     R15: 0=>ok, 1=>bad   05041500
  84. * Interactive name check               X     X     R15: 0=>ok, 1=>bad   05042000
  85. * Get foreign name (FFENC) X                 X     R15->end of string   05042500
  86. * Get display form (FFDSP)       X           X     R15->end of string   05043000
  87. *                                                                       05043500
  88. FSPEC    ENTER                                                 @SC86295 05044000
  89.          STC   0,FSPFLG                                        @SC86295 05044500
  90.          LR    5,0                                             @SC88049 05045000
  91.          SRL   5,4           Convert flags to index            @SC88049 05045500
  92.          LR    0,1           Copy ptr to filespec              @SC86295 05046000
  93.          TM    FSPFLG,FFNEW                                    @SC86295 05046500
  94.          BO    FSPWRN                                          @SC86295 05047000
  95.          L     2,ADR         Ptr to text string for analysis   @SC90264 05047500
  96.          C     2,=A(KERMIT)  Is it within Kermit?              @SC90264 05048000
  97.          BL    SCANFXZ       No, we're safe                    @SC90264 05048500
  98.          C     2,=A(FOPSTR)  (last CSECT in Kermit)            @SC90264 05049000
  99.          BH    SCANFXZ                                         @SC90264 05049500
  100.          ICM   3,15,LEN      Yes, but is it non-empty?         @SC90264 05050000
  101.          BNP   SCANFXZ       No, don't need to copy            @SC90264 05050500
  102.          BCTR  3,0           Yes, set up for MVC               @SC90264 05051000
  103.          L     4,STRBUF      Ptr to temporary area             @SC90264 05051500
  104.          MVC   0(,4),0(2)                                      @SC90264 05052000
  105.          EX    3,*-6         Move proper chunk                 @SC90264 05052500
  106.          ST    4,ADR         Replace ptr to string             @SC90264 05053000
  107. SCANFXZ  DS    0H                                              @SC90264 05053500
  108.          LR    8,1           Save ptr to filespec              @SC86299 05054000
  109.          USING FABFID,8      Map filespec                      @SC90264 05054500
  110.          XC    FABFID,FABFID Clear filespec                    @SC90264 05055000
  111.          MVC   FABFUID,DEST  Init user id                      @SC90264 05055500
  112.          PTEXT '&BADFSPC'                                      @SC90264 05056000
  113.          MVI   ERRNUM,ERRFNE Assume bad file name              @SC86158 05056500
  114.          IC    5,FSP0(5)     Get dispatch adr                  @SC88049 05057000
  115.          B     FSP0(5)       Go to proper handler              @SC88049 05057500
  116. *               TAKE        GET 1st    SEND 1st    Generic     @SC88049 05058000
  117. FSP0    DC AL1(FSPCPY-FSP0,FSPSN2-FSP0,FSPASC-FSP0,FSPUTL-FSP0) SC88049 05058500
  118. *               RECEIVE     GET 2nd    SEND 2nd    F-packet    @SC88049 05059000
  119.         DC AL1(FSPRC-FSP0,FSPRC-FSP0,FSPSN2-FSP0,FSPHD-FSP0)   @SC88049 05059500
  120. FSPUTL   TM    FSPFLG,FFWLD  Utility: default to all files?    @SC88049 05060000
  121.          BZ    FSPASC        No                                @SC86295 05060500
  122.          LA    1,LFID                                          @SC88043 05061000
  123.          LA    14,DEST       Default to prefix                 @SC88043 05061500
  124. *                            Convert to default filespec       @SC90264 05062000
  125. FSPASC   TM    FL2,SRV       Server mode?                      @SC86295 05062500
  126.          BZ    FSPCPY        No, don't need to convert         @SC86295 05063000
  127.          ICM   15,15,LEN     Get length                        @SC86295 05063500
  128.          BZ    FSPCPY                                          @SC86295 05064000
  129.          BCTR  15,0          Correct for EX                    @SC86158 05064500
  130.          L     5,ADR         Get string ptr                    @SC89215 05065000
  131.          EX    15,FSPTRAE    Change to EBCDIC                  @SC89215 05065500
  132.          EX    15,FSPTRUP    Upcase                            @SC89215 05066000
  133.          B     FSPCPY                                          @SC86295 05066500
  134. FSPTRAE  TR    0(,5),ATOED                                     @SC89301 05067000
  135. FSPTRUP  TR    0(,5),UPCASE                                    @SC89215 05067500
  136. FSPRC    NI    FL1,255-ROVR  Setup for RECEIVE                 @SC86295 05068000
  137.          NI    FL4,255-NMOK-NMCHNG  Collision not checked yet  @SC90033 05068500
  138.          MVI   FABFNAM,C'$'  Allow missing filespec            @SC90264 05069000
  139.          B     FSPCPY                                          @SC86295 05069500
  140. FSPHD    MVI   FABFNAM,1     Use default if missing filespec   @SC90264 05070000
  141.          B     FSPCPY                                          @SC86299 05070500
  142. FSPSN2   CLI   BRK,C','                                        @SC88306 05071000
  143.          BE    RTRN0         No foreign name: multiple format  @SC88306 05071500
  144.          NTOKN H=FSP2H,N=RTRN0                                 @SC88306 05072000
  145.          LA    7,1(,7)       Get token length                  @SC89179 05072500
  146.          LA    1,L'JFNAM                                       @SC86295 05073000
  147.          CR    7,1           Does it fit?                      @SC89179 05073500
  148.          BNH   *+6           Yes                               @SC86224 05074000
  149.           LR   7,1           Use what we can                   @SC86224 05074500
  150.          LR    3,0                                             @SC86295 05075000
  151.          STC   7,0(3)        Save length                       @SC86224 05075500
  152.          LA    0,1(3)                                          @SC86295 05076000
  153.          MVCL  0,6           Get fn, at least                  @SC86224 05076500
  154.          B     RTRN0                                           @SC86295 05077000
  155. *                                                                       05077500
  156. FSPCPY   NTOKN H=FSPH,N=FSPZ                                   @SC86299 05078000
  157. FSPCP2   KCALL FOPSTR,LFID(,8),E=FSPINV                        @SC89218 05078500
  158. *  id.TD    -> FABFTD, 4-byte ---, 4-byte destid, 4 blanks     @SC90264 05079000
  159. *  id.TS    -> FABFTS, 4-byte ---, 8-byte id                   @SC90264 05079500
  160. *  id.TSAUX -> FABFTS, 4-byte ---, 8-byte id                   @SC90264 05080000
  161. *  id.TSMAIN-> FABFTS+FABFMAIN, 4-byte ---, 8-byte id          @SC90264 05080500
  162. *  id       -> FABFTS, 4-byte ---, 8-byte id (but see below)   @SC90264 05081000
  163. *  id.PGM   -> FABFPGM, 4-byte parm, 8-byte pgm id             @SC90264 05081500
  164. *  id.SPOOL -> FABFSPL, 4-byte class, 8-byte spool name        @SC90264 05082000
  165. *  id.TAKE  -> FABFTAK, 4-byte uid, 8-byte file id             @SC90264 05082500
  166. *  id       -> (same, if TAKE or GIVE command)                 @SC90264 05083000
  167. *  'name.etc-> FABFSPL, 4-byte ', name ptr, 2-byte offset, len @SC90264 05083500
  168.          L     2,QFNPTR      Last-used buffer                  @SC90264 05084000
  169.          MVC   QFNPTR,QFNSIZ(2)   Set up for next              @SC90264 05084500
  170.          L     2,QFNPTR      Get ptr                           @SC90264 05085000
  171.          MVC   0(QFNSIZ,2),DEST+1 Copy prefix to buffer, less '@SC90264 05085500
  172.          LH    14,DESTL      Get length so far                 @SC90264 05086000
  173.          BCTR  14,0                                            @SC90264 05086500
  174.          CLI   0(6),C''''    Is name actually spelled out?     @SC90264 05087000
  175.          BNE   FSPQF1        No, keep prefix                   @SC90264 05087500
  176.          SR    14,14         Yes, start over                   @SC90264 05088000
  177.          LA    6,1(,6)        and skip '                       @SC90264 05088500
  178.          BCTR  7,0                                             @SC90264 05089000
  179.          MVI   FABFUID,C'''' Qualified name                    @SC90264 05089500
  180. FSPQF1   LA    1,0(7,6)      Point to last character           @SC90264 05090000
  181.          CLI   0(1),C''''    Does it end with a quote?         @SC90264 05090500
  182.          BE    *+8           Yes, chop it off                  @SC90264 05091000
  183.           LA   1,1(,1)       No, keep last char                @SC90264 05091500
  184.          LR    0,6                                             @SC90264 05092000
  185.          SR    1,0           Set up for MVCL                   @SC90264 05092500
  186.          ICM   1,8,BLANK                                       @SC90264 05093000
  187.          STH   14,QFNSHB     Save offset to start of short name@SC90264 05093500
  188.          AR    14,2          Ptr within buffer                 @SC90264 05094000
  189.          LA    15,QFNSIZ(,2) End of buffer                     @SC90264 05094500
  190.          SR    15,14                                           @SC90264 05095000
  191.          MVCL  14,0          Now, QFN is set, just in case     @SC90264 05095500
  192.          EX    7,FSPTRUPD    Convert to upper case             @SC90264 05096000
  193.          CLI   0(6),C' '     Hope it didn't start with dot     @SC90264 05096500
  194.          BE    FSPINV        Oops                              @SC90264 05097000
  195.          TM    FSPFLG,FFRCF                                    @SC86295 05097500
  196.          BZ    *+8                                             @SC86295 05098000
  197.           OI   FL1,ROVR      Overwrite received fname          @SC86295 05098500
  198.          MVI   FABFLGS,FABFTS Default is tmp.stor.             @SC90264 05099000
  199.          TM    FSPFLG,X'70'  TAKE file?                        @SC91150 05099500
  200.          BNZ   *+8           No                                @SC91150 05100000
  201.           MVI  FABFLGS,FABFTAK Yes, default is TAKE            @SC90264 05100500
  202.          MVI   TRTBL+C'/',1  Also look for slash               @SC90264 05101000
  203. FSPCPUID LA    1,1(7,6)      Past end                          @SC90264 05101500
  204.          EX    7,FSPTRTB     Find what was dot, if any         @SC90264 05102000
  205.          MVI   TRTBL+C'/',0                                    @SC90264 05102500
  206.          LR    5,1           Save ptr to first dot             @SC90264 05103000
  207.          BZ    FSPCP3        No dot, assume TS                 @SC90264 05103500
  208.          CLI   0(1),C'/'                                       @SC90264 05104000
  209.          BNE   FSPCPUIZ      No slash either, go on            @SC90264 05104500
  210.          SR    1,6           Get length of uid                 @SC90264 05105000
  211.          BNP   FSPINV        Empty uid, no good                @SC90264 05105500
  212.          LR    0,6           Start of uid                      @SC90264 05106000
  213.          LA    1,1(,1)       Length of uid plus '/'            @SC90264 05106500
  214.          AR    6,1           Adjust ptrs to text               @SC90264 05107000
  215.          SR    7,1                                             @SC90264 05107500
  216.          BNP   FSPINV        Nothing left, error               @SC90264 05108000
  217.          BCTR  1,0           Get length of uid again           @SC90264 05108500
  218.          LA    14,FABFUID                                      @SC90264 05109000
  219.          LA    15,LFUID                                        @SC90264 05109500
  220.          ICM   1,8,BLANK     Set to blank-fill                 @SC90264 05110000
  221.          MVCL  14,0          Copy to FID                       @SC90264 05110500
  222.          CLM   1,7,F0        Uid all used up?                  @SC90264 05111000
  223.          BNE   FSPINV        No, was too long                  @SC90264 05111500
  224.          B     FSPCPUID      Now look for file name            @SC90264 05112000
  225. FSPCPUIZ LA    1,1(7,6)      Past end                          @SC90264 05112500
  226.          AR    7,6           Ptr to last char                  @SC90264 05113000
  227.          SR    7,5           Anything after 1st dot?           @SC90264 05113500
  228.          BNP   FSPINV        No, error                         @SC90264 05114000
  229.          BCTR  7,0                                             @SC90264 05114500
  230.          CLI   FABFUID,C'''' Qualified name?                   @SC90264 05115000
  231.          BE    FSPQFN        Yes                               @SC90264 05115500
  232. *        EX    7,FSPTRTB5    Look for another dot              @SC90264 05116000
  233.          SR    1,5           Get length of type + 1            @SC90264 05116500
  234.          S     1,F2          Length - 1                        @SC90264 05117000
  235.          BM    FSPINV        Null, must have been ..           @SC90264 05117500
  236.          LA    14,FSPTYPS    Start of table                    @SC90264 05118000
  237.          SR    15,15                                           @SC90264 05118500
  238. FSPCPTLP CLI   0(14),255                                       @SC90264 05119000
  239.          MVI   FABFLGS,0     Just in case not found            @SC90264 05119500
  240.          BE    FSPINV        Not found                         @SC90264 05120000
  241.          MVC   FABFLGS,1(14) Copy flags                        @SC90264 05120500
  242.          IC    15,0(,14)     Get length of possible type       @SC90264 05121000
  243.          EX    1,FSPCPCLC    See if a match                    @SC90264 05121500
  244.          LA    14,3(15,14)   Space over this one, in case      @SC90264 05122000
  245.          BNE   FSPCPTLP      No match, keep looking            @SC90264 05122500
  246.          CR    1,15          Seems to match.  Same length?     @SC90264 05123000
  247.          BNE   FSPCPTLP      No match, keep looking            @SC90264 05123500
  248. FSPCP3   LA    15,1(7,6)     Past end once more                @SC90264 05124000
  249.          SR    5,6           Get length of token               @SC90264 05124500
  250.          LR    7,5                                             @SC90264 05125000
  251.          ICM   7,8,BLANK                                       @SC90264 05125500
  252.          LA    1,LFFNM                                         @SC90264 05126000
  253.          LA    0,FABFNAM     Start of name per se              @SC90264 05126500
  254.          MVCL  0,6           Copy to destination name          @SC90264 05127000
  255.          TM    FABFLGS,FABFTAK                                 @SC91150 05127500
  256.          BZ    FSPCP4        Leave fileclass alone if not TAKE @SC91150 05128000
  257.          CLI   FABFUID,C'*'  Self?                             @SC91150 05128500
  258.          BNE   FSPCP4                                          @SC91150 05129000
  259.          MVC   FABFUID,KUSERID Yes, set to userid              @SC91150 05129500
  260. FSPCP4   DS    0H                                              @SC91150 05130000
  261.          TM    FABFLGS,FABFTS                                  @SC91260 05130200
  262.          BO    FSPCP5                                          @SC91260 05130400
  263.          TM    FABFLGS,FABFTD                                  @SC90264 05130500
  264.          BZ    RTRN0                                           @SC90264 05131000
  265.          CLI   FABFNAM+4,C' ' TD id must be only 4 bytes       @SC90264 05131500
  266.          BNE   FSPINV                                          @SC90264 05132000
  267.          B     RTRN0                                           @SC87034 05132500
  268. FSPCP5   LA    1,FABFNAM+4   Last possible location of termid  @SC91260 05132540
  269.          LA    2,5           Number of places to check         @SC91260 05132580
  270. FSPCP6   CLC   =C'&KTRMS.',0(1) Look for termid signal         @SC91260 05132620
  271.          BE    FSPCP7        Found it                          @SC91260 05132660
  272.          BCTR  1,0                                             @SC91260 05132700
  273.          BCT   2,FSPCP6      Keep looking                      @SC91260 05132740
  274.          B     RTRN0         Not there, name is all set        @SC91260 05132780
  275. FSPCP7   L     2,DFHEIBP                                       @SC91260 05132820
  276.          MVC   0(4,1),EIBTRMID-DFHEIBLK(2) Replace with termid @SC91260 05132860
  277.          B     RTRN0                                           @SC91260 05132900
  278. *                                                                       05133000
  279. FSPQFN   MVI   TRTBL+C'(',1                                    @SC90264 05133500
  280.          EX    7,FSPTRTB5    Find next dot or (, if any        @SC90264 05134000
  281.          MVI   TRTBL+C'(',0                                    @SC90264 05134500
  282.          SR    1,6                                             @SC90264 05135000
  283.          STH   1,QFNSHL                                        @SC90264 05135500
  284.          MVC   FABFNAM(8),QFNPTR Save ptrs to QFN in FAB       @SC90264 05136000
  285.          MVI   FABFLGS,FABFSPL Treat like a spool file, CL='   @SC90264 05136500
  286.          B     RTRN0                                           @SC90264 05137000
  287. *                                                                       05137500
  288. FSPTRUPD TR    0(,6),FSPUPDOT Upcase and dot to blank          @SC90264 05138000
  289. FSPDSPMV MVC   1(,1),2(14)   Copy type from table              @SC90264 05138500
  290. FSPCPCLC CLC   2(,14),1(5)   Compare to type table             @SC90264 05139000
  291. FSPTRTB5 TRT   1(,5),TRTBL   Look for 2nd blank                @SC90264 05139500
  292. FSPTRTB  TRT   0(,6),TRTBL   Look for blank                    @SC90264 05140000
  293. *                                                                       05140500
  294. * Table of file types: AL1(len-1,flags),C'type'                @SC90264 05141000
  295. FSPTYPS  DC    AL1(2-1,FABFTS),C'TS'                           @SC90264 05141500
  296.          DC    AL1(5-1,FABFTS),C'TSAUX'                        @SC90264 05142000
  297.          DC    AL1(6-1,FABFTS+FABFMAIN),C'TSMAIN'              @SC90264 05142500
  298.          DC    AL1(2-1,FABFTD),C'TD'                           @SC90264 05143000
  299.          DC    AL1(3-1,FABFPGM),C'PGM'                         @SC90264 05143500
  300.          DC    AL1(5-1,FABFSPL),C'SPOOL'                       @SC90264 05144000
  301.          DC    AL1(4-1,FABFTAK),C'TAKE'                        @SC90264 05144500
  302.          DC    AL1(255)                                        @SC90264 05145000
  303. *                                                                       05145500
  304. FSPZ     LA    6,1           Update counter                    @SC86299 05146000
  305.          A     6,EVCTR                                         @SC86299 05146500
  306.          ST    6,EVCTR                                         @SC86299 05147000
  307.          UNPK  FSPFNAM(5),EVCTR(5)                             @SC90264 05147500
  308.          TR    FSPFNAM(6),TRHEX Get unique DDNAME              @SC90264 05148000
  309.          MVI   FSPFNAM,C'K'                                    @SC90264 05148500
  310.          MVC   FSPFNAM+4(7),=C'&KTRMS..TS'  Make unique        @SC91260 05149500
  311.          LA    6,FSPFNAM     Default name                      @SC90264 05150500
  312.          LA    7,11-1                                          @SC90264 05151000
  313.          CLI   FABFNAM,1                                       @SC90264 05151500
  314.          BE    FSPCP2        Get default DEST                  @SC90264 05152000
  315.          BH    RTRN0         Don't insist                      @SC86299 05152500
  316.          PTEXT '&NOFSPEC'                                      @SC90264 05153000
  317. FSPINV   LA    15,2                                            @SC86295 05153500
  318.          B     FSPPTRS                                         @SC86295 05154000
  319. *                                                                       05154500
  320. FSPH     PTEXT '&FMTFSPC&FSPCPRM'                              @SC91224 05155000
  321.          CLI   FSPFLG,FFSND  SEND 1st?                         @SC89261 05155500
  322.          BE    *+8           Yes, use whole message            @SC89261 05156000
  323.           SH   4,=H'&FMTOPT' Chop off option part              @SC91224 05156500
  324.          B     FSP0H                                           @SC86295 05157000
  325. FSP2H    PTEXT '&FORFSPC'                                      @SC86295 05157500
  326. FSP0H    LA    15,1                                            @SC86295 05158000
  327. FSPPTRS  RETREG 3,4                                            @SC86295 05158500
  328. FSPRET   RET   ,                                               @SC86295 05159000
  329. *                                                                       05159500
  330. * Non-parsing functions . . .                                           05160000
  331. *                                                                       05160500
  332. * Get unique filespec                                                   05161000
  333. FSPWRN   LR    8,1           Save name ptr                     @SC90264 05161500
  334.          TM    FSPFLG,FFENC                                    @SC86295 05162000
  335.          BO    FSPENC        Encode name into buffer           @SC86295 05162500
  336.          TM    FSPFLG,FFDSP                                    @SC86295 05163000
  337.          BO    FSPDSP        Copy name into buffer for display @SC86295 05163500
  338.          TM    FL4,NMOK      Already checked?                  @SC87012 05164000
  339.          BO    RTRN0         Yes, ok                           @SC87012 05164500
  340.          MVC   XFILE,FABFID  Save original name                @SC90033 05165000
  341.          MVC   FSPFID,FABFID Save original name                @SC87015 05165500
  342.          TM    FABFLGS,FABFPGM Pipe?                           @SC90264 05166000
  343.          BO    FSPNOKD       Yes, name is already unique       @SC90264 05166500
  344.          LA    6,FSPFNAM+6   End of id                         @SC90264 05167000
  345.          BCTR  6,0                                             @BS86001 05167500
  346.          CLI   0(6),C' '     Find end of token                 @BS86001 05168000
  347.          BE    *-6                                             @BS86001 05168500
  348.          LA    5,10+1        Allowed retries                   @BS86001 05169000
  349.          LA    7,C'0'        Extra character                   @BS86001 05169500
  350. FSPTOPN  OPENF T,FSPFID,E=FSPNOKA No collision                 @SC91150 05170000
  351.          CLI   FSPFID+1,C'''' Quoted file name?                @SC90264 05170500
  352.          BE    FSPCOLL       Yes, give up                      @SC90264 05171000
  353.          OI    FL4,NMCHNG    Remember collision occurred       @SC90033 05171500
  354.          MVI   1(6),C'$'     Yes, modify id                    @BS86001 05172000
  355.          TM    FSPFID,FABFTAK TAKE file?                       @SC90264 05172500
  356.          BO    *+8           Yes, keep it so                   @SC90264 05173000
  357.           MVI  FSPFID,FABFTS No, alternate would always be TS  @SC90264 05173500
  358.          STC   7,2(,6)       Serialize                         @BS86001 05174000
  359.          LA    7,1(7)        Bump counter                      @BS86001 05174500
  360.          BCT   5,FSPTOPN                                       @SC87015 05175000
  361. FSPCOLL  PTEXT '&FILCLSN'                                      @SC90264 05175200
  362.          B     FSP0H         Return ptrs and rc=1              @SC88049 05176000
  363. FSPNOKA  TM    FSPFID,FABFTD TD?                               @SC91150 05176500
  364.          BZ    FSPNOKD       No, it's really ok                @SC91150 05177000
  365.          CLI   DSKSTT+FDBFL2-FABD,0  Did we find anything?     @SC91150 05177500
  366.          BE    FSPCOLL       Nothing, can't write there        @SC91150 05178000
  367. FSPNOKD  MVC   FABFID,FSPFID Copy name back                    @SC87015 05178500
  368.          OI    FL4,NMOK                                        @SC87015 05179000
  369.          B     RTRN0                                           @SC87015 05179500
  370. *                                                                       05180000
  371. * Encode name at (R8) into (R7) buffer (in ASCII), possibly with        05180500
  372. *  substitution from JFSPEC, but disable subsequent subst.              05181000
  373. *  Return updated ptr in R15                                            05181500
  374. FSPENC   CLI   FABFLGS,0     Valid filespec?                   @SC90264 05182000
  375.          BNE   FSPENC1       Yes, do it                        @SC90264 05182500
  376.          INITSTR '&NOFSPEC',0(7),REG=1                         @SC92300 05183000
  377.          B     FSPENTR       And use it                        @SC90264 05184000
  378. FSPENC1  LA    1,JFSPEC      Complex string?                   @SC90264 05184500
  379.          BAL   14,PAKFOR                                       @SC86224 05185000
  380.          BNZ   FSPECPZ       Yes, name overridden              @SC86299 05185500
  381.          LR    1,7           Set ptr                           @SC90264 05186000
  382.          BAL   9,FSPDSPL     Get id                            @SC90264 05186500
  383. FSPENTR  DS    0H            Translate and adjust ptr          @SC88070 05187000
  384.          TR    0(LFID+8,7),ETOAD                               @SC89301 05187500
  385.          LR    7,1           Advance ptr                       @SC86299 05188000
  386. FSPECPZ  MVI   JFSPEC,0      Turn off string                   @SC86299 05188500
  387. FSPENR   LR    15,7          Save ptr                          @SC86295 05189000
  388.          B     FSPRET                                          @SC86295 05189500
  389. *                                                                       05190000
  390. * Copy name at (R8) into (R7) buffer in display form           @SC90264 05190500
  391. *  Return updated ptr in R15                                            05191000
  392. FSPDSP   LR    1,7           Output ptr                        @SC90264 05191500
  393.          TM    FABFLGS,FABFTAK TAKE file?                      @SC90264 05192000
  394.          BZ    FSPDSP2       No, uid is ignored                @SC90264 05192500
  395.          CLC   FABFUID,CURFUID Yes.  Is uid the usual?         @SC91150 05193000
  396.          BE    FSPDSP2       Yes, suppress it                  @SC90264 05193500
  397.          MVC   0(LFUID,1),FABFUID                              @SC90264 05194000
  398.          TRT   0(LFUID,1),TRTBL  Check for trailing blanks     @SC90264 05194500
  399.          BNZ   *+8                                             @SC90264 05195000
  400.           LA   1,LFUID(,1)   None, set ptr to max              @SC90264 05195500
  401.          MVI   0(1),C'/'                                       @SC90264 05196000
  402.          LA    1,1(,1)       Skip over '/'                     @SC90264 05196500
  403. FSPDSP2  BAL   9,FSPDSPL     Encode id                         @SC90264 05197000
  404.          LR    15,1          End of string                     @SC90264 05197500
  405.          B     FSPRET                                          @SC86299 05198000
  406. *  Encode id from R8 into buffer at R1, return new ptr in R1   @SC90264 05198500
  407. *  Uses R2,R14,R15.  Return via R9                             @SC90264 05199000
  408. FSPDSPL  CLI   FABFUID,C'''' Quoted file name?                 @SC90264 05199500
  409.          BNE   FSPDSPL1      No, do normal decoding            @SC90264 05200000
  410.          ICM   14,15,FABFNAM Yes, get ptr to buffer            @SC90264 05200500
  411.          AH    14,FABFNAM+4  Get offset for display form       @SC90264 05201000
  412.          S     14,F2         Back up to set up MVC             @SC90264 05201500
  413.          MVI   0(1),C''''    Insert quote to flag it           @SC90264 05202000
  414.          LH    15,FABFNAM+6  Get length of name                @SC90264 05202500
  415.          BCTR  15,0          Correct for MVC                   @SC90264 05203000
  416.          EX    15,FSPDSPMV   Move to the output                @SC90264 05203500
  417.          LA    1,2(15,1)     Point past the end                @SC90264 05204000
  418.          BR    9             All done                          @SC90264 05204500
  419. FSPDSPL1 MVC   0(LFFNM,1),FABFNAM Grab id                      @SC90264 05205000
  420.          TRT   0(LFFNM,1),TRTBL  Check for trailing blanks     @SC90264 05205500
  421.          BNZ   *+8                                             @SC90264 05206000
  422.           LA   1,LFFNM(,1)                                     @SC90264 05206500
  423.          MVI   0(1),C'.'     Insert dot                        @SC90264 05207000
  424.          LA    14,FSPTYPS    Start of table                    @SC90264 05207500
  425.          SR    15,15                                           @SC90264 05208000
  426. FSPDSPLP CLI   0(14),255                                       @SC90264 05208500
  427.          BER   9             Not found, omit type (???)        @SC90264 05209000
  428.          MVC   FSPFID(1),1(14)  Copy flags                     @SC90264 05209500
  429.          IC    15,0(,14)     Get length of possible type       @SC90264 05210000
  430.          EX    15,FSPDSPMV   Copy type to string               @SC90264 05210500
  431.          LA    14,3(15,14)   Space over this one, in case      @SC90264 05211000
  432.          NC    FSPFID(1),FABFLGS See if same type              @SC90264 05211500
  433.          BZ    FSPDSPLP      No match, keep looking            @SC90264 05212000
  434.          LA    1,2(15,1)     Point past the end                @SC90264 05212500
  435.          BR    9                                               @SC90264 05213000
  436.          DROP  8                                               @SC90264 05213500
  437. *                                                                       05214000
  438. * Table to convert EBCDIC text to upper case + dot to blank    @SC89215 05214500
  439. FSPUPDOT DC    (C'.')AL1(*-FSPUPDOT)                           @SC89215 05215000
  440.          DC    C' '                                            @SC89215 05215500
  441.          DC    (127-C'.')AL1(*-FSPUPDOT)                       @SC89215 05216000
  442.          HTBL  80,C1,C2,C3,C4,C5,C6,C7,C8,C9,8A,8B,8C,8D,8E,8F @SC89268 05216500
  443.          HTBL  90,D1,D2,D3,D4,D5,D6,D7,D8,D9,9A,9B,9C,9D,9E,9F @SC89268 05217000
  444.          HTBL  A0,A1,E2,E3,E4,E5,E6,E7,E8,E9,AA,AB,AC,AD,AE,AF @SC89268 05217500
  445.          DC    080AL1(*-FSPUPDOT)                              @SC89215 05218000
  446.          LOCALS ,                                              @SC86295 05218500
  447. FSPFID   DS    CL(LFID)                                        @SC88342 05219000
  448. FSPFNAM  EQU   FSPFID+1+LFUID File name per se                 @SC90264 05219500
  449. FSPFLG   DS    X             Filespec flags                    @SC86295 05220000
  450. FSPEC    EXIT                                                  @SC86295 05220500
  451.          TITLE 'KHELP routine - perform HELP command'                   05221000
  452. * Handle HELP command, rest of string given by SCANPTR.                 05221500
  453. * On entry, R6->help command string                                     05222000
  454. KHELP    ENTER ,                                               @SC86355 05222500
  455.          LR    8,6           Save ptr to command               @SC88043 05223000
  456.          SR    5,5           Clear length of extra word        @SC90264 05223500
  457.          NTOKN N=KHLI        See if subcommand given           @SC86355 05224000
  458.          L     1,=A(USNCMD)  Command table                     @SC87117 05224500
  459. KHSCAN   SCAN  (1),KHLF,NODISP                                 @SC86355 05225000
  460.          WTEXT '&BADSBCM'   Not found                          @SC86355 05225500
  461.          RET   ,                                               @SC86355 05226000
  462. KHLF     CLM   7,8,F0        Just '?'                          @SC86355 05226500
  463.          BE    RTRN          Yes, done                         @SC86355 05227000
  464.          CLC   =C'&AAAASET',KWNAME(1)                          @SC90264 05227500
  465.          BNE   KHNORM        Normal subcommands                @SC90264 05228000
  466.          PTEXT 'SET',AREG=4,LREG=5                             @SC90264 05228500
  467.          NTOKN N=KHSET       Just SET -- no parameter          @SC90264 05229000
  468.          L     1,=A(SETCMDKW)  Keyword table                   @SC90264 05229500
  469.          B     KHSCAN        Go back and check parameter       @SC90264 05230000
  470. KHNORM   DS    0H                                              @SC90264 05230500
  471.          LA    6,KWNAME(,1)  Ptr to name in table              @SC90264 05231000
  472.          SR    7,7                                             @SC90264 05231500
  473.          IC    7,KWMIN(,1)   Length - 1 of abbrev              @SC90264 05232000
  474.          LA    7,1(,7)                                         @SC90264 05232500
  475.          B     KHLJ          Create command string for typing  @SC90264 05233000
  476. KHSET    SR    7,7           Plain SET with no parameter       @SC90264 05233500
  477.          B     KHLJ          Do it                             @SC90264 05234000
  478. KHLI     PTEXT 'KERMITCM',AREG=6,LREG=7                        @SC90264 05234500
  479. KHLJ     PTEXT '&TYPCMD ',AREG=0,LREG=1                        @SC90264 05235000
  480.          LA    14,KHLPBF                                       @SC90264 05235500
  481.          LR    15,1                                            @SC90264 05236000
  482.          MVCL  14,0          Copy 'type' to buffer             @SC90264 05236500
  483.          MVC   0(LFUID,14),SYSUID  Set up filespec             @SC92150 05237000
  484.          LA    1,LFUID(,14)  Tentative end of uid              @SC92150 05237200
  485.          TRT   0(LFUID,14),TRTBL Find 1st blank, if any        @SC92150 05237400
  486.          MVI   0(1),C'/'     Insert separator                  @SC92150 05237600
  487.          LA    14,1(,1)                                        @SC92150 05237800
  488.          LR    15,5                                            @SC90264 05238000
  489.          LA    5,8           Keep track of available space     @SC90264 05238500
  490.          MVCL  14,4          Copy 'SET' to buffer, if needed   @SC90264 05239000
  491.          LR    15,7                                            @SC90264 05239500
  492.          LR    7,5           Remaining space                   @SC90264 05240000
  493.          CR    15,7          Check for enough room             @SC93264 05240100
  494.          BNH   *+6           Ok, it fits                       @SC93264 05240200
  495.           LR   15,7          No, just use what fits            @SC93264 05240300
  496.          MVCL  14,6          Copy 'subcmd' to buffer           @SC90264 05240500
  497.          LA    15,4          Length of suffix desired          @SC90264 05241000
  498.          CR    15,7                                            @SC90264 05241500
  499.          BNH   *+6                                             @SC90264 05242000
  500.           LR   15,7          Can't fit it all                  @SC90264 05242500
  501.          LA    6,=CL4'HELP'  Suffix                            @SC90264 05243000
  502.          MVCL  14,6                                            @SC90264 05243500
  503.          MVC   0(5,14),=C'.TAKE'  Set file type                @SC90264 05244000
  504.          LA    6,5(,14)      End of string                     @SC90264 05244500
  505.          LA    0,KHLPBF      Start of command                  @SC90264 05245000
  506.          SR    6,0           Total length                      @SC88043 05245500
  507.          NI    FL4,255-UCMD                                    @SC88043 05246000
  508.          KCALL SUPFNC,3      Do it                             @SC86355 05246500
  509.          RET   ,                                               @SC86355 05247000
  510.          LOCALS ,                                                       05247500
  511. KHLPBF   DS    CL4,C,CL(LFUID+1),CL8,CL5  Space for command    @SC90264 05248000
  512. KHELP    EXIT  ,                                               @SC87007 05248500
  513.          TITLE 'SUPFNC Routine - various supervisor functions' @SC86158 05249000
  514. SUPFNC   ENTER                                                 @SC86295 05249500
  515. *  On entry, R1 = operation code, R0 = possible ptr            @SC86158 05250000
  516. * Exit: R15 set (0 => ok, <0 => illegal cmd, >0 => depends)             05250500
  517. *       ERRNUM set appropriately (R1=1,3,4) or unchanged (2,5-11)       05251000
  518. * 1 -> Start typeout interception.  N.B.  &MAXLR >> 2048 for this       05251500
  519. * 2 -> Clean up afterwards and stop interception                        05252000
  520. * 3 -> Execute host command with or without interception                05252500
  521. *      If UCMD set, SCANPTR gives text, else R0->text,R6=len            05253000
  522. * 4 -> (not used)                                                       05253500
  523. * 5 -> Stop interception if going                                       05254000
  524. * 6 -> Retrieve original cmd parm string into CBUF (R15=1 if null)      05254500
  525. * 7 -> Test for stacked lines, return number in R15                     05255000
  526. * 8 -> Log off (must return to TMP)                                     05255500
  527. * 9 -> Wait specified time                                              05256000
  528. * 10-> Return clock time in R15 (centisec)                              05256500
  529. * 11-> Setup up new prompt string at (R0)                               05257000
  530.          AR    1,1                                             @SC89268 05257500
  531.          LH    1,SFC0-2(1)   Get dispatch address              @SC89268 05258000
  532.          B     SFC0(1)                                         @SC89268 05258500
  533. SFC0     DC    Y(ICPBEG-SFC0,ICPFIN-SFC0,SFCHST-SFC0)  1-3     @SC89268 05259000
  534.          DC    Y(SFCILL-SFC0,ICPRST-SFC0,SFCLIN-SFC0)  4-6     @SC89268 05259500
  535.          DC    Y(SFCSTK-SFC0,SFCKIL-SFC0,SFCWT-SFC0)   7-9     @SC89268 05260000
  536.          DC    Y(SFCCLK-SFC0,SFCPRP-SFC0)             10-11    @SC89268 05260500
  537. *                                                                       05261000
  538. * Start interception, initialize ptrs                          @SC86158 05261500
  539. ICPBEG   MVI   ERRNUM,ERRNOE OK                                @SC89268 05262000
  540.          L     1,WBUF        Output buffer                     @SC90264 05262500
  541.          LA    0,2048(,1)    Skip over some, to be safe        @SC90264 05263000
  542.          SH    1,=Y(MAXDOF)                                    @SC90264 05263500
  543.          A     1,F64KP       End of buffer                     @SC90264 05264000
  544.          LR    15,0                                            @SC86158 05264500
  545.          STM   15,1,TXTPTR   Save                              @SC86158 05265000
  546.          SR    1,0           Get length                        @SC86158 05265500
  547.          L     15,=X'15000000'                                 @SC86158 05266000
  548.          MVCL  0,14          Fill with NL (X'15')              @SC86158 05266500
  549.          MVI   ICPFL,2       Now intercepting typeout          @SC88026 05267000
  550.          B     RTRN0                                           @SC86295 05267500
  551. * Clean up after interception                                  @SC86295 05268000
  552. ICPFIN   DS    0H                                              @SC89268 05268500
  553. * Restore normal typeout                                                05269000
  554. ICPRST   MVI   ICPFL,0       Tear down                         @SC88026 05269500
  555.          B     RTRN0                                                    05270000
  556. * Execute host command at (R0) with length (R6), unless UCMD set,       05270500
  557. *  in which case string given by SCANPTR                                05271000
  558. SFCHST   TM    FL4,UCMD      User command?                     @SC86295 05271500
  559.          BO    SFCHS0        Yes, scan already set up          @SC86355 05272000
  560.          ST    0,ADR         Set scan string ptrs              @SC86355 05272500
  561.          ST    6,LEN                                           @SC86355 05273000
  562. SFCHS0   LM    0,1,SCANPTR   Get length and adr                @SC87034 05273500
  563.          LTR   6,0           Copy length                       @SC87034 05274000
  564.          BNP   SFCILL        No good                           @SC87034 05274500
  565.          BCTR  6,0                                             @SC87034 05275000
  566.          EX    6,TRUPCAS                                       @SC87034 05275500
  567.          NTOKN N=SFCHBAD                                       @SC88308 05276000
  568.          SCAN  HSTCMDS,RTRN0 Dispatch to handler               @SC88308 05276500
  569. *          Not one of the canned commands, try as CICS         @SC90264 05277000
  570.          MVI   ERRNUM,ERRSYS Say illegal command if failure    @SC90264 05277500
  571.          LA    7,1(,7)       Token length                      @SC90264 05278000
  572.          LA    1,L'SFCPGM    Length of field                   @SC90264 05278500
  573.          CR    7,1           Is it longer than max?            @SC90264 05279000
  574.          BH    RTRNM1        Yes, forbid it                    @SC90264 05279500
  575.          ICM   7,8,BLANK     Prepare for MVCL with padding     @SC90264 05280000
  576.          LA    0,SFCPGM                                        @SC90264 05280500
  577.          MVCL  0,6           Copy to program name buffer       @SC90264 05281000
  578.          ICM   15,15,=A(KHOST)                                 @SC90264 05281500
  579.          BZ    SFCHSX                                          @SC90264 05282000
  580.          LA    0,SFCPGM                                        @SC90264 05282500
  581.          L     1,ADR         String address                    @SC90264 05283000
  582.          LA    2,LEN         Ptr to length                     @SC90264 05283500
  583.          STM   0,2,SFCSECPL  Set up calling sequence           @SC90264 05284000
  584.          KCALL (15),SFCSECPL,EXT,E=RTRNM1                      @SC90264 05284500
  585. SFCHSX   DS    0H                                              @SC90264 05285000
  586.          L     2,ADR         Ptr to remaining string           @SC90264 05285500
  587.          EXEC CICS LINK PROGRAM(SFCPGM) COMMAREA(0(,2)),       @SC90264+05286000
  588.                LENGTH(LEN+2) NOHANDLE,                         @SC91150 05286500
  589.          L     15,DFHEIBP    Set up to copy EIB code           @SC91150 05287000
  590.          CLC   F0,EIBRCODE-DFHEIBLK(15)  Ok?                   @SC91150 05287500
  591.          BNE   RTRNM1        No, say illegal                   @SC91150 05288000
  592.          TM    FSCTRMF,X'80' TTY?                              @SC91150 05288500
  593.          BZ    SFCHSRC       Yes, skip reformatting            @SC91150 05289000
  594.          TM    FL4,UCMD      User cmd?                         @SC91150 05289500
  595.          BZ    SFCHSRC       No, skip reformatting             @SC91150 05290000
  596.          EXEC CICS SEND FROM(ICPSETCC) LENGTH(=Y(ICPSETL)),    @SC91150+05290500
  597.                CTLCHAR(=X'C3') WAIT,  Reformat but don't clear @SC91150 05291000
  598. SFCHSRC  DS    0H                                              @SC91150 05291500
  599.          SR    15,15         Clear RC for now                  @SC90264 05292000
  600.          CLC   =C'R(',0(2)   Is it a return code?              @SC91150 05292500
  601.          BNE   SFCUTZ        No, just use 0                    @SC91150 05293000
  602.          CLI   6(2),C')'     Must be four bytes                @SC91150 05293500
  603.          BNE   SFCUTZ        No, just use 0                    @SC91150 05294000
  604.          CLC   2(1,2),3(2)   Is it small number?               @SC91150 05294500
  605.          BNE   SFCUTZ        No, just use 0                    @SC91150 05295000
  606.          ICM   15,15,2(2)    Ok use that code                  @SC91150 05295500
  607.          B     SFCUTZ        Display return code and return    @SC90264 05296000
  608. *                                                                       05296500
  609. SFCHBAD  MVI   ERRNUM,ERRSYS Illegal system command            @SC90223 05297000
  610.          HELP  HSTCMDS,RTRNM1                                  @SC90223 05297500
  611. *                                                                       05298000
  612. HSTCMDS  KW    'DIRECTORY',SFCDIR,MIN=3                        @SC88308 05298500
  613.          KW    'COPY',SFCCOP,MIN=4                             @SC88308 05299000
  614.          KW    'DELETE',SFCDEL,MIN=3                           @SC88308 05299500
  615.          KW    'RENAME',SFCREN,MIN=3                           @SC88308 05300000
  616.          KW    '&TYPCMD',SFCTYP                                @SC88308 05300500
  617. * ought to implement some on-line help                         @SC90264 05301000
  618.          KW    '&ANYCICS',0,MIN=99                             @SC90264 05301500
  619.          KW    ,                                               @SC88308 05302000
  620. *                                                                       05302500
  621. SFCDIR   LA    3,13          DISKIO dir function code          @SC88308 05303000
  622.          B     SFCUTL                                          @SC88308 05303500
  623. SFCDEL   LA    3,14          DISKIO del function code          @SC88308 05304000
  624.          B     SFCUTL                                          @SC88308 05304500
  625. SFCREN   LA    3,15          DISKIO ren function code          @SC88308 05305000
  626.          B     SFCUTL                                          @SC88308 05305500
  627. SFCCOP   LA    3,16          DISKIO cop function code          @SC88308 05306000
  628.          B     SFCUTL                                          @SC88308 05306500
  629. SFCTYP   LA    3,17          DISKIO typ function code          @SC88308 05307000
  630. *        B     SFCUTL                                          @SC88308 05307500
  631. SFCUTL   SR    0,0                                             @SC88308 05308000
  632.          KCALL FSPEC,FILNAM,E=SUBERR                           @SC88308 05308500
  633.          CH    3,SFCDEL+2                                      @SC88308 05309000
  634.          BNH   SFCUT1        Dir or del                        @SC88308 05309500
  635.          CH    3,SFCTYP+2                                      @SC88308 05310000
  636.          BE    SFCUT1        Type                              @SC88308 05310500
  637.          SR    0,0                                             @SC88308 05311000
  638.          KCALL FSPEC,IFILE,E=SUBERR Get 2nd file name          @SC88308 05311500
  639. SFCUT1   FTOKN N=SFCUT6      See if anything else in command   @SC88308 05312000
  640.          PTEXT '&NOOPERS'                                      @SC88308 05312500
  641.          B     SUBERR                                          @SC88308 05313000
  642. SFCUT6   LR    0,3           Get function code                 @SC88308 05313500
  643.          LA    2,IFILE       Optional 2nd name                 @SC88308 05314000
  644.          KCALL DISKIO,FILNAM Do it                             @SC88308 05314500
  645. SFCUTZ   DS    0H                                              @SC90264 05315000
  646.          LTR   4,15                                            @SC86295 05315500
  647. * Issue return code msg if needed                              @SC86295 05316000
  648.          BZ    SFCZRC        RC=0                              @SC86158 05316500
  649.          TM    FL4,UCMD      User cmd?                         @SC86316 05317000
  650.          BZ    RTRN          No. No message, just rc in R15    @SC90264 05317500
  651.          MVC   CMD(2),=C'R(' Set up message                    @SC86209 05318000
  652.          LA    15,CMD+2                                        @SC86209 05318500
  653.          BAL   2,EDDEC       Edit RC into msg                  @SC86295 05319000
  654.          MVI   0(15),C')'    Format is R(rc)                   @SC86209 05319500
  655.          LA    0,1(15)                                         @SC86268 05320000
  656.          LA    1,CMD         Start of edited string            @SC86209 05320500
  657.          SR    0,1           Length                            @SC86268 05321000
  658.          WTEXT (1),(0)                                         @SC86268 05321500
  659. SFCZRC   LR    15,4                                            @SC86295 05322000
  660.          MVI   ERRNUM,ERRNOE No errors                         @SC86295 05322500
  661.          B     RTRN                                            @SC86295 05323000
  662. * Unused, system-specific command type                                  05323500
  663. SFCILL   MVI   ERRNUM,ERRSYS Illegal system command            @SC86295 05324000
  664.          B     RTRNM1                                          @SC86295 05324500
  665. *                                                                       05325000
  666. * Retrieve original command line arguments, if any             @SC86295 05325500
  667. *   Return code =0 if yes, =1 if no                            @SC86295 05326000
  668. *   Leave string in CBUF buffer (up to 512), length in CLEN    @SC86295 05326500
  669. SFCLIN   DS    0H                                              @SC89268 05327000
  670.          LH    15,LINLEN     Length of data                    @SC90264 05327500
  671.          LTR   15,15         Anything there?                   @SC86299 05328000
  672.          BNP   RTRN1         Nothing there                     @SC86299 05328500
  673.          L     14,GTLBUFP    Start of data                     @SC90264 05329000
  674.          AR    15,14         End of data                       @SC90264 05329500
  675.          CLI   0(14),SBA     Check for fullscreen buffer adr   @SC90264 05330000
  676.          BNE   *+8                                             @SC90264 05330500
  677.           LA   14,3(,14)     Yes, skip over it                 @SC90264 05331000
  678. SFCLNL1  LA    14,1(,14)     Look for blank after tran id      @SC90264 05331500
  679.          CLI   0(14),C' '                                      @SC90264 05332000
  680.          BE    SFCLNL2       Found it                          @SC90264 05332500
  681.          CR    14,15         Anything left?                    @SC90264 05333000
  682.          BL    SFCLNL1       Yes, keep looking                 @SC90264 05333500
  683. SFCLNL2  DS    0H                                              @SC90264 05334000
  684.          LA    14,1(,14)     Skip over leading blanks, too     @SC90264 05334500
  685.          CLI   0(14),C' '    Leading blanks?                   @SC90264 05335000
  686.          BE    *-8                                             @SC90264 05335500
  687.          SR    15,14         Anything left?                    @SC90264 05336000
  688.          BNP   RTRN1         Nothing there                     @SC86299 05336500
  689.          STM   14,15,GTPBPTRS Save ptrs for GETLIN             @SC91121 05337000
  690.          B     RTRN0                                           @SC86295 05337500
  691. *                                                                       05338000
  692. * Test for stacked commands                                    @SC86295 05338500
  693. *   return code = number of stacked lines                      @SC86295 05339000
  694. SFCSTK   DS    0H            Go to RTRN1 if something stacked  @SC90264 05339500
  695.          ICM   1,15,GTPBPTRS+4 Length stacked for GETLIN       @SC91121 05340000
  696.          BP    RTRN1         Something there, say at least 1   @SC91121 05340500
  697.          B     RTRN0         Nothing stacked                   @SC88095 05341000
  698. *                                                                       05341500
  699. * Log out                                                      @SC86295 05342000
  700. SFCKIL   LR    3,13                                            @SC88026 05342500
  701.          L     3,4(,3)       Look back through save areas      @SC88026 05343000
  702.          CLC   =A(USNTRF),16(3) Find main loop                 @SC89215 05343500
  703.          BNE   *-10                                            @SC88026 05344000
  704.          L     3,8(,3)       Ptr to main save area             @SC88026 05344500
  705.          OI    KFLG-USNTRFSV(3),CMDC Set flag to quit          @SC88026 05345000
  706.          L     DFHEIBR,DFHEIBP                                 @SC91260 05345500
  707.          USING DFHEIBLK,DFHEIBR                                @SC91260 05345600
  708.          EXEC CICS START TRANSID('CSSF') TERMID(EIBTRMID),     @SC91260 05345700
  709.          DROP  DFHEIBR                                         @SC91260 05345800
  710.          B     RTRN0         Can't do any better               @SC90264 05346000
  711. *                                                                       05346500
  712. * Wait specified time in R0 (sec)                                       05347000
  713. SFCWT    CVD   0,TMPDW       Convert to decimal                @SC90264 05347500
  714.          EXEC CICS DELAY INTERVAL(TMPDW+4),                    @SC90264 05348000
  715.          B     RTRN0                                           @SC90264 05348500
  716. *                                                                       05348510
  717. * Set up prompt string                                         @SC89334 05348520
  718. SFCPRP   ICM   4,1,S1HND     See if handshake is defined       @SC89334 05348530
  719.          BZ    RTRN0         No, skip it                       @SC89334 05348540
  720.          LR    1,0           Ptr to prompt string              @SC89334 05348550
  721.          BCTR  1,0           Ptr to prompt string length       @SC89334 05348560
  722.          SR    2,2                                             @SC89334 05348570
  723.          ICM   2,1,0(1)      Get length                        @SC89334 05348580
  724.          BZ    RTRN0         No prompt, leave it to system     @SC89334 05348590
  725.          LA    3,0(2,1)      Point to last character           @SC89334 05348600
  726.          CLM   4,1,0(3)      Is it the handshake?              @SC89334 05348610
  727.          BE    RTRN0         Yes, assume all is well           @SC89334 05348620
  728.          STC   4,1(,3)       No, tack one onto string          @SC89334 05348630
  729.          LA    2,1(,2)       And update length                 @SC89334 05348640
  730.          STC   2,0(,1)                                         @SC89334 05348650
  731.          B     RTRN0                                           @SC89334 05348660
  732. *                                                                       05349000
  733. * Return time in centisec in R15                                        05349500
  734. SFCCLK   STCK  TMPDW         Store TOD clock                   @SC89268 05350000
  735.          LM    14,15,TMPDW                                     @SC86295 05350500
  736.          SLDL  14,8          Take mod 204 days                 @SC86295 05351000
  737.          SRDL  14,20         Get in microsec                   @SC86295 05351500
  738.          D     14,=F'10000'  Get in centisec                   @SC86295 05352000
  739.          B     RTRN                                            @SC86295 05352500
  740. *                                                                       05353000
  741.          TITLE 'Typeout interceptor'                                    05353500
  742. * Entry: R1->message buffer, R0=length, R2-> ICPTYP, R15->ret,          05354000
  743. *        R14-R5 saved in ICPRGS.                                        05354500
  744. * Exit:  Message copied to storage.  Registers restored.                05355000
  745.          USING ICPTYP,2                                        @SC89268 05355500
  746. ICPTYP   CLI   ICPFL,2       Intercepting?                     @SC88026 05356000
  747.          BE    ICPGO         Yes, do it                        @SC88026 05356500
  748.          A     0,F3          Allow for SBA                     @SC90264 05357000
  749.          STH   0,GTMLEN      Length of buffer needed           @SC90264 05357500
  750.          EXEC CICS HANDLE CONDITION NOSTG,                     @SC90264 05358000
  751.          EXEC CICS GETMAIN SET(3) LENGTH(GTMLEN),              @SC90264 05358500
  752.          EXEC CICS IGNORE CONDITION LENGERR,                   @SC90264 05359000
  753.          LH    0,GTMLEN      Get length again                  @SC90264 05359500
  754.          LR    4,0                                             @SC90264 05360000
  755.          S     4,F3          Allow for SBA                     @NL90264 05360500
  756.          BCTR  4,0                                             @SC90264 05361000
  757.          L     1,ICPRGS+12   Retrieve ptr to data              @SC90264 05361500
  758.          MVC   3(,3),0(1)    Copy after SBA/CRLF               @SC90264 05362000
  759.          EX    4,*-6                                           @SC90264 05362500
  760.          TM    FSCTRMF,X'80' TTY?                              @SC90264 05363000
  761.          BZ    ICPTT1        Yes                               @SC90264 05363500
  762.          EX    4,ICPTRDSP    Eliminate dangerous characters    @SC90264 05364000
  763.          TM    FSCOTP,X'FF'  Flag for clearing screen?         @SC90264 05364500
  764.          BO    ICPTF1        Yes, reformat it                  @SC90264 05365000
  765.          S     0,F3          Adjust for SBA                    @SC90264 05365500
  766.          AH    0,FSCOTP      Current screen adr                @SC90264 05366000
  767.          CH    0,FSCEND      Will it all fit?                  @SC90264 05366500
  768.          BNH   ICPTF2        Yes, do it                        @SC90264 05367000
  769.          EXEC CICS CONVERSE FROM(ICPMORCC) FROMLENGTH(=Y(ICPMORL)),    +05367500
  770.                CTLCHAR(=X'C3') SET(4) TOLENGTH(FSCOTP),        @SC90264 05368000
  771. ICPTF1   MVC   FSCOTP,FSCBEG                                   @SC90264 05368500
  772.          EXEC CICS SEND FROM(ICPSETCC) LENGTH(=Y(ICPSETL)),    @SC90264+05369000
  773.                CTLCHAR(=X'C3') ERASE WAIT,                     @SC90264 05369500
  774. ICPTF2   LH    0,FSCOTP      Current screen address            @SC90264 05370000
  775.          SRDL  0,6                                             @SC90264 05370500
  776.          SLL   0,2                                             @SC90264 05371000
  777.          SLDL  0,6           Convert to 12/14-bit format       @SC90264 05371500
  778.          STCM  0,3,1(3)                                        @SC90264 05372000
  779.          TR    1(2,3),PRTBLE                                   @SC90264 05372500
  780.          MVI   0(3),SBA      Move to proper adr                @SC90264 05373000
  781.          LA    1,79          Round up to whole line            @SC90264 05373500
  782.          A     1,ICPRGS+8                                      @SC90264 05374000
  783.          SR    0,0                                             @SC90264 05374500
  784.          D     0,=F'80'                                        @SC90264 05375000
  785.          M     0,=F'80'      Convert to address increment      @SC90264 05375500
  786.          CLC   FSCOTP,FSCBEG                                   @SC90264 05376000
  787.          BE    *+8                                             @SC90264 05376500
  788.           AH   1,FSCOTP      Rel. to old adr if not at top     @SC90264 05377000
  789.          STH   1,FSCOTP                                        @SC90264 05377500
  790.          EXEC CICS SEND FROM(0(,3)) LENGTH(GTMLEN) WAIT,       @SC90264+05378000
  791.                CTLCHAR(=X'C2'),                                @SC90264 05378500
  792.          B     ICPTZ         Rejoin                            @SC90264 05379000
  793. ICPTT1   DS    0H            TTY output                        @SC90264 05379500
  794.          MVC   0(3,3),=AL1(CR,LF,XOFF)                         @SC90264 05380000
  795.          EXEC CICS SEND FROM(0(,3)) LENGTH(GTMLEN) WAIT,       @SC90264 05380500
  796. ICPTZ    DS    0H                                              @SC90264 05381000
  797.          EXEC CICS FREEMAIN DATA(0(,3)),                       @NL90264 05381500
  798.          B     ICPTRET                                         @SC87020 05382000
  799. ICPGO    LM    3,4,TXTPTR+4  Output ptrs                       @SC86158 05382500
  800.          SR    4,3           Length left                       @SC86158 05383000
  801.          TM    FSCTRMF,1     Just a prompt?                    @SC90264 05383500
  802.          BO    ICPTRET       Yes, ignore it                    @SC90264 05384000
  803.          LA    15,255        Limit                             @SC86158 05384500
  804.          CLR   15,0          Buffer length                     @SC87020 05385000
  805.          BNH   *+6           Too big                           @SC86158 05385500
  806.           LR   15,0          Ok, use it                        @SC87020 05386000
  807.          LTR   15,15                                           @SC86158 05386500
  808.          BNP   ICPTRET                                         @SC86283 05387000
  809.          CR    15,4          Enough room?                      @SC86283 05387500
  810.          BH    ICPTRET       No                                @SC86283 05388000
  811.          BCTR  15,0          Set up for mvc                    @SC86158 05388500
  812.          EX    15,ICPCOPY    Move to WBUF                      @SC86158 05389000
  813.          LA    3,2(15,3)     New end                           @SC86158 05389500
  814.          ST    3,TXTPTR+4                                      @SC86158 05390000
  815. ICPTRET  LM    14,5,ICPRGS   Restore                           @SC88026 05390500
  816.          NI    FSCTRMF,X'FE' Reset flag                        @SC90264 05391000
  817.          BR    15            Return                            @SC86283 05391500
  818. ICPCOPY  MVC   0(,3),0(1)                                      @SC87020 05392000
  819. ICPTRDSP TR    3(,3),ICPDSP  Convert to safe displayables      @SC90264 05392500
  820.          DROP  2                                                        05393000
  821. * Table of printable equivalents for binary 6-bit numbers      @SC90264 05393500
  822. PRTBLE   DC    C' ',9AL1(*-PRTBLE+192),7AL1(*-PRTBLE+64)       @SC90264 05394000
  823.          DC    9AL1(*-PRTBLE+192),8AL1(*-PRTBLE+64)            @SC90264 05394500
  824.          DC    8AL1(*-PRTBLE+192),6AL1(*-PRTBLE+64)            @SC90264 05395000
  825.          DC    10AL1(*-PRTBLE+192),6AL1(*-PRTBLE+64)           @SC90264 05395500
  826. * Safely displayables                                          @SC90264 05396000
  827. ICPDSP   DC    64C'.',192AL1(*-ICPDSP)                         @SC90264 05396500
  828. *                                                                       05397000
  829. ICPMORCC DC    AL1(SBA),X'5DE9',C'*MORE*'                      @SC90264 05397500
  830. ICPMORL  EQU   *-ICPMORCC                                      @SC90264 05398000
  831. ICPSETCC DC    AL1(SBA),X'5B60',AL1(IC,RTA),X'5DE800'          @SC90264 05398500
  832. ICPERSL  EQU   *-ICPSETCC    Blank cmd line                    @SC90264 05399000
  833.          DC    AL1(SBA),X'4040',AL1(SF),X'60'                  @SC90264 05399500
  834.          DC    AL1(SBA),X'5B5F',AL1(SF),X'40'                  @SC90264 05400000
  835.          DC    AL1(SBA),X'5DE8',AL1(SF),X'60',C'TTYsym'        @SC90264 05400500
  836. ICPSETL  EQU   *-ICPSETCC                                      @SC90264 05401000
  837. *                                                                       05401500
  838.          LOCALS ,                                              @SC86295 05402000
  839. SFCPGM   DS    CL8           Name of program to execute        @SC90264 05402500
  840. SFCSECPL DS    3A            -> (name, string, ->length)       @SC90264 05403000
  841. SUPFNC   EXIT                                                  @SC86158 05403500
  842.          TITLE 'GETLIN Routine - Get a line from terminal'     @SC87015 05404000
  843. * Entry: R1->buffer of length 256                              @SC87015 05404500
  844. * Exit: Buffer filled, R0=length, R15=0 if ok. Else R15=1.     @SC87015 05405000
  845. GETLIN   ENTER                                                 @SC87015 05405500
  846.          LR    8,1           Save buffer ptr                   @SC88095 05406000
  847.          LA    9,256         For copying                       @SC88095 05406500
  848.          LM    6,7,GTPBPTRS  Buffer adr and len                @SC88095 05407000
  849.          LTR   7,7           Already got something?            @SC90264 05407500
  850.          BP    GTL1          Yes, return it                    @SC87015 05408000
  851. GTLRD    LM    0,1,GTLPRPS   Any prompt?                       @SC90264 05408500
  852.          LTR   0,0                                             @SC90264 05409000
  853.          BP    GTLPRMPT                                        @SC90264 05409500
  854.          PTEXT ' ',AREG=1,LREG=0                               @SC90264 05410000
  855. GTLPRMPT OI    FSCTRMF,1     Responsive                        @SC90264 05410500
  856.          BAL   15,WTEXT                                        @SC90264 05411000
  857.          EXEC CICS RECEIVE SET(6) LENGTH(GTMLEN) ASIS,         @SC90264 05411500
  858.          L     0,GTLBUFP                                       @SC90264 05412000
  859.          LA    1,256         Length of my buffer               @SC90264 05412500
  860.          LH    7,GTMLEN      Length of data                    @SC90264 05413000
  861.          CR    1,7                                             @SC90264 05413500
  862.          BNH   *+6                                             @SC90264 05414000
  863.           LR   1,7                                             @SC90264 05414500
  864.          STM   0,1,GTPBPTRS  Buffer adr and len                @SC90264 05415000
  865.          MVCL  0,6           Copy input stuff to buffer        @SC90264 05415500
  866.          LM    6,7,GTPBPTRS  Get adr and len again             @SC90264 05416000
  867.          L     DFHEIBR,DFHEIBP  Get ptr to data block          @SC90264 05416500
  868.          USING DFHEIBLK,DFHEIBR                                @SC90264 05417000
  869.          TM    FSCTRMF,X'80' TTY?                              @SC90264 05417500
  870.          BZ    GTLRDT        Yes, skip fullscreen stuff        @SC90264 05418000
  871.          CLI   EIBAID,X'6D'  CLEAR?                            @SC90264 05418500
  872.          BNE   GTLRDF2       No, use it                        @SC90264 05419000
  873.          MVI   FSCOTP,X'FF'  Flag for reformatting             @SC90264 05419500
  874.          B     GTLRD                                           @SC90264 05420000
  875.          DROP  DFHEIBR                                         @SC90264 05420500
  876. GTLRDF2  A     6,F3          Space over SBA                    @SC90264 05421000
  877.          S     7,F3                                            @SC90264 05421500
  878.          LR    1,6           Copy command address              @SC90264 05422000
  879.          LTR   0,7           Anything there?                   @SC90264 05422500
  880.          BNM   GTLRDF3       Yes, ok                           @SC90264 05423000
  881.          PTEXT ' ',AREG=1,LREG=0 No, display blanks            @SC90264 05423500
  882. GTLRDF3  OI    FSCTRMF,1     Indicate just copying             @SC90264 05424000
  883.          BAL   15,WTEXT                                        @SC90264 05424500
  884.          L     2,=A(ICPSETCC)   Ptr to command string          @SC90264 05425000
  885.          EXEC CICS SEND FROM(0(,2)) LENGTH(=Y(ICPERSL)) WAIT,  @SC90264+05425500
  886.                CTLCHAR(=X'C3'),                                @SC90264 05426000
  887. GTLRDT   DS    0H                                              @SC90264 05426500
  888. GTL1     LTR   2,7           Length of text remaining          @SC88095 05427000
  889.          BNP   GTLFRE        None, return length 0             @SC88095 05427500
  890.          LA    0,0(7,6)      End of buffer                     @SC88095 05428000
  891.          SR    4,4                                             @SC88095 05428500
  892.          IC    4,LNDLM       Get delimiter                     @SC88095 05429000
  893.          LA    4,TRTBL(4)    Ptr to delimiter char             @SC88095 05429500
  894.          MVI   0(4),1        Set up to snag delims             @SC88095 05430000
  895.          MVI   TRTBL+C' ',0  And ignore blanks                 @SC88095 05430500
  896.          CR    2,9           Get shorter of 256 and string     @SC88095 05431000
  897.          BNH   *+6                                             @SC88095 05431500
  898.           LR   2,9                                             @SC88095 05432000
  899.          LA    1,0(2,6)      End, in case no delim found       @SC88095 05432500
  900.          BCTR  2,0           Set up for EX                     @SC88095 05433000
  901.          EX    2,GTLTRT                                        @SC88095 05433500
  902.          MVI   0(4),0        Now clear out table               @SC88095 05434000
  903.          MVI   TRTBL+C' ',1  And restore                       @SC88095 05434500
  904.          SR    1,6           Length of line                    @SC88095 05435000
  905.          LR    7,1           Set up MVCL                       @SC88095 05435500
  906.          CR    9,7           Get shorter of 256 and string     @SC88095 05436000
  907.          BNH   *+6                                             @SC88095 05436500
  908.           LR   9,7                                             @SC88095 05437000
  909.          LR    2,9           Length actually copied            @SC88095 05437500
  910.          MVCL  8,6                                             @SC88095 05438000
  911.          AR    6,7           In case we couldn't use it all    @SC88095 05438500
  912.          LA    6,1(,6)       Skip over linend char             @SC88095 05439000
  913.          LR    7,0                                             @SC88095 05439500
  914.          SR    7,6           New buffer length                 @SC88095 05440000
  915. GTLFRE   DS    0H                                              @SC90264 05440500
  916.          STM   6,7,GTPBPTRS                                    @SC88095 05441000
  917. GTLZ     RETREG (0,2)        Return (2) as R0                  @SC89218 05441500
  918.          B     RTRN0                                           @SC87015 05442000
  919. GTLTRT   TRT   0(,6),TRTBL   Find a delimiter                  @SC88095 05442500
  920.          LOCALS ,                                              @SC87015 05443000
  921. GETLIN   EXIT  ,                                               @SC87015 05443500
  922.          TITLE 'TERMIO Routine - Handle terminal I/O'                   05444000
  923. * R1 points to a pair of (adr,len) for read or write.  If I/O is        05444500
  924. * successfull, R15 returns transferred byte count (else returns -1).    05445000
  925. *               Command code is in R0:                                  05445500
  926. * 1 => Open line for I/O            4 => Write packet                   05446000
  927. * 2 => Close line                   5 => Read packet                    05446500
  928. * 3 => Reset line status after    ( 6 => Write message ) not used       05447000
  929. *      environment changes                                              05447500
  930. *                                                                       05448000
  931. TERMIO   ENTER                                                          05448500
  932.          SR    15,15         OK                                @SC86295 05449000
  933.          BCT   0,TRMCLS                                        @SC86295 05449500
  934. * Open terminal line for protocol                                       05450000
  935. *                            Ignore attention interrupts       @SC90264 05450500
  936.          MVI   RIOC,X'80'    Nothing saved                     @SC86295 05451000
  937.          MVI   TRMFLG,X'FF'  Initialize w/r flag               @SC87275 05451500
  938.          CLI   TRMTP,C'F'    Non-transparent full-screen?      @SC92030 05451560
  939.          BNE   RTRN0         No, all set                       @SC92030 05451620
  940.          LA    1,TRMFULA1    Set up introducer: adr            @SC92030 05451680
  941.          LA    2,TRMFULL1    Length                            @SC92030 05451740
  942.          STM   1,2,WRCMD                                       @SC92030 05451800
  943.          EXEC CICS SEND FROM(TRMFULA1) WAIT ERASE,             @SC92030+05451860
  944.                CTLCHAR(=X'C2') LENGTH(=Y(TRMFULL1+TRMFULL2)),  @SC92030 05451920
  945.          B     RTRN0                                           @SC86295 05452000
  946. * Close terminal line after protocol transfer                           05452500
  947. TRMCLS   BCT   0,TRMRSET                                       @SC86295 05453000
  948. *                                                              @SC90264 05453500
  949.          CLI   TRMTP,C'F'    Non-transparent full-screen?      @SC92030 05453600
  950.          BNE   RTRN0         No, all set                       @SC92030 05453700
  951.          SR    0,0                                             @SC92030 05453800
  952.          KCALL SCRNIO        One final CLEAR                   @SC92030 05453900
  953.          B     RTRN0                                           @SC86295 05454000
  954. * (Re)set terminal characteristics to suit environment                  05454500
  955. TRMRSET  BCT   0,TRMRW                                         @SC86295 05455000
  956.          B     RTRN0                                           @SC86295 05455500
  957. *                                                                       05456000
  958. *  Perform I/O request                                                  05456500
  959. TRMRW    LR    8,1           Save ptr to plist                 @SC90264 05457000
  960.          LM    2,3,0(8)      Get address and length            @SC90264 05457500
  961.          BCT   0,TRMRD                                         @SC87015 05458000
  962.          CLI   WRRD,0        Write/read?                       @SC87275 05458500
  963.          BNE   *+8           Yes                               @SC87275 05459000
  964.          MVI   TRMFLG,0      Indicate no action on follow-up   @SC87275 05459500
  965.          CLI   TRMTP,C'F'    Full-screen non-transparent?      @SC92030 05459530
  966.          BNE   TRMRWW        No                                @SC92030 05459560
  967.          LA    1,TRMFULA2    Stuff to append to stream         @SC92030 05459590
  968.          XI    FL3,FCLRF     Flip switch for skipping          @SC92030 05459620
  969.          TM    FL3,FCLRF     Skipping now?                     @SC92030 05459650
  970.          BO    TRMWAP        Yes, finish stream                @SC92030 05459680
  971.          LA    1,TRMFULB2    Stuff to append if not clearing   @SC92030 05459710
  972.          MVC   0(TRMFULL1,2),TRMFULB1 Replace introducer       @SC92030 05459740
  973. TRMWAP   LA    4,0(3,2)      End of data                       @SC92030 05459770
  974.          MVC   0(TRMFULL2,4),0(1) Append extra commands        @SC92030 05459800
  975.          AH    3,=Y(TRMFULL2) Add length of extra              @SC92030 05459830
  976.          STH   3,GTMLEN      Set up length                     @SC92030 05459860
  977.          EXEC CICS SEND FROM(0(,2)) LENGTH(GTMLEN) WAIT ERASE, @SC92030+05459890
  978.                CTLCHAR(=X'C2'),                                @SC92030 05459920
  979.          B     TRMWLG                                          @SC92180 05459950
  980. TRMRWW   DS    0H                                              @SC92030 05459980
  981.          STH   3,GTMLEN      Set up length                     @SC90264 05460000
  982.          EXEC CICS SEND FROM(0(,2)) LENGTH(GTMLEN) WAIT,       @SC90264 05460500
  983. TRMWLG   SR    6,6           Set return code to 0              @SC92180 05461000
  984.          LA    0,C'w'                                          @SC92180 05461100
  985.          B     TRMRWLG       Log it                            @SC92180 05461200
  986. *                                                                       05461500
  987. * Read from terminal                                                    05462000
  988. TRMRD    TS    TRMFLG                                          @SC87275 05462500
  989.          BZ    RTRN0         Just a follow-up. 0-length read   @SC87275 05463000
  990.          LM    2,3,0(8)      Our buffer's adr and length       @SC90264 05463500
  991.          STH   3,GTMLEN                                        @SC90264 05464000
  992.          EXEC CICS HANDLE CONDITION LENGERR(RTRNM1),           @SC90264 05464500
  993.          EXEC CICS RECEIVE INTO(0(,2)) LENGTH(GTMLEN) ASIS,    @SC90264 05465000
  994.          LH    6,GTMLEN      Set return code to length         @SC92180 05465400
  995.          LA    0,C'r'                                          @SC92180 05465450
  996. TRMRWLG  LR    1,8           Ptrs for I/O                      @SC92180 05465500
  997.          LR    5,2           Remember data buffer              @SC92180 05465550
  998.          LA    2,8           Lenth of ptrs                     @SC92180 05465600
  999.          BAL   7,SCRLOG      Log it                            @SC92180 05465650
  1000.          LR    1,5           Ptr to buffer                     @SC92180 05465700
  1001.          LH    2,GTMLEN      Lenth of buffer                   @SC92180 05465750
  1002.          LA    0,C'd'                                          @SC92180 05465800
  1003.          BAL   7,SCRLOG      Log it                            @SC92180 05465850
  1004.          LR    15,6          Use return code                   @SC92180 05465900
  1005.          B     RTRN                                            @SC90264 05466000
  1006. *                                                                       05466060
  1007. TRMFULA1 DC    X'1140401D6011C150'                             @SC92030 05466120
  1008. TRMFULL1 EQU   *-TRMFULA1                                      @SC92030 05466180
  1009. TRMFULA2 DC    X'11C36F1D4013'                                 @SC92030 05466240
  1010. TRMFULL2 EQU   *-TRMFULA2                                      @SC92030 05466300
  1011. TRMFULB1 DC    X'1140401D6011C650'                             @SC92030 05466360
  1012. TRMFULB2 DC    X'11C86F1D4013'                                 @SC92030 05466420
  1013.          TITLE 'SCRNIO Routine - Handle screen I/O via Series/1'        05467500
  1014. * R1 points to a pair of (adr,len) for read or write.  If I/O is        05468000
  1015. * successfull, R15 returns transferred byte count (else returns -1).    05468500
  1016. *               Command code is in R0:                                  05469000
  1017. * 0 => Clear screen on console (not comm line)                 @SC90045 05469500
  1018. * 1 => Open screen for I/O            4 => Write packet (gets ATTN)     05470000
  1019. * 2 => Close line                     5 => Read packet                  05470500
  1020. * 3 => Reset screen status after      6 => Write message (no ATTN)      05471000
  1021. *      environment changes            7 => Read screen buffer           05471500
  1022. *                                                                       05472000
  1023. SCRNIO   ENTER ALT                                             @SC92180 05472500
  1024.          LA    8,SCRPLST     Get PLST ptr                      @SC90222 05473000
  1025.          LTR   0,0                                             @SC90045 05473500
  1026.          BZ    SCRCLR                                          @SC90045 05474000
  1027.          LR    6,1           Save ptr to plist                 @SC90222 05474500
  1028.          STC   0,CONSOPR     Save command code                 @LP88158 05475000
  1029.          BCT   0,SCRCLS                                        @SC86295 05475500
  1030. * Set up for transparent I/O                                            05476000
  1031.          L     1,=A(IDEFS)   CSECT of initializations          @SC90173 05476500
  1032.          USING DEFS,1        Mapped via DSECT                  @SC90173 05477000
  1033.          LA    2,S1DATA      Series/1 introducer               @SC90173 05477500
  1034.          LA    3,S1ORDL+2    Length + 2                        @SC90173 05478000
  1035.          CLI   TRMTP,C'S'                                      @SC90173 05478500
  1036.          BE    SCRPRSET      Do it                             @SC90173 05479000
  1037.          LA    2,GRDATA      Graphics introducer               @SC90173 05479500
  1038.          LA    3,GRDL+2      Length + 2                        @SC90173 05480000
  1039.          CLI   TRMTP,C'G'                                      @SC90173 05480500
  1040.          BE    SCRPRSET      Do it                             @SC90173 05481000
  1041.          LA    2,AEADAT      AEA introducer                    @SC90173 05481500
  1042.          LA    3,AEAL+2                                        @SC90173 05482000
  1043.          DROP  1                                               @SC90173 05482500
  1044. SCRPRSET LR    5,3                                             @SC90173 05483000
  1045.          LA    4,S1EOL+2     Get start of command buffer       @SC90173 05483500
  1046.          SR    4,5                                             @SC90173 05484000
  1047.          STM   4,5,S1XOPL    Set up prompt plist               @SC90173 05484500
  1048.          S     5,F2          Deduct stuff already there        @SC90173 05485000
  1049.          MVCL  4,2                                             @SC90173 05485500
  1050. *        MVI   SCRLST,0      Clear op code                     @SC88091 05486000
  1051.          MVI   RIOC,X'80'    Nothing saved                     @SC86295 05486500
  1052. *                            Full-screen mode                  @SC90264 05487000
  1053.          B     SCRCLRX                                         @SC90045 05487500
  1054. SCRCLR   CLI   TRMTP,C'T'    Is it a TTY terminal?             @SC90045 05488000
  1055.          BE    RTRN0         Yes, can't clear screen           @SC90045 05488500
  1056.          CLI   TRMTP,C'V'    Is it a TTY terminal?             @SC90045 05489000
  1057.          BE    RTRN0         Yes, can't clear screen           @SC90045 05489500
  1058.          CLI   TRMTP,C'F'    Is it some full-screen?           @SC92030 05489600
  1059.          BE    *+12          Yes, must clear frequently        @SC92030 05489700
  1060.          TM    FL2,PROTO     In protocol mode?                 @SC90045 05490000
  1061.          BO    RTRN0         Yes, skip clearing screen         @SC90045 05490500
  1062. SCRCLRX  LA    8,SCRCCWCL    Clear-screen plist                @SC90045 05491000
  1063.          BAL   9,SCRNEX      Do it                             @SC90045 05491500
  1064.          MVI   FSCOTP,X'FF'  Flag for clearing                 @SC90264 05492000
  1065.          B     RTRN0                                           @SC86295 05492500
  1066. SCRCCWCL DC    C'E',AL3(0),XL4'0'  Erasure                     @SC90264 05493000
  1067. *                                                                       05493500
  1068. * Clean up after I/O                                                    05494000
  1069. SCRCLS   BCT   0,SCRRSET                                       @SC86295 05494500
  1070.          B     SCRCLRX       Clear screen                      @SC90045 05495000
  1071. *                                                                       05495500
  1072. * (Re)set device characteristics to suit environment                    05496000
  1073. SCRRSET  BCT   0,SCRRW                                         @SC86295 05496500
  1074.          B     RTRN0                                                    05497000
  1075. *                                                                       05497500
  1076. *  Perform I/O request                                                  05498000
  1077. * R6-> (adr,len); R0=1 if write, 2 if read, 3 if message.      @SC90264 05498500
  1078. SCRRW    DS    0H                                              @SC90222 05499000
  1079.          MVC   0(8,8),0(6)   Copy plist                        @SC90264 05499500
  1080.          STC   0,0(,8)       Set operation code (arbitrary)    @SC90264 05500000
  1081.          CLI   TRMTP,C'A'    AEA?                              @SC90264 05500500
  1082.          BNE   *+8           No, use those codes               @SC90264 05501000
  1083.           OI   0(8),X'80'    Mark this different               @SC90264 05501500
  1084.          BAL   9,SCRNEX      Execute internal subr             @SC86295 05502000
  1085.          TM    CONSOPR,1     Read request?                     @SC90264 05502500
  1086.          BO    SCRRDZ        Yes, get length                   @SC90264 05503000
  1087.          ICM   1,15,SCRRC    Check return code                 @SC90222 05503500
  1088.          BNZ   RTRNM1        If error, say so                  @SC90222 05504000
  1089.          B     RTRN0         Return                            @SC86299 05504500
  1090. SCRRDZ   LR    15,5                                            @LP88186 05505000
  1091.          S     15,WRCMDL+4   Deduct 3 for buffer adr           @SC90173 05505500
  1092.          B     RTRN          Return                            @SC86299 05506000
  1093. *                                                                       05506500
  1094. * SCRLOG: Hexadecimal log of (R2) bytes at address (R1)        @LP88158 05507000
  1095. * Log label is taken from R0 low order byte.                   @SC89166 05507500
  1096. * Return via R7.  R0-R3 and R15 destroyed.                     @SC89166 05508000
  1097. SCRLOG   TM    FL1,DEBUG     Logging in effect?                @SC87286 05508500
  1098.          BZR   7             No, that's all                    @SC89166 05509000
  1099.          TM    DBGFLG,DBGIO  I/O stuff requested?              @SC88168 05509500
  1100.          BZR   7             No, skip it                       @SC89166 05510000
  1101.          L     3,LOGBUF      Ptr to buffer                     @LP88158 05510500
  1102.          STC   0,0(,3)       Set log label                     @SC89166 05511000
  1103.          LA    3,2(,3)       Start of data area                @SC91172 05511500
  1104.          TM    DBGFLG,DBGTI  Times requested?                  @SC91172 05512000
  1105.          BZ    SCRLOGA       No, just do hex dump              @SC91172 05512500
  1106.          ST    1,SCRLR1      Save ptr to block                 @SC91172 05513000
  1107.          BAL   14,ACCTTOD    Get time of day in seconds        @SC91172 05513500
  1108.          MVI   0(3),C' '     Leave a space                     @SC91172 05514000
  1109.          KCALL DUMPTOD,1(3)  Format time into buffer           @SC91172 05514500
  1110.          LR    3,15          Get ptr to end of string          @SC91172 05515000
  1111.          L     1,SCRLR1      Restore R1                        @SC91172 05515500
  1112. SCRLOGA  LA    0,6*9(,3)     End of line buffer                @SC91172 05516000
  1113.          TM    DBGFLG,DBGLO  Long buffer requested?            @SC90222 05516500
  1114.          BZ    *+8                                             @SC90222 05517000
  1115.           LA   0,50*9(,3)    Yes, long buffer                  @SC91172 05517500
  1116. SCRLOGLP MVI   0(3),C' '     Add for readability               @LP88158 05518000
  1117.          UNPK  1(9,3),0(5,1) Unpack into buffer                @SC88168 05518500
  1118.          TR    1(8,3),TRHEX  Convert to printable hex          @SC88168 05519000
  1119.          LA    3,9(3)        Advance text ptr                  @SC88168 05519500
  1120.          LA    1,4(1)        and data source                   @LP88158 05520000
  1121.          S     2,F4          Finished data?                    @SC88168 05520500
  1122.          BNP   SCRLGEND      Yes, go write                     @LP88158 05521000
  1123.          CR    3,0           Reached text limit?               @LP88158 05521500
  1124.          BL    SCRLOGLP      no, loop for more slices          @LP88158 05522000
  1125.          MVC   0(3,3),=C'...' Show incomplete                  @LP88158 05522500
  1126.          LA    3,3(3)                                          @SC88168 05523000
  1127. SCRLGEND DS    0H                                              @LP88158 05523500
  1128.          AR    2,2           Check for incomplete slice        @SC88168 05524000
  1129.          BNM   *+6           No, ok                            @SC88168 05524500
  1130.          AR    3,2           Yes, adjust end of text           @SC88168 05525000
  1131.          S     3,LOGBUF      Get length of text                @SC88168 05525500
  1132.          WRITF LOGPTR,BSIZE=(3) Log it                         @LP88158 05526000
  1133.          TM    DBGFLG,DBGSV  SAVE requested?                   @SC88168 05526500
  1134.          BZR   7             No, skip closing log file         @SC89166 05527000
  1135.          SAVEF LOGPTR        Update disk directory             @SC88168 05527500
  1136.          BR    7                                               @SC89166 05528000
  1137. *                                                                       05528500
  1138. *----- perform screen I/O operation, add to debug log ---------@SC90264 05529000
  1139. * Entry: R8-> X'code',AL3(adr),F'length', R9-> return          @SC90264 05529500
  1140. * Exit: uses 0,1,2,3,5,7,14; data length in R15 or -1 if error @SC90264 05530000
  1141. SCRNEX   LR    1,8           Get plist ptr                     @SC90222 05530500
  1142.          SLR   2,2           Convert op. code to log label     @LP88158 05531000
  1143.          IC    2,CONSOPR                                       @LP88158 05531500
  1144.          LA    2,CONSOPRS(2)                                   @LP88158 05532000
  1145.          IC    0,0(,2)                                         @SC89166 05532500
  1146.          LA    2,8           Size of plist                     @SC90264 05533000
  1147.          BAL   7,SCRLOG      Log it                            @SC90222 05533500
  1148.          LM    2,3,0(8)      Data ptr and len                  @SC90264 05534000
  1149.          TM    0(8),1        Write of some sort?               @SC90264 05534500
  1150.          BZ    SCRNEXR       No, read                          @SC90264 05535000
  1151. *          Write...                                            @SC90264 05535500
  1152.          STH   3,GTMLEN      Length of buffer needed           @SC90264 05536000
  1153.          LR    5,3           Save for logging                  @SC90264 05536500
  1154.          CLI   0(8),C'E'     Clear screen?                     @SC90264 05537000
  1155.          BNE   SCRNEXW0      No                                @SC90264 05537500
  1156.          EXEC CICS SEND CONTROL ERASE FREEKB,  Yes, do it      @NL90264 05538000
  1157.          B     SCRNEXW2                                        @SC90264 05538500
  1158. SCRNEXW0 DS    0H                                              @SC90264 05539000
  1159.          CLI   0(8),X'81'    WRITE STRUCTURED FIELD?           @SC90264 05539500
  1160.          BNE   SCRNEXW1      No, just WRITE                    @SC90264 05540000
  1161.          CLI   WRRD,5                                          @SC92016 05540300
  1162.          BE    SCRNEXZ       Expecting a reply - save ptrs     @SC92016 05540400
  1163.          EXEC CICS SEND STRFIELD WAIT DEFRESP,                 @SC92016+05540500
  1164.                FROM(0(,2)) LENGTH(GTMLEN),                     @SC92016 05540600
  1165.          B     SCRNEXW2                                        @SC90264 05541000
  1166. SCRNEXW1 DS    0H                                              @SC90264 05541500
  1167.          MVI   SCRCTLCH,X'C2'  Unlock kbd normally             @SC91039 05542000
  1168.          CLI   CONSOPR,6       Write message?                  @SC91039 05542500
  1169.          B     *+8    (BNE)  $$$$$$$$ for now $$$$$$$$         @SC91039 05543000
  1170.           MVI  SCRCTLCH,X'C1'  Yes, lock it to prevent clash   @SC91039 05543500
  1171.          EXEC CICS SEND WAIT FROM(0(,2)) LENGTH(GTMLEN),       @SC91039+05544000
  1172.                CTLCHAR(SCRCTLCH),                              @SC91039 05544500
  1173. SCRNEXW2 DS    0H                                              @SC90264 05545000
  1174.          B     SCRNEXZ                                         @SC90264 05545500
  1175. *          Read...                                             @SC90264 05546000
  1176. SCRNEXR  LA    5,3           Normal length: AID + cursor adr   @SC91150 05546500
  1177.          CLI   SCRLSTIO,X'81'  WRT STR FLD?                    @SC91150 05547000
  1178.          BNE   *+8           No, fine                          @SC91150 05547500
  1179.           LA   5,1           Yes, expect only the AID          @SC91150 05548000
  1180.          SR    3,5                                             @SC91150 05548500
  1181.          STH   3,GTMLEN      Length of buffer needed           @SC90264 05549000
  1182.          LA    7,0(5,2)      Ptr to data portion               @SC91150 05549500
  1183.          EXEC CICS HANDLE CONDITION LENGERR(RTRNM1),           @SC90264 05550000
  1184.          CLI   SCRLSTIO,X'81'  WRT STR FLD?                    @SC92016 05550050
  1185.          BNE   SCRNEXR0      No, fine                          @SC92016 05550100
  1186.          L     4,SCRLSTIO                                      @SC92016 05550150
  1187.          EXEC CICS CONVERSE STRFIELD DEFRESP,                  @SC92016+05550200
  1188.                FROM(0(,4)) FROMLENGTH(SCRLSTIO+6),             @SC92016+05550250
  1189.                INTO(0(,7)) TOLENGTH(GTMLEN),                   @SC92016 05550300
  1190.          B     SCRNEXR2                                        @SC92016 05550350
  1191. SCRNEXR0 DS    0H                                              @SC92016 05550400
  1192.          CLI   CONSOPR,7                                       @SC90264 05550500
  1193.          BE    SCRNEXR1                                        @SC90264 05551000
  1194.          EXEC CICS RECEIVE INTO(0(,7)) LENGTH(GTMLEN) ASIS,    @SC91150 05551500
  1195.          B     SCRNEXR2                                        @SC90264 05552000
  1196. SCRNEXR1 EXEC CICS RECEIVE INTO(0(,7)) LENGTH(GTMLEN) ASIS,    @SC91150+05552500
  1197.                BUFFER,                                         @SC90264 05553000
  1198. SCRNEXR2 DS    0H                                              @SC90264 05553500
  1199.          L     DFHEIBR,DFHEIBP                                 @SC90264 05554000
  1200.          USING DFHEIBLK,DFHEIBR                                @SC90264 05554500
  1201.          MVC   0(1,2),EIBAID Reconstruct data stream           @SC90264 05555000
  1202.          C     5,F1                                            @SC91150 05555500
  1203.          BNH   *+10                                            @SC91150 05556000
  1204.          MVC   1(2,2),EIBCPOSN  in our buffer                  @SC90264 05556500
  1205.          DROP  DFHEIBR                                         @SC90264 05557000
  1206.          AH    5,GTMLEN      Data length reconstructed         @SC91150 05557500
  1207. SCRNEXZ  SR    15,15         For now...                        @SC90264 05558000
  1208. SCRNEXZZ ST    15,SCRRC                                        @SC90222 05558500
  1209.          MVC   SCRLSTIO,0(8) Save code of last I/O             @SC91150 05559000
  1210.          LTR   15,15                                           @SC90222 05559500
  1211.          BZ    SCRNEXD       Ok, log data                      @SC90222 05560000
  1212.          LA    1,SCRRC                                         @SC90222 05560500
  1213.          LA    2,4                                             @SC90222 05561000
  1214.          LA    0,C'e'        "Error" label                     @SC90222 05561500
  1215.          BAL   7,SCRLOG      Log the return code               @SC90222 05562000
  1216. SCRNEXD  L     1,0(,8)       Data address                      @SC90222 05562500
  1217.          LA    0,C'd'        "Data" label                      @SC89166 05563000
  1218.          LR    2,5           Data size                         @SC90222 05563500
  1219.          BAL   7,SCRLOG      Log data                          @SC90222 05564000
  1220.          LR    15,5                                            @LP88186 05564500
  1221.          BR    9             Return to caller                  @LP88186 05565000
  1222. *                                                                       05565500
  1223. CONSOPRS DC    C'?ocswrmg'   Console command labels for log    @SC91150 05566000
  1224.          LOCALS ,                                              @SC86299 05566500
  1225. SCRPLST  DS    2F            Control block                     @SC90264 05567000
  1226. SCRRC    DS    F             Return code from PUT/GET          @SC90222 05567500
  1227. SCRLR1   DS    F             Saved R1 in SCRLOG                @SC91172 05568000
  1228. CONSOPR  DS    XL1           Current I/O operation             @SC89180 05568500
  1229. SCRCTLCH DS    X             WCC for next output op            @SC91039 05569000
  1230. SCRNIO   EXIT  ,                                               @SC86299 05569500
  1231.          TITLE 'SETMSG Routine - controls CP breakin'                   05570000
  1232. * Entry: R1 selects operation                                           05570500
  1233. * Exit: R15=0 if ok                                                     05571000
  1234. * 1-> Analyze user environment, determine if suitable.                  05571500
  1235. *     Save quantities needed and condition line for entering commands.  05572000
  1236. *     Perform any system-dependent initialization.                      05572500
  1237. * 2-> Condition line for protocol transfers.                            05573000
  1238. * 3-> Decondition line at end of transfer.                              05573500
  1239. * 4-> System-dependent clean-up at exit.                                05574000
  1240. * 5-> Reperform system-dependent initialization after SET LINE.         05574500
  1241. *                                                                       05575000
  1242. IC       EQU   X'13'         Insert Cursor                     @SC90264 05575500
  1243. SF       EQU   X'1D'         Start Field                       @SC90264 05576000
  1244. SETMSG   ENTER ,                                               @SC87015 05576500
  1245.          BCT   1,STM2                Go if R1 not 1, so no init         05577000
  1246.          OI    FL1,REN       Set "WARN" ON                     @SC90264 05577500
  1247.          MVI   CLSNFL,C'R'   (both ways)                       @SC90264 05578000
  1248.          MVI   DESTL+1,1     Set to default                    @SC90264 05578500
  1249.          MVI   DEST,C'*'                                       @SC90264 05579000
  1250.          EXEC CICS ADDRESS CSA(1),                             @SC90264 05579500
  1251.          ST    1,CSAPTR      Save ptr to CSA                   @SC90264 05580000
  1252.          L     15,CSATSATA-DFHCSABA(,1)                        @SC91150 05580500
  1253.          USING DFHTSMAP,15                                     @SC91150 05581000
  1254.          MVC   KTSBPSEG,TSMBPSEG Log(seg size)                 @SC91150 05581500
  1255.          MVC   KTSGIDNE,TSMGIDNE Number of entries per TSGID   @SC91150 05582000
  1256.          DROP  15                                              @SC91150 05582500
  1257.          EXEC CICS ASSIGN,                                     @SC90264.05583000
  1258.                OPID(COPID),                                    @LM90264.05583500
  1259.                SYSID(CSYSID),                                  @LM90264.05584000
  1260.                SCRNHT(CSCRNHT),                                @LM90264.05584500
  1261.                SCRNWD(CSCRNWD),                                @LM90264.05585000
  1262.                TERMCODE(TCTTETT),                              @SC90264 05585500
  1263.          CLI   TCTTETT,X'40' TTY?                              @SC90264 05586000
  1264.          BL    *+8           Yes                               @SC90264 05586500
  1265.           OI   FSCTRMF,X'80' No, mark it fullscreen            @SC90264 05587000
  1266.          L     DFHEIBR,DFHEIBP                                 @SC90264 05587500
  1267.          USING DFHEIBLK,DFHEIBR                                @SC90264 05588000
  1268.          ICM   2,15,DFHEICAP Any comm area?                    @SC90264 05589500
  1269.          BZ    STM1REC       No, issue a read                  @SC90264 05590000
  1270.          LH    1,EIBCALEN    Length of comm area?              @SC90264 05590500
  1271.          LTR   1,1                                             @SC90264 05591000
  1272.          BZ    STM1REC       Zero, issue a read                @SC90264 05591500
  1273.          CH    1,=H'256'     Max allowed in buffer             @SC91150 05592000
  1274.          BNH   *+8                                             @SC91150 05592500
  1275.           LH   1,=H'256'     Use max for length                @SC91150 05593000
  1276.          STH   1,LINLEN      Ok, use the commarea as command   @SC90264 05593500
  1277.          LR    3,1           Set up MVCL                       @SC91150 05594000
  1278.          L     0,GTLBUFP                                       @SC91150 05594500
  1279.          MVCL  0,2           Copy string to input cmd buffer   @SC91150 05595000
  1280.          B     STM1RECZ      Done setup of command             @SC90264 05595500
  1281.          DROP  DFHEIBR                                         @SC90264 05596000
  1282. STM1REC  DS    0H                                              @SC90264 05596500
  1283.          MVC   LINLEN,=H'256'                                  @SC90264 05597000
  1284.          L     2,GTLBUFP     Get invocation buffer             @SC90264 05597500
  1285.          EXEC CICS IGNORE CONDITION LENGERR,                   @SC90264 05598000
  1286.          EXEC CICS RECEIVE INTO(0(,2)) LENGTH(LINLEN) ASIS,    @SC90264 05598500
  1287. STM1RECZ DS    0H                                              @SC90264 05599000
  1288.          MVI   FSCOTP,X'FF'  Flag for reformatting fullscreen  @SC90264 05599500
  1289.          L     2,QFNBP       Ptr to ring of QFN buffers        @SC90264 05600000
  1290.          ST    2,QFNPTR      1st buffer to use                 @SC90264 05600500
  1291.          LA    3,3-1         Number - 1 of buffers             @SC90264 05601000
  1292.          LA    4,QFNSIZ+4(,2) Chain together                   @SC90264 05601500
  1293.          STCM  4,15,QFNSIZ(2)                                  @SC90264 05602000
  1294.          LR    2,4                                             @SC90264 05602500
  1295.          BCT   3,*-10        Loop over buffers                 @SC90264 05603000
  1296.          MVC   QFNSIZ(4,2),QFNPTR Complete the ring            @SC90264 05603500
  1297.          SETUSER ,                                             @SC90264 05604000
  1298.          KCALL KFLCWD,DESTL                                    @SC90264 05604500
  1299.          B     STM5X                                           @SC90173 05605000
  1300. *                                                                       05605500
  1301. STM2     BCT   1,STM3                Go if R1 was not 2, so not off     05606000
  1302. *                                                              @SC90264 05606500
  1303.          TM    FL1,TSTF                                        @SC86295 05607000
  1304.          BO    RTRN0         Just testing, don't change it     @SC86295 05607500
  1305. *                                                              @SC90264 05608000
  1306.          B     STMD                                                     05608500
  1307. *                                                                       05609000
  1308. STM3     BCT   1,STM4                                          @SC86316 05609500
  1309. *                                                              @SC90264 05610000
  1310. STMD     DS    0H                                              @SC86316 05610500
  1311.          B     RTRN0                                                    05611000
  1312. *                                                                       05611500
  1313. STM4     BCT   1,STM5        Special clean-up                  @SC87351 05612000
  1314.          SR    0,0                                             @SC90264 05612500
  1315.          KCALL SCRNIO        Clear screen if fullscreen        @SC90264 05613000
  1316.          TM    DSKFL,PLOAD   Pgm loaded?                       @SC90264 05613500
  1317.          BZ    STM4A                                           @SC90264 05614000
  1318.          EXEC CICS RELEASE PROGRAM('IKXDYNAL') NOHANDLE,       @SC90264 05614500
  1319. STM4A    DS    0H                                              @SC90264 05615000
  1320.          KCALL KFLCWD,F0     Free all megablocks               @SC90264 05615500
  1321.          B     RTRN0         Special clean-up done             @SC87296 05616000
  1322. *                                                                       05616500
  1323. STM5     DS    0H            Re-init after SET LINE            @SC87351 05617000
  1324.          MVI   TRMTP,C'N'    Assume bad until validated        @SC90173 05617500
  1325.          CLI   TRMLIN,C' '   External line?                    @SC87351 05618000
  1326.          BE    STM5X         No, use terminal                  @SC90173 05618500
  1327.          B     RTRN1         Other lines not allowed           @SC90173 05619000
  1328. STM5X    DS    0H            Now set up controller type        @SC90173 05619500
  1329.          MVI   TRMTP,C'&KCONT'  1st assume TTY                 @SC88309 05620000
  1330.          TM    FSCTRMF,X'80' TTY?                              @SC90264 05620500
  1331.          BZ    STMSTY        Yes                               @SC86299 05621000
  1332.          SR    1,1           Assume Query not allowed          @SC91311 05622000
  1333. STMGRS   DS    0H                                              @SC91311 05623000
  1334.          O     1,=A(&CONOPTS)                        Options   @SC91311 05624000
  1335.          KCALL SETCON        Find out just what kind...        @SC91311 05625000
  1336.          B     RTRN0                                           @SC90173 05649000
  1337. STMSTY   DS    0H            Set up TTY mode                   @SC90264 05649500
  1338.          B     RTRN0                                           @SC86295 05650000
  1339. *                                                                       05650500
  1340.          LOCALS ,                                              @SC86295 05654500
  1341. TCTTETT  DS    2X            Terminal type and model codes     @SC90264 05655000
  1342. SETMSG   EXIT                                                           05655500
  1343.          TITLE 'DISKIO Routine - performs disk I/O functions'           05656000
  1344. * ERRNUM unchanged unless there is a disk error.                        05656500
  1345. * Function selected on entry by R0:                                     05657000
  1346. * 0=> unnum read: R1->FAB.  Return R1->buffer,R0=# and remove the       05657500
  1347. *   sequence number (if any) from the buffer (used for TAKE files)      05658000
  1348. * 1=> open (in): R1->pattern FDB, R2->name.  Returns R0->FAB, R1->FDB   05658500
  1349. * 2=> open (out): (same)                                                05659000
  1350. * 3=> test name: R2->name.  Returns R1->FDB if file found and  @SC91269 05659500
  1351. *     writable (else R15=1)                                    @SC91269 05659600
  1352. * 4=> close file: R1->adr(FAB).                                         05660000
  1353. * 5=> set up search: R1->pattern name.                                  05660500
  1354. * 6=> return next file in list:  Returns R1->FDB + sets up FILNAM       05661000
  1355. * 7=> close search (if any).                                            05661500
  1356. * 8=> test CWD string: R1->string.  Returns R15=0 if ok, else =1.       05662000
  1357. * 9=> read: R1->FAB.  Returns R15=12 if EOF, 0 if ok; R0=# data         05662500
  1358. * 10=> write: R1->FAB.  Returns R15=13 if disk full, 0 if ok.           05663000
  1359. * 11=> test space: R1->pattern FDB (has size in Kbytes),                05663500
  1360. *  R2->name (used if FAB not found), R6->adr(FAB). Return R15=0 if ok.  05664000
  1361. * 12=> analyze R/W error, set ERRNUM, make EMSG: R1->FAB, TMPDW=code    05664500
  1362. *      always returns R15=1                                             05665000
  1363. * 13=> directory info on file: R1->name.  Returns R15=0 if ok.          05665500
  1364. * 14=> delete file: R1->name.  Returns R15=0 if ok.                     05666000
  1365. * 15=> rename file: R1->name, R2->new name.  Returns R15=0 if ok.       05666500
  1366. * 16=> copy file: R1->name, R2->new name.  Returns R15=0 if ok.         05667000
  1367. * 17-> type file: R1-> name. Returns R15=0 if ok.                       05667500
  1368. * 21=> save file status in directory: R1->FAB. (not used)      @SC88168 05668000
  1369. * 22=> open library (in): R2->DDNAME.  Return R15=0 if ok.     @SC89073 05668500
  1370. * 23=> point for next read, R1->adr(FDB), R2=records to skip.  @SC89218 05669000
  1371. *      Return R15=0 if ok.                                     @SC89218 05669500
  1372. * 24=> test name: R2->name.  Returns R1->FDB if file found and @SC91269 05669550
  1373. *      readable (else R15=1)                                   @SC91269 05669600
  1374. DISKIO   ENTER                                                          05670000
  1375.          USING DFHDCTDS,DCTCBAR  Reinstate R8 addressing       @SC90264 05670500
  1376.          USING FABD,3                                          @SC86295 05671000
  1377.          STC   0,DSKCOD      Save for reference                @SC88101 05671500
  1378.          SR    4,4           Signal no block assigned          @SC86295 05672000
  1379.          LA    5,DISKIO+4095                                   @SC90264 05672500
  1380.          USING DISKIO+4095,5 Secondary base register           @SC90264 05673000
  1381.          LR    15,0                                            @SC90264 05673500
  1382.          AR    15,15                                           @SC90264 05674000
  1383.          LH    15,DSK0(15)   Get handler address               @SC90264 05674500
  1384.          B     DSK0(15)      Do the function                   @SC90264 05675000
  1385. DSK0     DC    Y(DSKRED-DSK0,DSKOPNI-DSK0,DSKOPNO-DSK0)   0-2  @SC89073 05675500
  1386.          DC    Y(DSKTEST-DSK0,DSKCLOS-DSK0,DSKNSET-DSK0)  3-5  @SC89073 05676000
  1387.          DC    Y(DSKNXT-DSK0,DSKNSX-DSK0,DSKCWDF-DSK0)    6-8  @SC89073 05676500
  1388.          DC    Y(DSKRED-DSK0,DSKWRT-DSK0,DSKTSP-DSK0)     9-11 @SC89073 05677000
  1389.          DC    Y(DSKXXX-DSK0,DSKDIR-DSK0,DSKDEL-DSK0)    12-14 @SC89073 05677500
  1390.          DC    Y(DSKRNM-DSK0,DSKCPY-DSK0,DSKTYP-DSK0)    15-17 @SC89073 05678000
  1391.          DC    3Y(DSKER1-DSK0)   Spare utilities         18-20 @SC89073 05678500
  1392.          DC    2Y(DSKER1-DSK0),Y(DSKPNT-DSK0)            21-23 @SC89218 05679000
  1393.          DC    Y(DSKVERF-DSK0)                           24-   @SC91269 05679050
  1394.          DC    8Y(DSKER1-DSK0)                           spare @SC89073 05679500
  1395. *                                                                       05680000
  1396. * Open for input file whose name is at (R2), FDB at (R1)                05680500
  1397. DSKOPNI  BAL   9,DSKALC      Get FAB                           @SC86295 05681000
  1398.          MVC   FABCOMM,=CL8'OPEN I'                            @SC90264 05681500
  1399. DSKOP0   BAL   2,DSKVALID    See if allowed                    @SC90264 05682000
  1400.          BAL   2,DSKLKP      Find file                         @SC90264 05682500
  1401.          BNZ   DSKER1        Not found                         @SC86295 05683000
  1402.          BAL   14,DSKVALS                                      @SC86295 05683500
  1403.          CLI   DSKCOD,1      Just testing?                     @SC90264 05684000
  1404.          BNE   RTRN0         Yes, we're done                   @SC90264 05684500
  1405.          LA    0,4           Wait up to 3 sec                  @SC92126 05684600
  1406.          BAL   9,DSKENQ                                        @SC92126 05684700
  1407.           B    DSKER1        Can't get it now, give up         @SC92126 05684800
  1408.          CLI   FDBFL2,X'40'  Extra-partition queue?            @SC90264 05685000
  1409.          BNE   RTRN0         No, don't need to close it first  @SC90264 05685500
  1410. DSKTDCLO BAL   9,DSKTDOPE    Close and open                    @SC90264 05686000
  1411.           B    DSKER1A       Oops                              @SC92126 05686500
  1412.          B     RTRN0                                           @SC90264 05687000
  1413. *                                                                       05687500
  1414. DSKTDOPE MVC   DSKEMTS,=CL15'SET Q(    ) CLO'                  @SC90264 05688000
  1415.          MVC   DSKEMTS+6(4),FABFNAM                            @ML90264 05688500
  1416.          EXEC CICS LINK PROGRAM('DFHEMTP') COMMAREA(DSKEMTS),  @SC90264+05689000
  1417.                LENGTH(15) NOHANDLE,                            @SC90264 05689500
  1418.          BAL   14,DSKCHKER   Test success                      @SC90264 05690000
  1419.          BNZR  9             Oops                              @SC90264 05690500
  1420.          MVC   DSKEMTS+12(3),=CL3'OPE'                         @ML90264 05691000
  1421.          EXEC CICS LINK PROGRAM('DFHEMTP') COMMAREA(DSKEMTS),  @SC90264+05691500
  1422.                LENGTH(15) NOHANDLE,                            @SC90264 05692000
  1423.          BAL   14,DSKCHKER   Test success                      @SC90264 05692500
  1424.          BNZR  9             Oops                              @SC90264 05693000
  1425.          B     4(,9)         Return and skip                   @SC90264 05693500
  1426. *                                                                       05694000
  1427. * Open for output file whose name is at (R2), FDB at (R1)               05694500
  1428. DSKOPNO  BAL   9,DSKALC      Get FAB                           @SC86295 05695000
  1429.          MVC   FABCOMM,=CL8'OPEN O'                            @SC90264 05695500
  1430.          BAL   2,DSKVALID    See if allowed                    @SC90264 05696000
  1431.          OI    FABIOF,1      Signal output access              @SC90264 05696500
  1432.          BAL   2,DSKLKP      Find file info                    @SC86295 05697000
  1433.          BNZ   DSKOPLR       Not found, just writing new       @SC87012 05697500
  1434.          TM    FDBFLGS,APPN+SVATT  Should we keep attributes?  @SC90033 05698000
  1435.          BZ    *+8           No                                @SC90033 05698500
  1436.           BAL  14,DSKVALS    Yes, copy old ones to FDB         @SC90033 05699000
  1437.          TM    FDBFLGS,APPN                                    @SC86295 05699500
  1438.          BO    DSKOPLR                                         @SC90033 05700000
  1439.          MVC   DSKSTT+FABUWORD-FABD(4),FABUWORD  Provide word  @SC91150 05700500
  1440.          ERASF FABFID        Delete old                        @SC90264 05701000
  1441.          MVC   FABUWORD,DSKSTT+FABUWORD-FABD     Restore word  @SC91150 05701500
  1442. DSKOPLR  LH    0,FDBLRC                                        @SC88120 05702000
  1443.          CLI   FDBRCF,C'V'   RECFM F limited to LRECL          @SC88120 05702500
  1444.          BNE   DSKSTLR                                         @SC88120 05703000
  1445.          CLI   TYPFIL,C'B'   Binary?                           @SC88120 05703500
  1446.          BE    DSKSTLR4      Yes, always fold                  @SC91150 05704000
  1447.          TM    FABFLGS,FABFPGM+FABFSPL Pipe, spool or QFN?     @SC91150 05704500
  1448.          BNZ   DSKSTLR4      Yes, be strict                    @SC91150 05705000
  1449.          TM    FABFLGS,FABFTD TD queue?                        @SC91150 05705500
  1450.          BZ    *+12          No, ok to use max                 @SC91150 05706000
  1451.           TM   FDBFL2,TDEXTRBM  Extra?                         @SC91150 05706500
  1452.           BO   DSKSTLR4      Yes, must observe LRECL           @SC91150 05707000
  1453.          L     0,MAXLRC      TEXT file, no limit               @SC87012 05707500
  1454. DSKSTLR4 S     0,F4          Allow for RDW                     @SC91150 05708000
  1455. DSKSTLR  ST    0,FABLRTR     Set effective record length       @SC88120 05708500
  1456.          LA    0,4           Wait up to 3 sec                  @SC92126 05708600
  1457.          BAL   9,DSKENQ                                        @SC92126 05708700
  1458.           B    DSKER1        Can't get it now, give up         @SC92126 05708800
  1459.          TM    FABFLGS,FABFTAK                                 @SC90264 05709000
  1460.          BZ    RTRN0                                           @SC90264 05709500
  1461.          KCALL KFILIO,(3),E=DSKER1A                            @SC92126 05710000
  1462.          B     RTRN0                                           @SC86295 05710500
  1463. *                                                                       05711000
  1464. * Test for existence of file whose name is at (R2)                      05711500
  1465. DSKTEST  XC    DSKFDB,DSKFDB                                   @SC90264 05712000
  1466.          MVC   FABCOMM-FABD+DSKSTT(8),=CL8'TEST'  Check output @SC91269 05712100
  1467. DSKTEST1 DS    0H                                              @SC91269 05712200
  1468.          MVC   DSKSTNM,0(2)                                    @SC90264 05712500
  1469.          LA    3,DSKSTT                                        @SC86295 05713000
  1470.          B     DSKOP0                                          @SC86295 05714000
  1471. DSKVERF  XC    DSKFDB,DSKFDB                                   @SC91269 05714100
  1472.          MVC   FABCOMM-FABD+DSKSTT(8),=CL8'VERIFY' Check input @SC91269 05714200
  1473.          B     DSKTEST1                                        @SC91269 05714300
  1474. *                                                                       05714500
  1475. * Test validity using external routine                         @SC90264 05715000
  1476. DSKVALID ICM   15,15,=A(KVALID)                                @SC90264 05715500
  1477.          BZR   2                                               @SC90264 05716000
  1478.          MVC   FABRESP-FABD+DSKSTT(6),=X'123456' Odd err code  @SC90264 05716500
  1479.          KCALL (15),(3),EXT,E=DSKER1 Quit if it says so        @SC90264 05717000
  1480.          BR    2                                               @SC90264 05717500
  1481. *                                                                       05718000
  1482. * Close file whose ticket is at (R1), release block                     05718500
  1483. DSKCLOS  ICM   3,15,0(1)     Get FAB ptr, if any               @SC86295 05719000
  1484.          BZ    RTRN0         None, ignore                      @SC86295 05719500
  1485.          XC    0(4,1),0(1)   Yes, now clear ticket             @SC86295 05720000
  1486.          MVC   FABCOMM,=CL8'CLOSE'                             @SC90264 05720500
  1487.          TM    FABFLGS,FABFPGM+FABFSPL Pipe?                   @SC90264 05721000
  1488.          BZ    *+8                                             @SC90264 05721500
  1489.           BAL  2,DSKLKPG     Yes, handle closing               @SC90264 05722000
  1490.          TM    FABFLGS,FABFTAK Internal file?                  @SC90264 05722500
  1491.          BZ    DSKCLOS2                                        @SC90264 05723000
  1492.          KCALL KFILIO,(3)    Yes, handle closing               @SC90264 05723500
  1493. DSKCLOS2 DS    0H                                              @SC90264 05724000
  1494.          BAL   9,DSKDEQ      Release if TDQ                    @SC92126 05724200
  1495. *                            Close file                        @SC90264 05724500
  1496.          LR    1,3                                             @SC86295 05725000
  1497.          LA    0,FABDWDS                                       @SC86295 05725500
  1498.          DMSFRET DWORDS=(0),LOC=(1)                            @SC86295 05726000
  1499.          B     RTRN0                                           @SC86295 05726500
  1500. *                                                                       05727000
  1501. * Point past 1st N records of file at (R1)                     @SC89218 05727500
  1502. DSKPNT   ICM   3,15,0(1)     Get ticket                        @SC89218 05728000
  1503.          BZ    RTRN1         Not open                          @SC89218 05728500
  1504.          LR    3,1                                             @SC89218 05729000
  1505.          LTR   2,2           Number of records to skip         @SC89218 05729500
  1506.          BNP   RTRN0         Never mind                        @SC89218 05730000
  1507.          TM    FABFLGS,FABFTS+FABFTAK  Temp stor or TAKE?      @SC90264 05730500
  1508.          BZ    DSKPNTL       No, must read to skip             @SC90264 05731000
  1509.          STH   2,FABRN       Yes, just set pointer             @SC90264 05731500
  1510.          B     RTRN0                                           @SC90264 05732000
  1511. DSKPNTL  READF 0(,3),E=RTRN1 Skip one                          @SC89218 05732500
  1512.          BCT   2,DSKPNTL     ... until finished                @SC89218 05733000
  1513.          B     RTRN          Return with completion code       @SC89218 05733500
  1514. *                                                                       05734000
  1515. * Read from file whose ticket is at (R1)                                05734500
  1516. DSKRED   LTR   3,1           Get FAB ptr                       @SC86299 05735000
  1517.          BNP   RTRN1         Not defined anymore               @SC86299 05735500
  1518.          LA    1,1                                             @SC90264 05736000
  1519.          AH    1,FABRN       Bump record counter               @SC90264 05736500
  1520.          STH   1,FABRN                                         @SC90264 05737000
  1521.          MVC   FABNORD,FDBLRC Set up length of reads           @SC90264 05737500
  1522.          L     6,FDBBUFF     Use real buffer                   @SC90264 05738000
  1523.          MVC   FABCOMM,=CL8'READ' Op code for error message    @SC90264 05738500
  1524.          TM    FABFLGS,FABFTS Temp stor?                       @SC90264 05739000
  1525.          BO    DSKREDS       Yes, do it                        @SC90264 05739500
  1526.          TM    FABFLGS,FABFTD TD queue?                        @SC90264 05740000
  1527.          BO    DSKREDD       Yes, do it                        @SC90264 05740500
  1528.          TM    FABFLGS,FABFTAK Internal file?                  @SC90264 05741000
  1529.          BO    DSKREDT       Yes, do it                        @SC90264 05741500
  1530.          TM    FABFLGS,FABFPGM+FABFSPL Pipe?                   @SC90264 05742000
  1531.          BZ    DSKRER        ???                               @SC90264 05742500
  1532.          BAL   2,DSKLKPG     Yes, handle it                    @SC90264 05743000
  1533.          LA    0,X'01'       EOF signal                        @SR92148 05743200
  1534.          B     DSKRED2                                         @SC90264 05743500
  1535. DSKREDS  DS    0H                                              @SC90264 05744000
  1536.          MVC   FABCOMM,=CL8'READ TS' Op code for error message @SC90264 05744500
  1537.          EXEC CICS READQ TS QUEUE(FABFNAM) ITEM(FABRN),        @SC90264+05745000
  1538.                INTO(0(,6)) LENGTH(FABNORD) NOHANDLE,           @SC90264 05745500
  1539.          LA    0,X'01'       ITEMERR for TS queue              @SC90264 05746000
  1540.          B     DSKRED1                                         @SC90264 05746500
  1541. DSKREDT  KCALL KFILIO,(3)                                      @SC90264 05747000
  1542.          LTR   15,15                                           @SC90264 05747500
  1543.          LA    0,X'81'       NOTFND for VSAM                   @SC90264 05748000
  1544.          B     DSKRED2                                         @SC90264 05748500
  1545. DSKREDD  MVC   FABCOMM,=CL8'READ TD' Op code for error message @SC90264 05749000
  1546.          EXEC CICS READQ TD QUEUE(FABFNAM) INTO(0(,6)),        @SC90264+05749500
  1547.                LENGTH(FABNORD) NOHANDLE,                       @SC90264 05750000
  1548.          LA    0,X'01'       QZERO for TD queue                @SC90264 05750500
  1549. DSKRED1  BAL   14,DSKCHKER   Test success                      @SC90264 05751000
  1550. DSKRED2  BNZ   DSKRERX       No, see if EOF                    @SC90264 05751500
  1551.          LH    7,FABNORD     Actual length                     @SC90264 05752000
  1552.          L     1,FDBBUFF     Ptr to data area                  @SC90264 05752500
  1553.          LM    14,15,FDBBUFF Get buffer and size               @SC90264 05753000
  1554.          LR    0,7           Save length for number check      @SC88101 05753500
  1555.          AR    7,1           End of record                     @SC86299 05754000
  1556.          CLI   DSKCOD,0      NONUM?                            @SC88101 05754500
  1557.          BNE   DSKREDC       No, use everything                @SC88101 05755000
  1558.          CLI   FDBRCF,C'F'   Fixed-length records?             @SC88101 05755500
  1559.          BNE   DSKREDV       No, line numbers at start (if any)@SC88101 05756000
  1560.          CH    0,=H'80'      See if F/80                       @SC88101 05756500
  1561.          BNE   DSKREDC       No                                @SC88101 05757000
  1562.          MVZ   NUMPAT(5),75(1)  See if 76-80 are all numeric   @SC88101 05757500
  1563.          CLC   NUMPAT(5),=8C'0'                                @SC88101 05758000
  1564.          BNE   DSKREDC       No                                @SC88101 05758500
  1565.          S     7,F8          Yes, move the end back            @SC88101 05759000
  1566.          B     DSKREDC                                         @SC88101 05759500
  1567. DSKREDV  LA    0,8(1)        Is length at least 8?             @SC88101 05760000
  1568.          CR    0,7                                             @SC88101 05760500
  1569.          BNL   DSKREDC       No, can't be numbered             @SC88101 05761000
  1570.          MVZ   NUMPAT(8),0(1)   See if 1-8 all numeric         @SC88101 05761500
  1571.          CLC   NUMPAT(8),=8C'0'                                @SC88101 05762000
  1572.          BNE   DSKREDC       No, not numbered                  @SC88101 05762500
  1573.          LA    1,8(1)        Yes, skip over number             @SC88101 05763000
  1574. DSKREDC  DS    0H                                              @SC88101 05763500
  1575.          SR    7,1           Revised length                    @SC86299 05764000
  1576.          LR    6,1                                             @SC86299 05764500
  1577.          CR    7,15                                            @SC90264 05765000
  1578.          BNL   *+6                                             @SC86299 05765500
  1579.          LR    15,7          Buffer not filled                 @SC90264 05766000
  1580.          L     1,4(13)                                         @SC86299 05766500
  1581.          ST    15,20(1)      Return length in R0               @SC90264 05767000
  1582.          CLI   DSKCOD,0      NONUM?                            @SC88101 05767500
  1583.          BNE   *+8                                             @SC88101 05768000
  1584.           ST   14,24(,1)     Yes, return R1 ptr                @SC90264 05768500
  1585.          CR    14,6          Already in place?                 @SC90264 05769000
  1586.          BE    *+6           Yes, don't copy                   @SC90264 05769500
  1587.           MVCL 14,6          Copy to buffer                    @SC90264 05770000
  1588.          B     RTRN0                                           @SC86299 05770500
  1589. * Test for successful completion of CICS command               @SC90264 05771000
  1590. DSKCHKER L     15,DFHEIBP    Set up to copy EIB code           @SC90264 05771500
  1591.          USING DFHEIBLK,15                                     @SC90264 05772000
  1592.          MVC   FABRESP,EIBRCODE                                @SC90264 05772500
  1593.          CLC   F0,FABRESP    Ok?                               @SC90264 05773000
  1594.          BR    14            Return with CC                    @SC90264 05773500
  1595.          DROP  15                                              @SC90264 05774000
  1596. * Error on input                                               @SC90264 05774500
  1597. DSKRER   LA    15,1          Return code for ordinary error    @SC90264 05775000
  1598. DSKRER2  MVI   ERRNUM,ERRDIE Disk I/O error                    @SC90264 05775500
  1599.          B     RTRN          Indicate error                    @SC90264 05776000
  1600. DSKFUL   LA    15,13         Indicate disk full                @SC90264 05776500
  1601.          B     DSKRER2                                         @SC90264 05777000
  1602. * Error on read.  See if just EOF                              @SC90264 05777500
  1603. DSKRERX  CLM   0,1,FABRESP   R0 has code that means EOF        @SC90264 05778000
  1604.          BNE   DSKRER        No, just ordinary error           @SC90264 05778500
  1605. * End of file on input. Don't close it yet.                    @SC86295 05779000
  1606. DSKEOD   LA    15,12         End return code                   @SC86295 05779500
  1607.          B     RTRN                                            @SC86295 05780000
  1608. *                                                                       05780500
  1609. * Write to file whose ticket is at (R1)                                 05781000
  1610. DSKWRT   LTR   3,1           Get FAB ptr                       @SC86299 05781500
  1611.          BNP   RTRN1         Not defined anymore               @SC86299 05782000
  1612.          LA    1,1                                             @SC90264 05782500
  1613.          AH    1,FABRN       Bump record counter               @SC90264 05783000
  1614.          STH   1,FABRN                                         @SC90264 05783500
  1615.          LM    6,7,FDBBUFF   Get buffer and size               @SC90264 05784000
  1616.          STH   7,FABNORD     Put length in temp var            @SC90264 05784500
  1617.          MVC   FABCOMM,=CL8'WRITE' Op code for error message   @SC90264 05785000
  1618.          TM    FABFLGS,FABFTS  Temp stor?                      @SC90264 05785500
  1619.          BO    DSKWRTS       Yes, do it                        @SC90264 05786000
  1620.          TM    FABFLGS,FABFTD TD queue?                        @SC90264 05786500
  1621.          BO    DSKWRTD       Yes, do it                        @SC90264 05787000
  1622.          TM    FABFLGS,FABFTAK Internal file?                  @SC90264 05787500
  1623.          BO    DSKWRTT       Yes, do it                        @SC90264 05788000
  1624.          TM    FABFLGS,FABFPGM+FABFSPL Pipe?                   @SC90264 05788500
  1625.          BZ    DSKRER        Huh?                              @SC90264 05789000
  1626.          BAL   2,DSKLKPG     Yes, handle it                    @SC90264 05789500
  1627.          LA    0,X'10'       NOSPACE code for Extra TD queues  @SC90264 05790000
  1628.          B     DSKWRT2                                         @SC90264 05790500
  1629. DSKWRTS  DS    0H                                              @SC90264 05791000
  1630.          MVC   FABCOMM,=CL8'WRIT TS' Op code for error message @SC90264 05791500
  1631.          TM    FABFLGS,FABFMAIN  Main storage?                 @SC90264 05792000
  1632.          BZ    DSKWRTSA      No, use AUX                       @SC90264 05792500
  1633.          EXEC CICS WRITEQ TS QUEUE(FABFNAM) FROM(0(,6)) MAIN,  @SC90264+05793000
  1634.                LENGTH(FABNORD) NOHANDLE,                       @SC90264 05793500
  1635.          LA    0,X'08'       NOSPACE code for TS queues        @SC90264 05794000
  1636.          B     DSKWRT1       Test success                      @SC90264 05794500
  1637. DSKWRTSA EXEC CICS WRITEQ TS QUEUE(FABFNAM) FROM(0(,6)),       @SC90264+05795000
  1638.                AUXILIARY LENGTH(FABNORD) NOHANDLE,             @SC90264 05795500
  1639.          LA    0,X'08'       NOSPACE code for TS queues        @SC90264 05796000
  1640.          B     DSKWRT1       Test success                      @SC90264 05796500
  1641. DSKWRTT  KCALL KFILIO,(3)                                      @SC90264 05797000
  1642.          LTR   15,15                                           @SC90264 05797500
  1643.          LA    0,X'83'       NOSPACE code for VSAM WRITE       @SC90264 05798000
  1644.          B     DSKWRT2                                         @SC90264 05798500
  1645. DSKWRTD  MVC   FABCOMM,=CL8'WRIT TD' Op code for error message @SC90264 05799000
  1646.          EXEC CICS WRITEQ TD QUEUE(FABFNAM) FROM(0(,6)),       @SC90264+05799500
  1647.                LENGTH(FABNORD) NOHANDLE,                       @SC90264 05800000
  1648.          LA    0,X'10'       NOSPACE code for TD queues        @SC90264 05800500
  1649. DSKWRT1  BAL   14,DSKCHKER   Test success                      @SC90264 05801000
  1650. DSKWRT2  BZ    RTRN0                                           @SC90264 05801500
  1651.          CLM   0,1,FABRESP   NOSPACE?                          @SC90264 05802000
  1652.          BE    DSKFUL        Yes, treat it separately          @SC90264 05802500
  1653.          B     DSKRER        No, catch-all I/O error           @SC90264 05803000
  1654. *                                                                       05803500
  1655. * Analyze error: code in FABRESP                               @SC90264 05804000
  1656. DSKXXX   LR    3,1                                             @SC89073 05804500
  1657.          MVI   ERRNUM,ERRDIE Set Kermit error code             @SC87338 05805000
  1658.          L     2,EMSGP       Ptr to msg buffer                 @SC87338 05805500
  1659.          MVC   0(8,2),FABCOMM Copy oprn name                   @SC87338 05806000
  1660.          MVC   8(2,2),=C'R='                                   @SC87338 05806500
  1661.          UNPK  10(13,2),FABRESP(7) Copy error code             @SC90264 05807000
  1662.          TR    10(12,2),TRHEX Convert to hex                   @SC90264 05807500
  1663.          MVC   EMSGL,=F'22'  Length of string                  @SC90264 05808000
  1664.          B     RTRN1                                           @SC87338 05808500
  1665. *                                                                       05808510
  1666. * Enqueue for working on a TDQ.  Wait up to (R0)-1 sec if nec. @SC92126 05808520
  1667. DSKENQ   TM    FABFLGS,FABFTD TD?                              @SC92126 05808530
  1668.          BZ    4(,9)         No, queuing not needed            @SC92126 05808540
  1669.          MVC   DSKQUE(4),FABFNAM Yes, set up resource name     @SC92126 05808550
  1670.          MVC   DSKQUE+4(3),=C'.TD'                             @SC92126 05808560
  1671.          STH   0,DSKENQCT                                      @SC92126 05808570
  1672.          EXEC CICS HANDLE CONDITION ENQBUSY(DSKENQNO),         @SC92126 05808580
  1673. DSKENQLP EXEC CICS ENQ RESOURCE(DSKQUE) LENGTH(7),             @SC92126 05808590
  1674.          OI    FDBFLGS,FDBENQ Now enqueued                     @SC92126 05808600
  1675.          B     4(,9)         Ok, proceed                       @SC92126 05808610
  1676. DSKENQNO LH    0,DSKENQCT    Busy, see if we can wait...       @SC92126 05808620
  1677.          BCT   0,DSKENQNX    Branch if we can                  @SC92126 05808630
  1678.          BR    9             Give up, take error exit          @SC92126 05808640
  1679. DSKENQNX STH   0,DSKENQCT    Update counter                    @SC92126 05808650
  1680.          EXEC CICS DELAY INTERVAL(1),                          @SC92126 05808660
  1681.          B     DSKENQLP                                        @SC92126 05808670
  1682. *                                                                       05808680
  1683. * Release after working on a TDQ.  Must not alter FABRESP.     @SC92126 05808690
  1684. DSKDEQ   TM    FABFLGS,FABFTD TD?                              @SC92126 05808700
  1685.          BZR   9             No, dequeuing not needed          @SC92126 05808710
  1686.          TM    FDBFLGS,FDBENQ Queuing done?                    @SC92126 05808720
  1687.          BZR   9             No, dequeuing not needed          @SC92126 05808730
  1688.          MVC   DSKQUE(4),FABFNAM Yes, set up resource name     @SC92126 05808740
  1689.          MVC   DSKQUE+4(3),=C'.TD'                             @SC92126 05808750
  1690.          EXEC CICS DEQ RESOURCE(DSKQUE) LENGTH(7),             @SC92126 05808760
  1691.          NI    FDBFLGS,255-FDBENQ                              @SC92126 05808770
  1692.          BR    9             Ok, proceed                       @SC92126 05808780
  1693. *                                                                       05809000
  1694. * Directory Info on file R1->name, return R15=0 if OK                   05809500
  1695. DSKDIR   DS    0H                                              @SC89073 05810000
  1696.          NI    DSKFL,255-NFFND                                 @SC90264 05810500
  1697.          NXTFSET E=DSKDRERR  Set up search (name at R1)        @SC88308 05811000
  1698. DSKDRLP  NXTF  E=DSKDRZ      Find next entry                   @SC88308 05811500
  1699.          LR    3,1           Move FDB ptr                      @SC90264 05812000
  1700.          SH    3,=Y(FDBD-FABD)  Set up addressability          @SC90264 05812500
  1701.          TM    DSKFL,NFFND   Found something already?          @SC90264 05813000
  1702.          BO    DSKDRL1                                         @SC90264 05813500
  1703.          WTEXT '&DIRHDNG'                                      @SC92300 05814300
  1704.          OI    DSKFL,NFFND   Found something, at least one     @SC88308 05815000
  1705. DSKDRL1  DS    0H                                              @SC90264 05815500
  1706.          LA    7,CMD         Make attr list in buffer          @SC90264 05816000
  1707.          LA    0,FFDSP       Format the file name              @SC90264 05816500
  1708.          KCALL FSPEC,FABFID                                    @SC90264 05817000
  1709.          LA    2,24(,7)      Allow enough room                 @SC92150 05817500
  1710. DSKDRBL  MVI   0(15),C' '                                      @SC90264 05818000
  1711.          LA    15,1(,15)                                       @SC90264 05818500
  1712.          CR    15,2                                            @SC90264 05819000
  1713.          BNH   DSKDRBL                                         @SC90264 05819500
  1714.          MVC   1(1,2),FDBRCF RECFM, if any                              05820000
  1715.          CLI   1(2),0                                                   05820500
  1716.          BNE   *+8                                                      05821000
  1717.           MVI  1(2),C'?'                                                05821500
  1718.          LA    2,2(,2)                                                  05822000
  1719.          LH    0,FDBLRC                                                 05822500
  1720.          BAL   9,DSKNUM      Add the logical record length              05823000
  1721.          LH    0,FDBNREC                                       @SC90264 05823500
  1722.          BAL   9,DSKNUM      Add the record count              @SC90264 05824000
  1723.          L     0,FDBSIZE                                       @SC90264 05824500
  1724.          BAL   9,DSKNUM      Add the file size                 @SC90264 05825000
  1725.          MVC   0(2,2),=CL2' ' Leave some blanks                         05825500
  1726.          LA    2,2(,2)       Bump the length                   @SC88308 05826000
  1727.          ICM   0,8,FDBFL2                                               05826500
  1728.          LA    15,4                                            @SC90264 05827000
  1729.          LA    6,DSKTYPS                                                05827500
  1730. DSKDRTL  LTR   0,0                                                      05828000
  1731.          BM    DSKDRTP                                                  05828500
  1732.          LA    6,6(,6)                                                  05829000
  1733.          SLL   0,1                                                      05829500
  1734.          BCT   15,DSKDRTL                                      @SC90264 05830000
  1735. DSKDRTP  MVC   0(6,2),0(6)                                              05830500
  1736.          LA    2,6(,2)                                                  05831000
  1737.          CLI   FDBDATE,X'19' Validate century                  @SC91150 05831500
  1738.          BL    DSKDRDZ       No good!                          @SC91150 05832000
  1739.          CLI   FDBDATE,X'20'                                   @SC91150 05832500
  1740.          BH    DSKDRDZ                                         @SC91150 05833000
  1741.          MVC   0(DSKDRPTL,2),DSKDRPT                           @SC91150 05833500
  1742.          ED    0(DSKDRPTL,2),FDBDATE                           @SC91150 05834000
  1743.          LA    2,DSKDRPTL(,2)                                  @SC91150 05834500
  1744. DSKDRDZ  DS    0H                                              @SC91150 05835000
  1745. *                                                                       05835500
  1746.          SR    2,7           Get the output length             @SC90264 05836000
  1747.          WTEXT (7),(2)                                         @SC90264 05836500
  1748.          B     DSKDRLP                                         @SC88308 05837000
  1749. DSKDRPT  DC    C' ',4X'20',C'/',2X'20',C'/',2X'20',C' '  Date  @SC91150 05837500
  1750.          DC    2X'20',C':',2X'20',C':',2X'20'            Time  @SC91150 05838000
  1751. DSKDRPTL EQU   *-DSKDRPT     Length of pattern                 @SC91150 05838500
  1752. *                                                              @SC88308 05839000
  1753. DSKDRZ   TM    DSKFL,NFFND   Any files found?                  @SC90264 05839500
  1754.          BO    RTRN0         Yes, return gracefully            @SC88308 05840000
  1755. DSKDRERR B     RTRN1         Not found or invalid              @SC90264 05840500
  1756. *                                                                       05841000
  1757. DSKNUM   CVD   0,TMPDW       Pack the binary value                      05841500
  1758.          OI    TMPDW+7,15    Set zone                                   05842000
  1759.          UNPK  0(8,2),TMPDW  Convert to printable                       05842500
  1760.          LA    15,7(,2)      Point to end of string            @SC90264 05843000
  1761. DSKNUM2  CLI   0(2),C'0'     Remove leading zeros                       05843500
  1762.          BNE   DSKNUM3       except for the first one.                  05844000
  1763.          MVI   0(2),C' '                                                05844500
  1764.          LA    2,1(2)                                                   05845000
  1765.          CR    2,15                                            @SC90264 05845500
  1766.          BL    DSKNUM2                                                  05846000
  1767. DSKNUM3  LA    2,1(,15)      Get the new ending address        @SC90264 05846500
  1768.          BR    9                                                        05847000
  1769. *                                                                       05847500
  1770. DSKTYPS  DC    C'INTRA '                                                05848000
  1771.          DC    C'EXTRA '                                                05848500
  1772.          DC    C'INDIR.'                                                05849000
  1773.          DC    C'REMOTE'                                                05849500
  1774.          DC    CL6'&OTHERL6'                                   @SC92300 05850000
  1775. *                                                                       05850500
  1776. * Delete file.  R1-> name. Returns R15=0 if ok.                         05851000
  1777. DSKDEL   DS    0H                                              @SC89073 05851500
  1778.          LR    6,1                                             @SC90264 05852000
  1779.          LA    3,DSKSTT                                        @SC86295 05852500
  1780.          MVC   FABFID,0(6)   Copy name into temp FAB           @SC90264 05853000
  1781.          MVC   FABCOMM,=CL8'DELETE'                            @SC90264 05853500
  1782.          BAL   2,DSKVALID    See if allowed                    @SC90264 05854000
  1783.          TM    FABFLGS,FABFPGM+FABFSPL Pipe?                   @SC90264 05854500
  1784.          BNZ   DSKDELP       Yes, do it                        @SC90264 05855000
  1785.          TM    FABFLGS,FABFTAK Internal file?                  @SC90264 05855500
  1786.          BO    DSKDELT       Yes, do it                        @SC90264 05856000
  1787.          TM    FABFLGS,FABFTS   Temp stor?                     @SC90264 05856500
  1788.          BZ    DSKDELD       No, Transdat                      @SC90264 05857000
  1789.          EXEC CICS DELETEQ TS QUEUE(FABFNAM) NOHANDLE,         @SC90264 05857500
  1790.          BAL   14,DSKCHKER   Test success                      @SC90264 05858000
  1791.          BNZ   RTRN1         Oops                              @SC90264 05858500
  1792.          B     RTRN0                                           @SC90264 05859000
  1793. DSKDELP  BAL   2,DSKLKPG     Handle it                         @SC90264 05859500
  1794.          BNZ   RTRN1         Something was wrong               @SC90264 05860000
  1795.          B     RTRN0                                           @SC90264 05860500
  1796. DSKDELT  KCALL KFILIO,(3),E=RTRN1                              @SC90264 05861000
  1797.          B     RTRN0                                           @SC90264 05861500
  1798. DSKDELD  DS    0H                                              @SC90264 05862000
  1799.          BAL   2,DSKLKP      See if it's there                 @SC90264 05862500
  1800.          BNZ   RTRN1         No, say error                     @SC90264 05863000
  1801.          LA    0,4           Wait up to 3 sec                  @SC92126 05863100
  1802.          BAL   9,DSKENQ                                        @SC92126 05863200
  1803.           B    RTRN1         Can't get it now, give up         @SC92126 05863300
  1804.          TM    TDDCTDT,TDINDTBM Intra-partition?               @SC90264 05863500
  1805.          BZ    DSKDELDX      No, shouldn't try to purge it     @SC92126 05864000
  1806.          EXEC CICS DELETEQ TD QUEUE(FABFNAM) NOHANDLE,         @SC90264 05864500
  1807.          BAL   14,DSKCHKER   Test success                      @SC90264 05865000
  1808.          B     DSKDELDY                                        @SC92126 05865080
  1809. DSKDELDX BAL   9,DSKTDOPE    Close and open                    @SC92126 05865160
  1810.           NOP  0                                               @SC92126 05865240
  1811. DSKDELDY BAL   9,DSKDEQ                                        @SC92126 05865320
  1812.          CLC   F0,FABRESP    See if succeeded                  @SC92126 05865400
  1813.          BNZ   RTRN1         Oops                              @SC90264 05865500
  1814.          B     RTRN0                                           @SC90264 05866000
  1815. *                                                                       05866500
  1816. * Rename file.  R1-> name. R2-> new name. Returns R15=0 if ok.          05867000
  1817. DSKRNM   DS    0H                                              @SC89073 05867500
  1818.          B     RTRN1                                                    05868000
  1819. *                                                                       05868500
  1820. * Copy file.  R1-> name. R2-> new name. Returns R15=0 if ok.            05869000
  1821. DSKCPY   DS    0H                                              @SC89073 05869500
  1822.          LR    6,1           Point to source file name         @SC90264 05870000
  1823.          LR    7,2           Point to new name                 @SC90264 05870500
  1824.          NI    FILFLGS,255-APPN Don't append                   @SC90264 05871000
  1825.          OI    FILFLGS,SVATT Use old attributes on output      @SC90264 05871500
  1826.          L     9,EMSGP       Ptr to msg buffer                 @SC90264 05872000
  1827.          INITSTR '&NOTFOUN',0(9)                               @SC92300 05872500
  1828.          SR    15,9                                            @SC92300 05872700
  1829.          ST    15,EMSGL      Store length of string            @SC92300 05872900
  1830.          OPENF I,(6),FILFDB,FILPTR,E=DSKCPXX                   @SC90264 05873500
  1831.          INITSTR '&TOOSHRT',0(9)                               @SC92300 05874000
  1832.          SR    15,9                                            @SC92300 05874300
  1833.          ST    15,EMSGL      Store length of string            @SC92300 05874600
  1834.          POINTF FILPTR,IFOPTS-IFILE(6),E=DSKCPXX Skip if any   @SC91150 05875000
  1835.          INITSTR '&BADOUTF',0(9)                               @SC92300 05875500
  1836.          SR    15,9                                            @SC92300 05875800
  1837.          ST    15,EMSGL      Store length of string            @SC92300 05876100
  1838.          LR    3,0           Pass input FDB to output          @SC90264 05876500
  1839.          OPENF O,(7),FDBD,DSKCPPTR,E=DSKCPXX                   @SC90264 05877000
  1840.          LR    3,0           Point to output FAB               @SC90264 05877500
  1841. DSKCPLP  ICM   1,15,IFOPTS-IFILE(6)   Get record counter       @SC91150 05878000
  1842.          AL    1,F1                                            @SC91150 05878500
  1843.          STCM  1,15,IFOPTS-IFILE(6)   Update record counter    @SC91150 05879000
  1844.          CLM   1,15,IFOPTS+4-IFILE(6) Passed end?              @SC91150 05879500
  1845.          BH    DSKTYEOF      Yes, quit now                     @SC91150 05880000
  1846.          L     7,WBUF        Point to data buffer              @SC91150 05880500
  1847.          READF FILPTR,BUFFER=(7),E=DSKTYP50                    @SC91150 05881000
  1848.          CLI   FDBRCF,C'F'   Fixed?                            @SC90264 05881500
  1849.          BNE   DSKCPWR       No, just write what we got        @SC90264 05882000
  1850.          CH    0,FDBLRC      Yes, see if correct length        @SC90264 05882500
  1851.          BE    DSKCPWR       Ok, do it                         @SC90264 05883000
  1852.          LR    8,0           No, save actual length            @SC90264 05883500
  1853.          LH    0,FDBLRC      Get correct length                @SC90264 05884000
  1854.          BH    DSKCPWR       Was too much, just truncate       @SC90264 05884500
  1855.          LR    9,0                                             @SC90264 05885000
  1856.          SR    9,8           Was too little, get length to pad @SC90264 05885500
  1857.          AR    8,7                                             @SC91150 05886000
  1858.          SR    15,15                                           @SC90264 05886500
  1859.          ICM   15,8,BLANK                                      @SC90264 05887000
  1860.          MVCL  8,14                                            @SC90264 05887500
  1861. DSKCPWR  WRITF DSKCPPTR,BUFFER=(7),BSIZE=(0),E=DSKCPER         @SC91150 05888000
  1862.          B     DSKCPLP                                         @SC90264 05888500
  1863. *                                                                       05889000
  1864. * Type file.   R1-> name. Returns R15=0 if ok.                          05889500
  1865. *  N.B. DSKCPPTR must be zero here to share code with DSKCPY   @SC90264 05890000
  1866. DSKTYP   DS    0H                                              @SC89073 05890500
  1867.          LR    6,1           Point to file name                @SC90264 05891000
  1868.          L     9,EMSGP       Ptr to msg buffer                 @SC90264 05891500
  1869.          INITSTR '&NOTFOUN',0(9)                               @SC92300 05892000
  1870.          SR    15,9                                            @SC92300 05892300
  1871.          ST    15,EMSGL      Store length of string            @SC92300 05892600
  1872.          OPENF I,(6),FILFDB,FILPTR,E=DSKCPXX                   @SC90264 05893000
  1873.          LR    3,0           Point to FAB                      @PG88335 05893500
  1874.          INITSTR '&TOOSHRT',0(9)                               @SC92300 05894000
  1875.          SR    15,9                                            @SC92300 05894300
  1876.          ST    15,EMSGL      Store length of string            @SC92300 05894600
  1877.          POINTF FILPTR,IFOPTS-IFILE(6),E=DSKCPXX Skip if any   @SC91150 05895000
  1878.          LH    1,FDBLRC                                        @PG88335 05895500
  1879.          CH    1,=H'130'     Check record length !!!           @PG88335 05896000
  1880.          BL    DSKTYP20                                        @PG88335 05896500
  1881.          WTEXT '&ONLY130'                                      @PG88335 05897000
  1882. DSKTYP20 ICM   1,15,IFOPTS-IFILE(6)   Get record counter       @SC91150 05897500
  1883.          AL    1,F1                                            @SC91150 05898000
  1884.          STCM  1,15,IFOPTS-IFILE(6)   Update record counter    @SC91150 05898500
  1885.          CLM   1,15,IFOPTS+4-IFILE(6) Passed end?              @SC91150 05899000
  1886.          BH    DSKTYEOF      Yes, quit now                     @SC91150 05899500
  1887.          L     3,RBUF        Point to data buffer              @SC91150 05900000
  1888.          READF FILPTR,BUFFER=(3),E=DSKTYP50                    @PG88335 05900500
  1889.          CH    0,=H'130'     Record too long ?                 @PG88335 05901000
  1890.          BL    DSKTYP30                                        @PG88335 05901500
  1891.          LA    0,129         Yes, truncate...                  @PG88335 05902000
  1892. DSKTYP30 LTR   0,0           Is it null ?                      @PG88335 05902500
  1893.          BNZ   DSKTYP35                                        @PG88335 05903000
  1894.          MVI   0(3),X'40'    Then we must have at least        @PG88335 05903500
  1895.          LA    0,1           one character to output           @PG88335 05904000
  1896. DSKTYP35 WTEXT (3)                                             @PG88335 05904500
  1897.          B     DSKTYP20                                        @PG88335 05905000
  1898. DSKTYEOF L     15,F12        EOF code - hit end                @SC91150 05905500
  1899. DSKTYP50 C     15,F12        EOF code ?                        @PG88335 05906000
  1900.          LA    7,0           If so, no error                   @SC90264 05906500
  1901.          BE    DSKTYP70                                        @PG88335 05907000
  1902. DSKCPER  ERRF  ,             Analyze error code                @SC90264 05907500
  1903. DSKCPXX  LA    7,1           Set return code                   @SC90264 05908000
  1904.          ICM   0,15,EMSGL    Length of message                 @SC90264 05908500
  1905.          BNP   DSKTYP70                                        @SC90264 05909000
  1906.          L     1,EMSGP                                         @SC90264 05909500
  1907.          WTEXT (1),(0)       Show error message                @SC90264 05910000
  1908. DSKTYP70 CLOSF FILPTR                                          @PG88335 05910500
  1909.          CLOSF DSKCPPTR                                        @SC90264 05911000
  1910.          LR    15,7          Copy return code                  @SC90264 05911500
  1911.          B     RTRN                                            @SC90264 05912000
  1912. *                                                                       05912500
  1913. * Return on error, release useless block, if any                        05913000
  1914. DSKER1A  BAL   9,DSKDEQ      Dequeue if enqueued               @SC92126 05913200
  1915. DSKER1   LTR   1,4           Any block assigned?               @SC86295 05913500
  1916.          BZ    RTRN1         No                                @SC86295 05914000
  1917.          LA    0,FABDWDS     Yes, release it                   @SC86295 05914500
  1918.          DMSFRET DWORDS=(0),LOC=(4)                            @SC92126 05915000
  1919.          B     RTRN1         Flag error                        @SC86295 05915500
  1920. *                                                                       05916000
  1921. * Allocate new FAB and initialize with name at (R2) and with   @SC90264 05916500
  1922. *  FDB pattern at (R6); put name in DSKSTT; return FAB,FDB     @SC90264 05917000
  1923. *  ptrs to DISKIO caller as R0,R1; leave R3->FAB, R4->FAB,     @SC90264 05917500
  1924. *  R6->pattern; return via R9.                                 @SC90264 05918000
  1925. DSKALC   LR    6,1           Save FDB ptr                      @SC90264 05918500
  1926.          MVC   DSKSTNM,0(2)                                    @SC86295 05919000
  1927.          LA    0,FABDWDS     Yes, release it                   @SC86295 05919500
  1928.          DMSFREE DWORDS=(0),ERR=DSKER1                         @SC86295 05920000
  1929.          LR    3,1           New block ptr                     @SC86295 05920500
  1930.          LA    4,FDBD        FDB pointer                       @SC88120 05921000
  1931.          RETREG (0,3),(1,4)  Return (3) as R0, (4) as R1       @SC89218 05921500
  1932.          LR    4,3           Indicate we have it               @SC88120 05922000
  1933.          XC    0(8*FABDWDS,3),0(3)                             @SC86295 05922500
  1934.          MVC   FDBD(FDBCOP),0(6) Copy user's FDB               @SC90264 05923000
  1935.          MVC   FABFID,0(2)                                     @SC90264 05923500
  1936.          BR    9                                               @SC86295 05924000
  1937. *                                                                       05924500
  1938. * Look up file whose name is in FAB; return CC=Z if found.     @SC90264 05925000
  1939. * Return via R2.  Uses R0,R1,R8,R9,R14,R15.                    @SC90264 05925500
  1940. * Leaves DSKSECPL -> TDDCT or TSUTE or KFSBLK                  @SC90264 05926000
  1941. DSKLKP   DS    0H                                              @SC90264 05926500
  1942.          TM    FABFLGS,FABFTD TD queue?                        @SC90264 05927000
  1943.          BO    DSKLKPD       Yes, do it                        @SC90264 05927500
  1944.          TM    FABFLGS,FABFPGM+FABFSPL Pipe?                   @SC90264 05928000
  1945.          BNZ   DSKLKPG       Yes, do it                        @SC90264 05928500
  1946.          TM    FABFLGS,FABFTAK Internal file?                  @SC90264 05929000
  1947.          BO    DSKLKTK       Yes, do it                        @SC90264 05929500
  1948.          TM    FABFLGS,FABFTS TS queue?                        @SC90264 05930000
  1949.          BZ    DSKLKNF       No, something is wrong            @SC90264 05930500
  1950.          MVI   FDBRCF,C'V'   Enforce RECFM=V                   @SC91150 05931000
  1951.          L     1,CSAPTR                                        @NL90264 05931500
  1952.          L     9,CSATSMTA-DFHCSABA(1)  A(temp storage table)   @NL90264 05932000
  1953.          USING DFHTSUT,9                                       @SC90264 05932500
  1954.          USING DFHTSUTE,1                                      @SC90264 05933000
  1955. DSKLKPSL LTR   9,9                                             @SC90264 05933500
  1956.          BZ    DSKLKNF       Not found                         @SC90264 05934000
  1957.          CLC   TSUTCC,F0     Test for no entries               @SC90264 05934500
  1958.          BE    DSKLKPSN                                        @SC90264 05935000
  1959.          L     1,TSUTAHI     First on chain                    @SC90264 05935500
  1960. DSKLKPS1 CLC   TSUTEID,FABFNAM Match?                          @SC90264 05936000
  1961.          BE    DSKLKSG       Found it                          @SC90264 05936500
  1962.          C     1,TSUTALI     Any more on chain?                @SC90264 05937000
  1963.          BNL   DSKLKPSN                                        @SC90264 05937500
  1964.          LA    1,TSUTELN(,1) Check next entry                  @SC90264 05938000
  1965.          B     DSKLKPS1                                        @SC90264 05938500
  1966. DSKLKPSN L     9,TSUTFC                                        @SC90264 05939000
  1967.          B     DSKLKPSL                                        @SC90264 05939500
  1968. DSKLKSG  ST    1,DSKSECPL    Ptr to TSUTE                      @SC90264 05940000
  1969.          TM    TSUTETC,TSUTEGID  Is group id bit on?           @ML90264 05940500
  1970.          BO    DSKLKFND      Yes, all is well                  @SC90264 05941000
  1971.          CLC   FABCOMM(5),=CL8'OPEN I'                         @SC90264 05941500
  1972.          BE    DSKER1A       Don't do it after all             @SC92126 05942000
  1973. DSKLKFND CLR   2,2           Set CC=Z                          @SC90264 05942500
  1974.          BR    2                                               @SC90264 05943000
  1975. DSKLKNF  CLI   *,0           Indicate error                    @SC90264 05943500
  1976.          BR    2                                               @SC90264 05944000
  1977.          DROP  1,9                                             @SC90264 05944500
  1978. DSKLKPD  L     1,CSAPTR                                        @SC90264 05945000
  1979.          L     DCTCBAR,CSADCTBA-DFHCSABA(,1) Start of DCT table@SC90264 05945500
  1980. DSKLKPL  CLI   TDDCTDID,254  Reached end?                      @SC90264 05946000
  1981.          BHR   2             Yes, return CC=H                  @SC90264 05946500
  1982.          CLC   TDDCTDID,FABFNAM    Found match?                @SC90264 05947000
  1983.          BE    DSKLKDI             Yes, verify contents        @SC90264 05947500
  1984.          AH    DCTCBAR,TDDCTELN    No, on to next item         @SC90264 05948000
  1985.          B     DSKLKPL                                         @SC90264 05948500
  1986. DSKLKDI  ST    DCTCBAR,DSKSECPL    Ptr to DCT                  @SC90264 05949000
  1987.          MVC   FDBFL2,TDDCTDT  Copy flags so we'll remember    @SC91150 05949500
  1988.          TM    TDDCTDT,TDINDTBM    INTRA?                      @SC90264 05950000
  1989.          BZ    DSKLKDX       No, check EXTRA                   @SC90264 05950500
  1990.          CLC   TDDCTTQC,F0   Yes, any records in it?           @SC90264 05951000
  1991.          BE    DSKLKNF       None, say "not found"             @SC90264 05951500
  1992.          B     DSKLKFND                                        @SC90264 05952000
  1993. DSKLKDX  TM    TDDCTDT,TDEXTRBM EXTRA?                         @SC90264 05952500
  1994.          MVI   FDBRCF,C'V'   Enforce RECFM=V if INTRA          @SC91150 05953000
  1995.          BZR   2             No, say "found"                   @SC90264 05953500
  1996.          L     15,TDDCTSDS   Ptr to SDSCI                      @SC90264 05954000
  1997.          USING DCTSDSCI,15                                     @SC90264 05954500
  1998.          MVC   FDBXRCF,DCTSDSRF RECFM from extra TD            @SC90264 05955000
  1999.          MVC   FDBXLRC,DCTSDSRL LRECL                          @SC90264 05955500
  2000.          MVC   FDBXBLK,DCTSDSBL BLKSI                          @SC90264 05956000
  2001.          CLC   FABCOMM(5),=CL8'OPEN I'                         @SC90264 05956500
  2002.          BNE   DSKLKDA       Not going to open it              @SC90264 05957000
  2003.          OI    FDBFLGS,SVATT Must observe predefined attrs     @SC91150 05957500
  2004.          LA    9,C'O'                                          @SC90264 05958000
  2005.          TM    DCTSDSTF,DCTSDSOP  Output?                      @SC90264 05958500
  2006.          BO    *+8           Yes                               @SC90264 05959000
  2007.           LA   9,C'I'        No, input                         @SC90264 05959500
  2008.          CLM   9,1,FABCOMM+5 Does it match data set?           @SC90264 05960000
  2009.          BNE   DSKER1A       No, we're in trouble              @SC92126 05960500
  2010. DSKLKDA  TM    DCTSDSTF,DCTSDSOP  Output?                      @SC90264 05961000
  2011.          BO    DSKLKDO       Yes, see if we want output        @SC91269 05961500
  2012.          LA    0,1           Don't wait                        @SC92126 05961600
  2013.          BAL   9,DSKENQ                                        @SC92126 05961700
  2014.           B    DSKLKFND      Can't get it now, say it exists   @SC92126 05961800
  2015.          BAL   9,DSKTDOPE                                      @SC90264 05962000
  2016.           B    DSKLKDD       Failed, say it's not there        @SC92126 05962500
  2017.          EXEC CICS READQ TD QUEUE(FABFNAM) SET(1),             @SC90264+05963000
  2018.                LENGTH(FABNORD) NOHANDLE,                       @SC90264 05963500
  2019.          BAL   14,DSKCHKER   Test success                      @SC90264 05964000
  2020.          BAL   9,DSKDEQ                                        @SC92126 05964100
  2021.          CLC   F0,FABRESP    Was the READQ Ok?                 @SC92126 05964200
  2022.          BR    2             Return indication                 @SC90264 05964500
  2023. DSKLKDD  BAL   9,DSKDEQ      Dequeue now                       @SC92126 05964530
  2024.          B     DSKLKNF       and say it's not there            @SC92126 05964560
  2025. DSKLKDO  CLC   FABCOMM,=CL8'VERIFY' Looking for input file?    @SC91269 05964600
  2026.          BE    DSKLKNF       Yes, say it's not there after all @SC91269 05964700
  2027.          B     DSKLKFND      No, admit it's there              @SC91269 05964800
  2028. * Handle internal file                                         @SC90264 05965000
  2029. DSKLKTK  KCALL KFLLKP,(3)                                      @SC90264 05965500
  2030.          ST    1,DSKSECPL    Ptr to KFS block                  @SC90264 05966000
  2031.          LTR   15,15                                           @SC90264 05966500
  2032.          BR    2                                               @SC90264 05967000
  2033. * Handle pipe (also called by other disk operations)           @SC90264 05967500
  2034. DSKLKPG  LA    8,FABFNAM     Point to pgm in FAB               @SC90264 05968000
  2035.          TM    FABFLGS,FABFPGM General pipe?                   @SC90264 05968500
  2036.          BO    *+8           Yes, use that                     @SC90264 05969000
  2037.           LA   8,=CL8'IKXDYNAL'                                @SC90264 05969500
  2038.          ICM   9,15,=A(KHOST)                                  @SC90264 05970000
  2039.          BZ    DSKLKPGX                                        @SC90264 05970500
  2040.          LR    14,8                                            @SC90264 05971000
  2041.          LR    15,3          String address                    @SC90264 05971500
  2042.          LA    0,DSKFABLN    Ptr to length                     @SC90264 05972000
  2043.          STM   14,0,DSKSECPL Set up calling sequence           @SC90264 05972500
  2044.          KCALL (9),DSKSECPL,EXT,E=0(,2)                        @SC90264 05973000
  2045. DSKLKPGX CLC   =CL8'IKXDYNAL',0(8)                             @SC90264 05973500
  2046.          BNE   DSKLKPGZ      General pipe                      @SC90264 05974000
  2047.          TM    DSKFL,PLOAD   Pgm loaded?                       @SC90264 05974500
  2048.          BO    DSKLKPGZ      Yes, we're all set                @SC90264 05975000
  2049.          OI    DSKFL,PLOAD   Mark pgm loaded                   @SC90264 05975500
  2050. DSKLKPGY EXEC CICS LOAD PROGRAM(0(,8)) NOHANDLE,               @SC90264 05976000
  2051. DSKLKPGZ EXEC CICS LINK PROGRAM(0(,8)) COMMAREA(0(,3)),        @SC90264+05976500
  2052.                LENGTH(DSKFABLN+2) NOHANDLE,                    @SC90264 05977000
  2053.          L     15,DFHEIBP    Set up to copy EIB code           @SC90264 05977500
  2054.          USING DFHEIBLK,15                                     @SC90264 05978000
  2055.          CLC   F0,EIBRCODE   Did the LINK work?                @SC90264 05978500
  2056.          BE    *+10          Yes                               @SC90264 05979000
  2057.           MVC  FABRESP,EIBRCODE  No, save error code           @SC90264 05979500
  2058.          DROP  15                                              @SC90264 05980000
  2059.          CLC   F0,FABRESP    Did the operation work?           @SC90264 05980500
  2060.          BR    2                                               @SC90264 05981000
  2061. *                                                                       05981500
  2062. * Set up search through list of files, pattern at (R1)                  05982000
  2063. DSKNSET  DS    0H                                              @SC89073 05982500
  2064.          MVC   NXDEST,0(1)                                     @SC90264 05983000
  2065.          TM    0(1),FABFTS+FABFTD TS and TD are in memory      @SC90264 05983500
  2066.          BNZ   DSKNSX        Go scan list                      @SC90264 05984000
  2067.          TM    0(1),FABFTAK                                    @SC90264 05984500
  2068.          BZ    DSKNSWLD      Not one of the types in memory    @SC90264 05985000
  2069.          CLC   CURFUID,1(1)  TAKE in memory only if current    @SC90264 05985500
  2070.          BE    DSKNSX        Yes, go scan list                 @SC90264 05986000
  2071. DSKNSWLD DS    0H                                              @SC90264 05986500
  2072.          MVI   TRTBL+C'%',1  Want to catch a percent           @SC86115 05987000
  2073.          MVI   TRTBL+C'*',1  Want to catch an asterisk         @SC86115 05987500
  2074.          TRT   LFUID+1(LFFNM,1),TRTBL  See if anything wild    @SC90264 05988000
  2075.          MVI   TRTBL+C'%',0  Restore TRTBL                     @SC86115 05988500
  2076.          MVI   TRTBL+C'*',0                                    @SC86115 05989000
  2077.          BZ    DSKNSX        No wild chars found, ok           @SC90264 05989500
  2078.          CLI   0(1),C' '     Did we just run off the end?      @SC90264 05990000
  2079.          BNE   RTRN1         Wild char.  Can't handle for TS   @SC90264 05990500
  2080. *                                                                       05991000
  2081. * Flush previous file pattern                                           05991500
  2082. DSKNSX   MVC   NXPTR,=X'80000000'                              @SC90264 05992000
  2083.          L     9,NXPTR2                                        @SC91150 05992500
  2084. DSKNSX1  LTR   9,9                                             @SC91150 05993000
  2085.          BZ    RTRN0         No more blocks                    @SC91150 05993500
  2086.          L     9,TSUTFC-DFHTSUT(,9)                            @SC91150 05994000
  2087.          L     6,NXPTR2      Free old fake block               @SC91150 05994500
  2088.          EXEC CICS FREEMAIN DATA(0(,6)),                       @SC91150 05995000
  2089.          ST    9,NXPTR2      Reset ptr to current block        @SC91150 05995500
  2090.          B     DSKNSX1                                         @SC91150 05996000
  2091. *                                                                       05996500
  2092. * Check CWD string, return code in R15                                  05997000
  2093. DSKCWDF  DS    0H                                              @SC89073 05997500
  2094.          LA    3,DSKSTT                                        @SC90264 05998000
  2095.          MVC   FABFID,0(1)   Copy as much as possible of string@SC90264 05998500
  2096.          MVC   FABCOMM,=CL8'CWD'                               @SC90264 05999000
  2097.          BAL   2,DSKVALID    Check if allowed                  @SC90264 05999500
  2098.          CLI   FABFID+2,C'''' DSN?                             @SC90264 06000000
  2099.          BE    RTRN0         Yes, it can be anything           @SC90264 06000500
  2100.          LA    0,LFUID       No, must be userid                @SC90264 06001000
  2101.          CLM   0,3,FABFID    Is it the right length?           @SC90264 06001500
  2102.          BL    RTRN1         Too long, reject it               @SC90264 06002000
  2103.          B     RTRN0         Ok                                @SC90264 06002500
  2104. *                                                                       06003000
  2105. * Check disk space for proposed file: FDB at (R1), FAB ptr at (R6)      06003500
  2106. DSKTSP   L     4,FDBSIZE-FDBD(,1)  Get actual size             @SC92024 06004000
  2107.          ICM   3,15,0(6)     Get FAB ptr                       @SC90037 06004500
  2108.          BZ    DSKTSPX       Not open yet                      @SC90037 06005000
  2109. DSKTSP0  DS    0H                                              @SC90037 06005500
  2110.          TM    FABFLGS,FABFTAK Internal file?                  @SC90264 06006000
  2111.          BZ    RTRN0         No, can't say how much room       @SC90264 06006500
  2112.          CLC   FABFUID,CURFUID Current directory?              @SC90264 06007000
  2113.          BNE   RTRN0         No, don't know about them         @SC90264 06007500
  2114.          CLC   FABFUID,SYSUID Global directory?                @SC90264 06008000
  2115.          BE    RTRN0         Yes, don't limit that             @SC90264 06008500
  2116.          L     1,LIMKFS      Total allowed                     @SC90264 06009000
  2117.          SL    1,USRTOTL     Amount already used               @SC90264 06009500
  2118.          SRL   1,10          Convert to Kbytes                 @SC86316 06010000
  2119.          CLR   1,4                                             @SC92024 06010500
  2120.          BL    RTRN1         No room                           @SC86316 06011000
  2121.          B     RTRN0         Ok                                @SC86316 06011500
  2122. DSKTSPX  MVC   DSKSTNM,0(2)  File not opened yet, look for it  @SC90037 06012000
  2123.          LA    3,DSKSTT      Point to temporary FAB            @SC90037 06012500
  2124.          MVC   FABCOMM,=CL8'TEST'                              @SC90264 06013000
  2125.          BAL   2,DSKLKP                                        @SC90037 06013500
  2126.          BNZ   DSKTSP0       Not found, nothing to erase       @SC90037 06014000
  2127.          MVC   FDBSIZE,F0    Clear out old size, if any        @SC90264 06014500
  2128.          BAL   14,DSKVALS    Compute size, if possible         @SC90264 06015000
  2129.          S     4,FDBSIZE     Assume old file will be erased    @SC92024 06015500
  2130.          BNP   RTRN0         Will release enough for new file  @SC90037 06016500
  2131.          B     DSKTSP0       Not enough, check free blocks     @SC90037 06017000
  2132. *                                                                       06017500
  2133. DSKNXT   DS    0H                                              @SC89073 06018000
  2134.          XC    DSKFDB,DSKFDB Clear out info                    @SC90264 06018500
  2135.          MVC   FILNAM,NXDEST Set up full fid                   @SC90264 06019000
  2136.          LA    1,NXDEST      Ptr to pattern with flags         @SC90264 06019500
  2137.          ST    1,DSKSECPL+4  Set up call to KHIDE              @SC90264 06020000
  2138.          L     9,NXPTR2      For TS chains                     @SC90264 06020500
  2139.          ICM   1,15,NXPTR    Current ptr                       @SC90264 06021000
  2140.          BP    NXFNEXT       Already started, get next         @SC90264 06021500
  2141.          BZ    RTRN1         Nothing else there                @SC90264 06022000
  2142.          MVI   NXPTR,0       Clear to 0, in case "other"       @SC90264 06022500
  2143.          NI    DSKFL,255-WFN Nothing wild yet                  @SC90264 06023000
  2144.          L     1,CSAPTR      Access CSA                        @SC90264 06023500
  2145. * Set up for scan of specific kind of file...                  @SC90264 06024000
  2146.          TM    NXDEST,FABFTS Is it a TS?                       @SC90264 06024500
  2147.          BZ    DSKNXTTD                                        @SC90264 06025000
  2148.          USING DFHTSUT,2                                       @SC91150 06025500
  2149.          L     2,CSATSMTA-DFHCSABA(,1)  Start of TS chain      @SC91150 06026000
  2150.          LA    9,NXPTR2+DFHTSUT-TSUTFC  Start of fake chain    @SC91150 06026500
  2151. DSKNXTS0 LH    6,TSUTCC                                        @SC91150 06027000
  2152.          LTR   6,6           Any entries in this block?        @SC91150 06027500
  2153.          BZ    DSKNXTS9      No                                @SC91150 06028000
  2154.          LA    1,TSUTELN     Length of each entry              @SC91150 06028500
  2155.          MR    0,6           Compute size needed               @SC91150 06029000
  2156.          LA    1,TSUTEBA-DFHTSUT(,1)  (including control offset@SC91150 06029500
  2157.          ST    1,GTMLEN                                        @SC91150 06030000
  2158.          EXEC CICS GETMAIN FLENGTH(GTMLEN) SET(1), Get block   @SC91150 06030500
  2159.          L     7,TSUTAHI     Start of real list                @SC91150 06031000
  2160.          DROP  2                                               @SC91150 06031500
  2161.          USING DFHTSUT,9                                       @SC91150 06032000
  2162.          ST    1,TSUTFC      Add fake block to fake chain      @SC91150 06032500
  2163.          LR    9,1           Now address new block             @SC91150 06033000
  2164.          XC    TSUTFC,TSUTFC Clear next forward ptr            @SC91150 06033500
  2165.          LA    1,TSUTEBA                                       @SC91150 06034000
  2166.          ST    1,TSUTAHI     Start of fake list                @SC91150 06034500
  2167.          STH   6,TSUTCC      Set number of entries             @SC91150 06035000
  2168. DSKNXTS1 MVC   0(TSUTELN,1),0(7)  Copy one entry from real list@SC91150 06035500
  2169.          ST    1,TSUTALI     Save as if last                   @SC91150 06036000
  2170.          LA    1,TSUTELN(,1)                                   @SC91150 06036500
  2171.          LA    7,TSUTELN(,7)                                   @SC91150 06037000
  2172.          BCT   6,DSKNXTS1    Keep copying until done           @SC91150 06037500
  2173.          DROP  9                                               @SC91150 06038000
  2174.          USING DFHTSUT,2                                       @SC91150 06038500
  2175. DSKNXTS9 L     2,TSUTFC      See if another block              @SC91150 06039000
  2176.          LTR   2,2                                             @SC91150 06039500
  2177.          BNZ   DSKNXTS0      Yes, copy it as well              @SC91150 06040000
  2178.          DROP  2                                               @SC91150 06040500
  2179.          LA    7,8-1         Length of TS name                 @SC90264 06041000
  2180. *        MVC   NXPTR2,CSATSMTA-DFHCSABA(1)   Temp storage table@SC91150 06041500
  2181.          B     DSKNXT1                                         @SC90264 06042000
  2182. DSKNXTTD TM    NXDEST,FABFTD Is it a TD?                       @SC90264 06042500
  2183.          BZ    DSKNXTTT      Other                             @SC90264 06043000
  2184.          LA    7,4-1                                           @SC90264 06043500
  2185.          MVC   NXPTR,CSADCTBA-DFHCSABA(1) Start of DCT table   @SC90264 06044000
  2186.          B     DSKNXT1                                         @SC90264 06044500
  2187. DSKNXTTT TM    NXDEST,FABFTAK Is it internal?                  @SC90264 06045000
  2188.          BZ    DSKNXTTO      Other                             @SC90264 06045500
  2189.          CLC   CURFUID,NXDEST+1 TAKE in memory only if current @SC90264 06046000
  2190.          BNE   DSKNXTTO      Not current, must look up         @SC90264 06046500
  2191.          LA    7,8-1                                           @SC91150 06047000
  2192.          MVC   NXPTR,PTRKFS  Start of internal chain           @SC90264 06047500
  2193. * Setup for scan: R7=length-1 of name field, NXPTR initialized @SC90264 06048000
  2194. DSKNXT1  LA    6,NXDNAM      Start of name per se              @SC90264 06048500
  2195.          LA    1,1(7,6)      End of field                      @SC90264 06049000
  2196.          EX    7,NXFWTR      Find first blank                  @SC90264 06049500
  2197.          SR    1,6           Compute length                    @SC86295 06050000
  2198.          ST    1,NXFFNL      Length of pattern                 @SC90264 06050500
  2199.          MVI   TRTBL+C' ',0  Don't want to catch a blank       @SC86115 06051000
  2200.          MVI   TRTBL+C'%',1  Want to catch a percent           @SC86115 06051500
  2201.          MVI   TRTBL+C'*',1  Want to catch an asterisk         @SC86115 06052000
  2202.          EX    7,NXFWTR      See if any % or * in name         @SC90264 06052500
  2203.          MVI   TRTBL+C'%',0  Restore TRTBL                     @SC86115 06053000
  2204.          MVI   TRTBL+C'*',0                                    @SC86115 06053500
  2205.          MVI   TRTBL+C' ',1                                    @SC86115 06054000
  2206.          BZ    *+8           No wild chars found               @SC86295 06054500
  2207.            OI  DSKFL,WFN                                       @SC86295 06055000
  2208.          L     1,NXPTR                                         @SC90264 06055500
  2209.          L     9,NXPTR2      For TS chains                     @SC90264 06056000
  2210. NXFNEXT  TM    NXDEST,FABFTS Is it a TS?                       @SC90264 06056500
  2211.          BO    NXFNXTS       Yes, follow chains                @SC90264 06057000
  2212.          TM    NXDEST,FABFTAK Is it internal?                  @SC90264 06057500
  2213.          BO    NXFNXTT       Yes, follow chains                @SC90264 06058000
  2214. * Advance to next TD block and setup R6,R7                     @SC90264 06058500
  2215.          LR    DCTCBAR,1     Point to next item                @SC90264 06059000
  2216.          CLI   TDDCTDID,255  Reached end?                      @SC90264 06059500
  2217.          BE    RTRN1         Yes, quit                         @SC90264 06060000
  2218.          ST    1,DSKSECPL    Ptr to DCT                        @SC90264 06060500
  2219.          AH    1,TDDCTELN    No match, keep at it              @NL90264 06061000
  2220.          LA    6,TDDCTDID    Start of field                    @SC90264 06061500
  2221.          LA    7,4-1         Length of field                   @SC90264 06062000
  2222.          B     NXFCHK        Now compare names                 @SC90264 06062500
  2223. * Advance to next internal file and setup R6,R7                @SC90264 06063000
  2224.          USING KFSBLK,9                                        @SC90264 06063500
  2225. NXFNXTT  LTR   9,1           Reached end?                      @SC90264 06064000
  2226.          BZ    RTRN1         Yes, quit                         @SC90264 06064500
  2227.          ST    1,DSKSECPL    Ptr to KFS block                  @SC90264 06065000
  2228.          L     1,KFSNEXT     Ptr to next one                   @NL90264 06065500
  2229.          LA    6,KFSFNAM     Start of field                    @SC90264 06066000
  2230.          LA    7,8-1         Length of field                   @SC90264 06066500
  2231. NXFCHK   ST    1,NXPTR       Save the ptr for the next         @SC90264 06067000
  2232.          STM   6,7,DSKCURN   Save ptr,len-1 of current name    @SC90264 06067500
  2233.          TM    DSKFL,WFN                                       @SC86295 06068000
  2234.          BO    NXFWF         Go if wild                        @SC86295 06068500
  2235.          CLC   0(,6),NXDNAM                                    @SC90264 06069000
  2236.          EX    7,*-6         Compare name                      @SC90264 06069500
  2237.          BNE   NXFNEXT       Keep trying                       @SC90264 06070000
  2238. NXFHAVE  LA    14,FILNAM+LFUID+1                               @SC90264 06070500
  2239.          LA    15,LFFNM      Length of name part               @SC90264 06071000
  2240.          LM    6,7,DSKCURN   Get ptr,len-1                     @SC90264 06071500
  2241.          LA    7,1(,7)       Convert to length                 @SC90264 06072000
  2242.          ICM   7,8,BLANK                                       @SC90264 06072500
  2243.          MVCL  14,6          Copy to FILNAM with blank padding @SC90264 06073000
  2244.          MVC   DSKSTNM,FILNAM                                  @SC90264 06073500
  2245.          LA    3,DSKSTT                                        @SC86295 06074000
  2246.          TM    FABFLGS,FABFTD TD queue?                        @SC91150 06074500
  2247.          BZ    NXFHVAL       No, we're fine                    @SC91150 06075000
  2248.          TM    TDDCTDT,TDEXTRBM EXTRA?                         @SC91150 06075500
  2249.          BZ    NXFHVAL       No, we're fine                    @SC91150 06076000
  2250.          L     15,TDDCTSDS   Ptr to SDSCI                      @SC91150 06076500
  2251.          USING DCTSDSCI,15                                     @SC91150 06077000
  2252.          MVC   FDBXRCF,DCTSDSRF RECFM from extra TD            @SC91150 06077500
  2253.          MVC   FDBXLRC,DCTSDSRL LRECL                          @SC91150 06078000
  2254.          MVC   FDBXBLK,DCTSDSBL BLKSI                          @SC91150 06078500
  2255.          DROP  15                                              @SC91150 06079000
  2256. NXFHVAL  DS    0H                                              @SC91150 06079500
  2257.          BAL   14,DSKVALS    Copy out quantities               @SC86295 06080000
  2258.          B     RTRN0                                           @SC86295 06080500
  2259. DSKNXTTO MVC   DSKSTNM,FILNAM Other types: just do one         @SC90264 06081000
  2260.          LA    3,DSKSTT                                        @SC86295 06081500
  2261.          MVC   FABCOMM,=CL8'VERIFY'                            @SC91269 06082000
  2262.          BAL   2,DSKLKP      Can't scan blocks, must look up   @SC90264 06082500
  2263.          BNZ   RTRN1         File not found                    @SC90264 06083000
  2264.          BAL   14,DSKVALS    Copy out quantities               @SC86295 06083500
  2265.          B     RTRN0                                           @SC86295 06084000
  2266. * Advance to next TS block and setup R6,R7                     @SC90264 06084500
  2267.          USING DFHTSUT,9                                       @SC90264 06085000
  2268.          USING DFHTSUTE,1                                      @SC90264 06085500
  2269. NXFNXTS  LTR   1,1                                             @SC90264 06086000
  2270.          BNP   NXFNXTSL                                        @SC90264 06086500
  2271.          C     1,TSUTALI     Any more on chain?                @SC90264 06087000
  2272.          BNL   NXFNXTSN                                        @SC90264 06087500
  2273.          LA    1,TSUTELN(,1) Check next entry                  @SC90264 06088000
  2274. NXFNXTS1 TM    TSUTETC,TSUTEGID  Is group id bit on?           @ML90264 06088500
  2275.          BZ    NXFNXTS       No, skip this one                 @SC90264 06089000
  2276.          LA    6,TSUTEID                                       @SC90264 06089500
  2277.          LA    7,8-1                                           @SC90264 06090000
  2278.          ST    1,DSKSECPL    Ptr to TSUTE                      @SC90264 06090500
  2279.          B     NXFCHK                                          @SC90264 06091000
  2280. NXFNXTSN L     9,TSUTFC                                        @SC90264 06091500
  2281.          L     6,NXPTR2      Free old fake block               @SC91150 06092000
  2282.          EXEC CICS FREEMAIN DATA(0(,6)),                       @SC91150 06092500
  2283.          ST    9,NXPTR2                                        @SC90264 06093000
  2284. NXFNXTSL MVC   NXPTR,F0                                        @SC90264 06093500
  2285.          LTR   9,9                                             @SC90264 06094000
  2286.          BZ    RTRN1         Not found                         @SC90264 06094500
  2287.          CLC   TSUTCC,F0     Test for no entries               @SC90264 06095000
  2288.          BE    NXFNXTSN                                        @SC90264 06095500
  2289.          L     1,TSUTAHI     First on chain                    @SC90264 06096000
  2290.          B     NXFNXTS1                                        @SC90264 06096500
  2291.          DROP  1,9                                             @SC90264 06097000
  2292. *                                                                       06097500
  2293. NXFWTR   TRT   0(,6),TRTBL   Look for first blank              @SC90264 06098000
  2294. NXFWF    ICM   15,15,=A(KHIDE)  Check for secret names?        @SC90264 06098500
  2295.          BZ    NXFWF2        Not needed                        @SC90264 06099000
  2296.          KCALL (15),DSKSECPL,EXT See if it's allowed           @SC90264 06099500
  2297.          L     1,NXPTR       Restore R1                        @SC90264 06100000
  2298.          BNZ   NXFNEXT       Skip it if not                    @SC90264 06100500
  2299. NXFWF2   LA    1,1(7,6)      End of field                      @SC90264 06101000
  2300.          EX    7,NXFWTR      Find first blank                  @SC90264 06101500
  2301.          SR    1,6           Compute length                    @SC86295 06102000
  2302.          LR    7,1           Save length                       @SC86295 06102500
  2303.          LA    14,NXDNAM     Start of name per se              @SC90264 06103000
  2304.          L     15,NXFFNL     Length of pattern                 @SC90264 06103500
  2305.          L     1,NXPTR       Restore ptr to next block         @SC90264 06104000
  2306. *                                                                       06104500
  2307. * Enter here: R14,R15 contain the pattern address and length   @SC90264 06105000
  2308. *              and R6,R7 the source address and length         @SC90264 06105500
  2309. *  No other registers are used                                 @SC90264 06106000
  2310.          NI    DSKFL,255-WARB Haven't seen any of these        @SC86295 06106500
  2311.          ICM   7,8,=C'*'     Use * as the fill char                     06107000
  2312. WLDLOOP  CLCL  14,6          Compare them                      @SC90264 06107500
  2313.          BE    NXFHAVE       They're equal, fine               @SC86295 06108000
  2314. *                                                                       06108500
  2315. * String mismatch - so examine offending pattern character.  If not     06109000
  2316. * % or * and we haven't seen any * yet, we fail.  If it's % we just     06109500
  2317. * skip it; if it's * we skip it and remember we've seen it.  Else       06110000
  2318. * back up to one past the last * and try again.                         06110500
  2319.          CLI   0(14),C'%'                                      @SC90264 06111000
  2320.          BE    WLDLEN1       Go if % = LEN(1) pattern                   06111500
  2321.          CLI   0(14),C'*'                                      @SC90264 06112000
  2322.          BE    WLDARB        Go if * = ARB pattern                      06112500
  2323.          TM    DSKFL,WARB                                      @SC86295 06113000
  2324.          BZ    NXFNEXT       Go if ARB already seen            @SC86295 06113500
  2325.          CLM   7,7,F0        More data to compare?                      06114000
  2326.          BE    NXFNEXT       Go if exhausted                   @SC86295 06114500
  2327.          LM    14,15,WLDPAT  Restore addr of old ARB char      @SC90264 06115000
  2328.          LM    6,7,WLDSRC    Restore source addr too           @SC90264 06115500
  2329.          LA    6,1(,6)       Push one past                     @SC90264 06116000
  2330.          BCTR  7,0           Decrement length                           06116500
  2331.          STM   6,7,WLDSRC    Store changed addr                         06117000
  2332.          B     WLDLOOP       And go compare again.                      06117500
  2333. *                                                                       06118000
  2334. WLDLEN1  LA    14,1(,14)     Increment pattern addr            @SC90264 06118500
  2335.          BCTR  15,0          Decrement pattern len             @SC90264 06119000
  2336.          CLM   7,7,F0        Length to compare more            @SC86119 06119500
  2337.          BE    NXFNEXT       None, pattern '%' is extra        @SC86119 06120000
  2338.          LA    6,1(,6)       Increment source addr             @SC90264 06120500
  2339.          BCTR  7,0           Decrement source len                       06121000
  2340.          CLM   7,7,F0        Length to compare more            @SC86119 06121500
  2341.          BNE   WLDLOOP       Go if more data                            06122000
  2342.          LTR   15,15         Anything more in pattern?         @SC90264 06122500
  2343.          BZ    NXFHAVE       No, it's a match                  @SC86295 06123000
  2344.          CLI   0(14),C'*'                                      @SC90264 06123500
  2345.          BE    WLDLOOP       Go if ARB                                  06124000
  2346.          B     NXFNEXT       Failed                            @SC86295 06124500
  2347. *                                                                       06125000
  2348. * If pattern ends in ARB, then it will match anything.  So return to    06125500
  2349. * caller if the pattern is exhausted.                                   06126000
  2350. WLDARB   OI    DSKFL,WARB    Remember we saw one               @SC86295 06126500
  2351.          LA    14,1(,14)     Pass the ARB                      @SC90264 06127000
  2352.          BCTR  15,0          Decrement its length              @SC90264 06127500
  2353.          LTR   15,15         Any more left?                    @SC90264 06128000
  2354.          BZ    NXFHAVE       No, it's a match                  @SC86295 06128500
  2355.          STM   14,15,WLDPAT  Save pattern ptrs                 @SC90264 06129000
  2356.          STM   6,7,WLDSRC    Save source ptrs                  @SC90264 06129500
  2357.          B     WLDLOOP                                                  06130000
  2358. *                                                                       06130500
  2359. *  Fill in FDB from DCT or TSUTE or KFSBLK (ptr in DSKSECPL)   @SC90264 06131000
  2360. *  Clobbers 0,1,2,6,7,8,15.  Returns via 14.  (note DCTCBAR=8) @SC90264 06131500
  2361. DSKVALS  LA    0,FDBD        Ptr to FDB                        @SC86295 06132000
  2362.          RETREG (1,0)        Return (0) as R1 to caller        @SC89218 06132500
  2363.          MVI   FDBRCF,C'V'   Usually V                         @SC90264 06133000
  2364.          L     1,FDBBSIZ     Use max length by default         @SC90264 06133500
  2365.          TM    FABFLGS,FABFTS                                  @SC90264 06134000
  2366.          BZ    DSKVLTT       Not temp stor                     @SC90264 06134500
  2367.          L     15,DSKSECPL   Ptr to TSUTE                      @SC90264 06135000
  2368.          USING DFHTSUTE,15                                     @SC90264 06135500
  2369.          MVC   TMPDW+7(1),TSUTETC Save flags                   @SC90264 06136000
  2370.          L     15,TSUTEPTR   Ptr to TSGID                      @SC90264 06136500
  2371.          USING DFHTSGID,15                                     @SC90264 06137000
  2372.          MVC   FDBNREC,TSGIDTR Grab record count               @SC90264 06137500
  2373.          TM    TMPDW+7,TSUTEASI+TSUTEVSI                       @SC90264 06138000
  2374.          BZ    DSKVLR        Neither main nor aux?             @SC90264 06138500
  2375.          SR    0,0                                             @SC90264 06139000
  2376.          ST    0,TMPDW                                         @SC90264 06139500
  2377.          SR    6,6           Clear tentative LRECL             @SC91150 06140000
  2378. DSKVLSLP LH    2,KTSGIDNE    Number of entries/block           @SC91150 06140500
  2379.          LA    7,TSGIDEBA    Start of record ptrs              @SC90264 06141000
  2380. DSKVLSLQ MVC   TMPDW+3(1),3(7) Copy segment count              @SC90264 06141500
  2381.          TM    TMPDW+7,TSUTEASI AUX?                           @SC90264 06142000
  2382.          BO    DSKVLSA       Yes, use segment count            @SC90264 06142500
  2383.          TM    0(7),X'7F'    No.  Above the 16M line?          @SC91150 06143000
  2384.          BNZ   DSKVLR        Yes, can't calculate              @SC91150 06143500
  2385.          ICM   8,7,1(7)      Ok, get ptr to record block       @SC91150 06144000
  2386.          BZ    DSKVLSB       No more ptrs, just round off      @SC91150 06144500
  2387.          MVC   TMPDW+2(2),20(8) Grab length of record          @SC91150 06145000
  2388. DSKVLSA  A     0,TMPDW       Accumulate total in R0            @SC90264 06145500
  2389.          C     6,TMPDW       Get maximum record size           @SC91150 06146000
  2390.          BNL   *+8                                             @SC91150 06146500
  2391.           L    6,TMPDW       New maximum                       @SC91150 06147000
  2392.          LA    7,4(,7)                                         @SC90264 06147500
  2393.          BCT   2,DSKVLSLQ                                      @SC90264 06148000
  2394.          ICM   15,15,TSGIDFC Next group of records             @SC90264 06148500
  2395.          BNZ   DSKVLSLP                                        @SC90264 06149000
  2396.          TM    TMPDW+7,TSUTEASI AUX?                           @SC90264 06149500
  2397.          BZ    DSKVLSB       No, use byte count as is          @SC90264 06150000
  2398.          IC    15,KTSBPSEG   Log(seg size)                     @SC91150 06150500
  2399.          SLL   0,0(15)       Convert segments to bytes         @SC90264 06151000
  2400.          SLL   6,0(15)       Ditto for max record length       @SC91150 06151500
  2401. DSKVLSB  AL    0,=F'512'     Round up                          @SC90264 06152000
  2402.          SRL   0,10          Convert to Kbytes                 @SC90264 06152500
  2403.          ST    0,FDBSIZE                                       @SC90264 06153000
  2404.          LR    1,6           Use observed max length for LRECL @SC91150 06153500
  2405.          B     DSKVLR                                          @SC90264 06154000
  2406. DSKVLTT  TM    FABFLGS,FABFTAK                                 @SC90264 06154500
  2407.          BZ    DSKVLTD       Not internal file                 @SC90264 06155000
  2408.          L     15,DSKSECPL   Ptr to KFSBLK                     @SC90264 06155500
  2409.          USING KFSBLK,15                                       @SC90264 06156000
  2410.          LH    1,KFSLRC      Use actual LRECL                  @SC90264 06156500
  2411.          MVC   FDBNREC,KFSNREC Grab record count               @SC90264 06157000
  2412.          MVC   FDBDATE,KFSDATE Copy date/time                  @SC90264 06157500
  2413.          L     0,KFSSIZE     Get file size in bytes            @SC90264 06158000
  2414.          AL    0,=F'512'     Round up                          @SC90264 06158500
  2415.          SRL   0,10          Convert to Kbytes                 @SC90264 06159000
  2416.          ST    0,FDBSIZE     Copy to FDB                       @SC90264 06159500
  2417.          B     DSKVLR                                          @SC90264 06160000
  2418.          DROP  15                                              @SC91150 06160500
  2419. DSKVLTD  DS    0H                                              @SC90264 06161000
  2420.          TM    FABFLGS,FABFSPL                                 @SC90264 06161500
  2421.          BO    DSKVLTX2      Spool file, use FDBX info         @SC90264 06162000
  2422.          TM    FABFLGS,FABFTD                                  @SC90264 06162500
  2423.          BZ    DSKVLR        Other                             @SC90264 06163000
  2424.          L     DCTCBAR,DSKSECPL  Ptr to info                   @SC90264 06163500
  2425.          MVC   FDBFL2,TDDCTDT  Copy flags                      @SC90264 06164000
  2426.          XC    FDBSIZE,FDBSIZE Clear size (unknown)            @SC90264 06164500
  2427.          TM    FDBFL2,TDINDTBM  Intra?                         @SC90264 06165000
  2428.          BZ    DSKVLTX       No, see if Extra                  @SC90264 06165500
  2429.          MVC   FDBNREC,TDDCTTQC+2 Yes, grab record count       @SC91150 06166000
  2430.          B     DSKVLR        Ok, we're done                    @SC90264 06166500
  2431. DSKVLTX  DS    0H                                              @SC90264 06167000
  2432.          TM    FDBFL2,TDEXTRBM  Extra?                         @SC90264 06167500
  2433.          BNO   DSKVLR        No                                @SC90264 06168000
  2434. DSKVLTX2 MVI   FDBRCF,C'U'                                     @SC86299 06168500
  2435.          LH    1,FDBXBLK     Use BLKSI if U                    @SC90264 06169000
  2436.          TM    FDBXRCF,X'C0'                                   @SC90264 06169500
  2437.          BO    DSKVLR                                          @SC86299 06170000
  2438.          LH    1,FDBXLRC     Use LRECL if F or V               @SC90264 06170500
  2439.          LTR   1,1           Make sure it's defined            @SC91150 06171000
  2440.          BP    *+8           Yes, ok                           @SC91150 06171500
  2441.           LH   1,FDBLRC      No, keep old LRECL                @SC91150 06172000
  2442.          MVI   FDBRCF,C'F'                                     @SC86299 06172500
  2443.          TM    FDBXRCF,X'80'                                   @SC90264 06173000
  2444.          BO    DSKVLR                                          @SC86299 06173500
  2445.          MVI   FDBRCF,C'V'                                     @SC86299 06174000
  2446. DSKVLR   STH   1,FDBLRC                                        @SC86299 06174500
  2447.          L     7,4(13)       Get previous stack frame          @SC88048 06175000
  2448.          L     1,4(7)        and the one before                @SC88076 06175500
  2449.          CLC   =A(SERVER),16(1) Was the caller SERVER?         @SC89215 06176000
  2450.          BE    *+12          Yes, ok                           @SC88076 06176500
  2451.           CLC  =A(USNTRF),16(1) No, was it USNTRF?             @SC89215 06177000
  2452.           BNER 14            No, don't bother checking TAKE's  @SC88076 06177500
  2453.          USING SERVERSV,7    Assume SERVER or USNTRF           @SC88048 06178000
  2454.          ICM   0,15,TAKLEV   Any TAKE files open?              @SC88048 06178500
  2455.          BNPR  14            No, that's fine                   @SC88048 06179000
  2456.          CH    0,=Y(TAKMAX)  Be sure this is valid             @SC88048 06179500
  2457.          BNLR  14            Oops, give up                     @SC88048 06180000
  2458. DSKVACT  LR    6,0                                             @SC88048 06180500
  2459.          SLA   6,2                                             @SC88048 06181000
  2460.          L     6,TAKTAB-4(6) Fetch a file ticket               @SC88048 06181500
  2461.          CLC   FABFID,FABFID-FABD(6) Does the name match?      @SC88048 06182000
  2462.          BE    DSKVACS       Yes, this file is in use          @SC88048 06182500
  2463.          BCT   0,DSKVACT     No, keep looking                  @SC88048 06183000
  2464.          BR    14            No match, that's ok               @SC88048 06183500
  2465. DSKVACS  OI    FDBFLGS,FDBACTV Yes, turn on flag               @SC88048 06184000
  2466.          BR    14                                              @SC86295 06184500
  2467.          DROP  7                                               @SC91150 06185000
  2468. *                                                                       06185500
  2469.          DROP  3,5,DCTCBAR                                     @SC91150 06186000
  2470. *                                                                       06186500
  2471. DSKFABLN DC    A(FABDWDS*8)  Length of FAB                     @SC90264 06187000
  2472.          LOCALS ,                                              @SC86295 06187500
  2473. DSKEMTS  DS    0CL15'SET Q(    ) CLO'                          @ML90264 06188000
  2474. WLDPAT   DS    A             Place in pattern of last ARB               06188500
  2475.          DS    F             Length of pattern past ARB                 06189000
  2476. WLDSRC   DS    A             Place in source when ARB seen              06189500
  2477.          DS    F             Length of source past WLDSRC               06190000
  2478. DSKCPPTR DS    0A            Ticket for COPY output            @SC90264 06190500
  2479. NUMPAT   DS    CL8           Work area for sequence numbers    @SC90264 06191000
  2480. DSKSECPL DS    3A            Plist for KHIDE or KHOST          @SC90264 06191500
  2481. DSKCURN  DS    2F            Saved ptrs during DIR scan        @SC90264 06192000
  2482. DSKENQCT DS    H             Count of seconds allowed to wait  @SC92126 06192200
  2483. DSKCOD   DS    X             Saved DISKIO function code        @SC90264 06192500
  2484. DSKQUE   DS    CL4,C'.TD'    ENQ resource name                 @SC92126 06192700
  2485. *                                                                       06193000
  2486.          EXIT                                                           06193500
  2487.          TITLE 'KFILIO Routine - performs disk I/O functions'  @SC90264 06194000
  2488. * ERRNUM unchanged unless there is a disk error.               @SC90264 06194500
  2489. * Function selected on entry by FABCOMM (pointed to by R1)     @SC90264 06195000
  2490. KFILIO   ENTER ,                                               @SC90264 06195500
  2491.          USING FABD,3                                          @SC90264 06196000
  2492.          USING KFSBLK,4                                        @SC90264 06196500
  2493.          USING DFHEIBLK,8                                      @SC90264 06197000
  2494.          L     8,DFHEIBP     Get addressability                @SC90264 06197500
  2495.          LR    3,1                                             @SC90264 06198000
  2496.          XC    FABRESP,FABRESP Clear error code                @SC90264 06198500
  2497.          LH    1,FABRN       Convert rec no for key            @SC90264 06199000
  2498.          CVD   1,KFLDW                                         @SC90264 06199500
  2499.          OI    KFLDW+7,15                                      @SC90264 06200000
  2500.          UNPK  KFLRN,KFLDW                                     @SC90264 06200500
  2501.          MVC   KFLFUID(LFUID+LFFNM),FABFUID Copy name for key  @SC90264 06201000
  2502.          LM    6,7,FDBBUFF   Adr and len of buffer             @SC90264 06201500
  2503.          STH   7,FABNORD     Set up for read/write             @SC90264 06202000
  2504.          L     4,FABUWORD    Ptr to KFSBLK                     @SC90264 06202500
  2505. * Read a record                                                @SC90264 06203000
  2506.          CLC   =C'READ',FABCOMM                                @SC90264 06203500
  2507.          BNE   KFLWRT                                          @SC90264 06204000
  2508.          EXEC CICS READ DATASET(KFILE) RIDFLD(KFLFUID),        @SC90264+06204500
  2509.                INTO(0(,6)) LENGTH(FABNORD) NOHANDLE,           @SC90264 06205000
  2510.          CLC   F0,EIBRCODE   Any error?                        @SC90264 06205500
  2511.          BNE   KFLRDX        Yes, note it                      @SC90264 06206000
  2512.          LA    1,LFKEY       Length of key                     @SC90264 06206500
  2513.          LH    7,FABNORD     Actual read length                @SC90264 06207000
  2514.          SR    7,1           Deduct                            @SC90264 06207500
  2515.          STH   7,FABNORD     Data length                       @SC90264 06208000
  2516.          LA    0,0(1,6)      Start of real data                @SC90264 06208500
  2517.          LR    1,7                                             @SC90264 06209000
  2518.          MVCL  6,0           Move everything back              @SC90264 06209500
  2519.          B     RTRN0                                           @SC90264 06210000
  2520. KFLRDX   MVC   FABRESP,EIBRCODE                                @SC90264 06210500
  2521.          B     RTRN1                                           @SC90264 06211000
  2522. * Write a record                                               @SC90264 06211500
  2523. KFLWRT   CLC   =C'WRITE',FABCOMM                               @SC90264 06212000
  2524.          BNE   KFLDEL                                          @SC90264 06212500
  2525.          LR    0,7           Length of record                  @SC90264 06213000
  2526.          AL    0,KFSSIZE     Accumulate file size              @SC90264 06213500
  2527.          BC    12,*+8                                          @SC90264 06214000
  2528.           SR   0,0                                             @SC90264 06214500
  2529.           BCTR 0,0           Set to max if carry               @SC90264 06215000
  2530.          ST    0,KFSSIZE     New size                          @SC90264 06215500
  2531.          CH    7,KFSLRC      Check for max lrecl               @SC90264 06216000
  2532.          BNH   *+8                                             @SC90264 06216500
  2533.           STH  7,KFSLRC      New max lrecl                     @SC90264 06217000
  2534. *------------------------- Quota checking ------------         @SC90264 06217500
  2535.          CLC   FABFUID,CURFUID Current userid?                 @SC90264 06218000
  2536.          BNE   KFLWRT1       No, assume it's ok                @SC90264 06218500
  2537.          CLC   FABFUID,SYSUID Global directory?                @SC90264 06219000
  2538.          BE    KFLWRT1       Yes, never limit that             @SC90264 06219500
  2539.          AL    0,USRTOTL     Get new total assuming success    @SC90264 06220000
  2540.          BC    3,KFLWRX      Way too big                       @SC90264 06220500
  2541.          CL    0,CUTKFS      See if over cutoff limit          @SC90264 06221000
  2542.          BC    3,KFLWRX      Yes, too big                      @SC90264 06221500
  2543. *-------------------------                                     @SC90264 06222000
  2544. KFLWRT1  LA    1,LFKEY       Length of key                     @SC90264 06222500
  2545.          AR    7,1                                             @SC90264 06223000
  2546.          STH   7,FABNORD     Increase length                   @SC90264 06223500
  2547.          SR    6,1           And back up start of buffer       @SC90264 06224000
  2548.          MVC   0(LFKEY,6),KFLFUID Copy key into data buffer    @SC90264 06224500
  2549. KFLWRT2  EXEC CICS WRITE DATASET(KFILE) RIDFLD(KFLFUID),       @SC90264+06225000
  2550.                FROM(0(,6)) LENGTH(FABNORD) NOHANDLE,           @SC90264 06225500
  2551.          CLC   F0,EIBRCODE   Any error?                        @SC90264 06226000
  2552.          BE    RTRN0                                           @SC90264 06226500
  2553.          MVC   FABRESP,EIBRCODE                                @SC90264 06227000
  2554.          B     RTRN1                                           @SC90264 06227500
  2555. *                                                                       06228000
  2556. KFLWRX   MVI   FABRESP,X'83' Say it was NOSPACE                @SC90264 06228500
  2557.          B     RTRN1                                           @SC90264 06229000
  2558. * Delete a file                                                @SC90264 06229500
  2559. KFLDEL   CLC   =C'DELETE',FABCOMM                              @SC90264 06230000
  2560.          BNE   KFLCLO                                          @SC90264 06230500
  2561.          MVC   FABUWORD,F0   Will no longer have KFSBLK        @SC90264 06231000
  2562.          ICM   4,15,TMPBLK   Check saved temporary             @SC91150 06231500
  2563.          BZ    KFLDEL0       None set                          @SC91150 06232000
  2564.          CLC   FABFUID(LFUID+LFFNM),KFSFUID Are we killing it? @SC91150 06232500
  2565.          BNE   KFLDEL0       No, fine                          @SC91150 06233000
  2566.          MVI   KFSFUID,0     Yes, disable that block           @SC91150 06233500
  2567. KFLDEL0  DS    0H                                              @SC91150 06234000
  2568.          CLC   FABFUID,CURFUID Current directory?              @SC90264 06234500
  2569.          BNE   KFLDEL1       No, skip bookkeeping              @SC90264 06235000
  2570.          KCALL KFLLKP,(3),E=RTRN1 Find KFS block               @SC90264 06235500
  2571.          LR    4,1           Get ptr for addressability        @SC90264 06236000
  2572.          MVC   FABUWORD,F0   Will no longer have KFSBLK        @SC91150 06236500
  2573.          L     0,USRTOTL     Reduce storage total              @SC90264 06237000
  2574.          SL    0,KFSSIZE     By amount used in this file       @SC90264 06237500
  2575.          BC    3,*+6                                           @SC91150 06238000
  2576.           SLR  0,0                                             @SC90264 06238500
  2577.          ST    0,USRTOTL                                       @SC90264 06239000
  2578.          LM    6,7,KFSNEXT   Load ptrs to next and previous    @SC90264 06239500
  2579.          MVC   KFSNEXT,PTRFRE Link to free chain               @SC90264 06240000
  2580.          ST    4,PTRFRE                                        @SC90264 06240500
  2581.          ST    6,KFSNEXT-KFSBLK(,7) Skip over forward ptrs     @SC90264 06241000
  2582.          LTR   4,6           End of chain?                     @SC90264 06241500
  2583.          BZ    *+8           Yes, just unlink this one         @SC90264 06242000
  2584.           ST   7,KFSPREV     No, reattach rest of chain        @SC90264 06242500
  2585. KFLDEL1  EXEC CICS DELETE DATASET(KFILE) RIDFLD(FABFUID),      @SC90264+06243000
  2586.                KEYLENGTH(=Y(LFUID+LFFNM)) GENERIC NOHANDLE,    @SC90264 06243500
  2587.          CLC   F0,EIBRCODE   Any error?                        @SC90264 06244000
  2588.          BE    RTRN0                                           @SC90264 06244500
  2589.          B     RTRN1                                           @SC90264 06245000
  2590. * Close a file                                                 @SC90264 06245500
  2591. KFLCLO   CLC   =C'CLOSE',FABCOMM                               @SC90264 06246000
  2592.          BNE   KFLOPO                                          @SC90264 06246500
  2593.          TM    FABIOF,1      Output file?                      @SC90264 06247000
  2594.          BZ    RTRN0         No, nothing to do                 @SC90264 06247500
  2595.          CLC   FABFUID,CURFUID Current userid?                 @SC91150 06248000
  2596.          BNE   KFLCLO1       No, continue                      @SC91150 06248500
  2597.          L     0,KFSSIZE     Yes, accumulate size              @SC91150 06249000
  2598.          AL    0,USRTOTL      of current directory             @SC91150 06249500
  2599.          ST    0,USRTOTL                                       @SC91150 06250000
  2600. KFLCLO1  DS    0H                                              @SC91150 06250500
  2601.          EXEC CICS ASKTIME,                                    @SC90264 06251000
  2602.          MVC   KFSDATE+1(1),EIBDATE+1 Copy year                @SC90264 06251500
  2603.          ZAP   TMPDW,EIBDATE+2(2)                              @SC90264 06252000
  2604.          CVB   7,TMPDW       Get day-of-year in binary         @SC90264 06252500
  2605.          MVC   KFLMNTH,=AL1(30,31,30,31,31,30,31,30,31,28,31)  @SC86299 06253000
  2606.          TM    EIBDATE+1,1   Check for leap year               @SC90264 06253500
  2607.          BNZ   KFLVNLP       Not                               @SC90264 06254000
  2608.          TM    EIBDATE+1,X'12'                                 @SC90264 06254500
  2609.          BM    KFLVNLP       Not                               @SC92114 06255000
  2610.          MVI   KFLMNTH+9,29  Leap year, change Feb.            @SC86299 06255500
  2611. KFLVNLP  LA    6,11                                            @SC86299 06256000
  2612.          SR    0,0                                             @SC86299 06256500
  2613. KFLVMDL  IC    0,KFLMNTH-1(6)                                  @SC86299 06257000
  2614.          SR    7,0           Test if passed the right month    @SC86299 06257500
  2615.          BNP   KFLVMDM       Got it                            @SC86299 06258000
  2616.          BCT   6,KFLVMDL                                       @SC86299 06258500
  2617.          SR    0,0           Hit December                      @SC86299 06259000
  2618. KFLVMDM  AR    7,0           Get day of month                  @SC86299 06259500
  2619.          LCR   6,6                                             @SC86299 06260000
  2620.          LA    6,12(6)       Get month                         @SC86299 06260500
  2621.          MH    6,=H'100'                                       @SC86299 06261000
  2622.          AR    6,7           Combine MMDD                      @SC86299 06261500
  2623.          MH    6,=H'10'                                        @SC86299 06262000
  2624.          CVD   6,TMPDW                                         @SC86299 06262500
  2625.          MVC   KFSDATE+2(2),TMPDW+5                            @SC86299 06263000
  2626.          MVI   KFSDATE,X'19' Assume 20th Cent                  @SC86295 06263500
  2627.          CLI   KFSDATE+1,X'50'                                 @SC86295 06264000
  2628.          BH    *+8           Ok                                @SC86295 06264500
  2629.          MVI   KFSDATE,X'20' Must be 21st                      @SC86295 06265000
  2630.          MVO   TMPDW,EIBTIME Get time from 0hhmmss+            @SC91150 06265500
  2631.          MVC   KFSDATE+4(3),TMPDW+4  Copy just hhmmss          @SC91150 06266000
  2632.          MVC   KFSNREC,FABRN Save number of records            @SC90264 06266500
  2633.          MVC   KFLRN,=5C'0'  Clear for key                     @SC90264 06267000
  2634.          EXEC CICS DELETE DATASET(KFILE) RIDFLD(KFLFUID),      @SC91150+06267500
  2635.                NOHANDLE,     Remove previous directory block   @SC91150 06268000
  2636.          UNPK  KFLFDAT(15),KFSDAT(8)                           @SC90264 06268500
  2637.          UNPK  KFLFDAT+14(15),KFSDAT+7(8)                      @SC90264 06269000
  2638.          UNPK  KFLFDAT+28(3),KFSDAT+14(2)                      @SC90264 06269500
  2639. * - - - - - - Extend these UNPK instrs if KFSLEN grows         @SC90264 06270000
  2640.          TR    KFLFDAT(2*KFSLEN),KFLHEXY-C'0'                  @SC90264 06270500
  2641.          LA    6,KFLFUID                                       @SC90264 06271000
  2642.          MVC   FABNORD,=Y(KFSLEN*2+LFKEY)                      @SC90264 06271500
  2643.          B     KFLWRT2       Write new dir block out           @SC90264 06272000
  2644. * Open a file for output                                       @SC90264 06272500
  2645. KFLOPO   CLC   =C'OPEN O',FABCOMM                              @SC90264 06273000
  2646.          BNE   KFLOPI                                          @SC90264 06273500
  2647. *------------------------- Quota checking ------------         @SC90264 06274000
  2648.          CLC   FABFUID,CURFUID Current userid?                 @SC90264 06274500
  2649.          BNE   KFLOPO1       No, assume it's ok                @SC90264 06275000
  2650.          CLC   FABFUID,SYSUID Global directory?                @SC90264 06275500
  2651.          BE    KFLOPO1       Yes, never limit that             @SC90264 06276000
  2652.          CLC   USRTOTL,LIMKFS See if over quota                @SC90264 06276500
  2653.          BNL   RTRN1         Yes, quit                         @SC90264 06277000
  2654. *-------------------------                                     @SC90264 06277500
  2655. KFLOPO1  LTR   4,4           Does it exist?                    @SC90264 06278000
  2656.          BZ    KFLOPO2       Not there, must create new block  @SC90264 06278500
  2657.          MVC   FABRN,KFSNREC If it's there, we append          @SC90264 06279000
  2658.          L     0,USRTOTL                                       @SC90264 06279500
  2659.          SL    0,KFSSIZE     ... but don't count twice in total@SC90264 06280000
  2660.          ST    0,USRTOTL                                       @SC90264 06280500
  2661.          B     RTRN0                                           @SC90264 06281000
  2662. KFLOPO2  L     4,TMPBLK      Ptr to block if not current dir.  @SC90264 06281500
  2663.          CLC   FABFUID,CURFUID Current?                        @SC90264 06282000
  2664.          BNE   KFLOPO3       No, just set it up                @SC90264 06282500
  2665.          LA    4,PTRKFS      Yes, start through chain          @SC90264 06283000
  2666. KFLOLP   LR    6,4           Save ptr to this block            @SC90264 06283500
  2667.          ICM   4,15,KFSNEXT  Get ptr to next block             @SC90264 06284000
  2668.          BZ    KFLONEW       Hit end, file not found           @SC90264 06284500
  2669.          CLC   FABFNAM,KFSFNAM Match?                          @SC90264 06285000
  2670.          BH    KFLOLP        No, keep looking                  @SC90264 06285500
  2671. KFLONEW  BAL   2,KFLCGB      Prepare new block                 @SC90264 06286000
  2672.          MVC   KFSNEXT,0(6)  Link into chain: 6->previous      @SC90264 06286500
  2673.          ST    4,KFSNEXT-KFSBLK(,6)                            @SC90264 06287000
  2674.          ST    6,KFSPREV     Set backward ptr in new block     @SC90264 06287500
  2675.          ICM   7,15,KFSNEXT  Added to end?                     @SC90264 06288000
  2676.          BZ    *+8           Yes, done linking                 @SC90264 06288500
  2677.           ST   4,KFSPREV-KFSBLK(,7) No, set back ptr in next   @SC90264 06289000
  2678. KFLOPO3  ST    4,FABUWORD    Save ptr in FAB                   @SC90264 06289500
  2679.          MVC   KFSFUID(LFUID+LFFNM),FABFUID                    @SC90264 06290000
  2680.          XC    KFSDAT(KFSLEN),KFSDAT                           @SC90264 06290500
  2681.          B     RTRN0                                           @SC90264 06291000
  2682. * Open input file                                              @SC90264 06291500
  2683. KFLOPI   B     RTRN0                                           @SC90264 06292000
  2684. *                                                                       06292500
  2685. * Look up file given in FAB.  1->FAB.  Set up TMPBLK if nec.   @SC90264 06293000
  2686. *  Return 15=0 and 1->block if found, 15=1 otherwise.          @SC90264 06293500
  2687. *                                                                       06294000
  2688. KFLLKP   ENTER ALT                                             @SC90264 06294500
  2689.          L     8,DFHEIBP     Get addressability                @SC90264 06295000
  2690.          LR    3,1           Address FAB                       @SC90264 06295500
  2691.          MVI   FDBRCF,C'V'   Enforce RECFM=V                   @SC91150 06296000
  2692.          CLC   FABFUID,CURFUID File in current directory?      @SC91150 06296500
  2693.          BNE   KFLLOTH       No, must get individual block     @SC90264 06297000
  2694.          LA    4,PTRKFS      Yes, start through chain          @SC90264 06297500
  2695. KFLLLP   LR    6,4           Save ptr to this block            @SC90264 06298000
  2696.          ICM   4,15,KFSNEXT  Get ptr to next block             @SC90264 06298500
  2697.          BZ    RTRN1         Hit end, file not found           @SC90264 06299000
  2698.          CLC   FABFNAM,KFSFNAM Match?                          @SC90264 06299500
  2699.          BH    KFLLLP        No, keep looking                  @SC90264 06300000
  2700.          BL    RTRN1         No, passed the right point        @SC90264 06300500
  2701. KFLLRET  RETREG (1,4)        Found file, return ptr to block   @SC90264 06301000
  2702.          ST    4,FABUWORD    Save ptr in FAB                   @SC90264 06301500
  2703.          B     RTRN0                                           @SC90264 06302000
  2704. KFLLOTH  ICM   4,15,TMPBLK   See if temp block already set up  @SC90264 06302500
  2705.          BNZ   KFLLOTH2      Yes, use it                       @SC90264 06303000
  2706.          BAL   2,KFLCGB      No, get a block                   @SC90264 06303500
  2707.          ST    4,TMPBLK                                        @SC90264 06304000
  2708.          MVI   KFSFUID,0     Mark it unused                    @SC90264 06304500
  2709. KFLLOTH2 CLC   KFSFUID(LFUID+LFFNM),FABFUID Same as before?    @SC90264 06305000
  2710.          BE    KFLLRET       Yes, just return                  @SC90264 06305500
  2711.          MVC   KFLFUID(LFUID+LFFNM),FABFUID Set key            @SC90264 06306000
  2712.          BAL   2,KFLCRED     Read a directory block            @SC90264 06306500
  2713.           B    RTRN1                                           @SC90264 06307000
  2714.          CLC   KFSFUID(LFUID+LFFNM),FABFUID Found right one?   @SC90264 06307500
  2715.          BNE   RTRN1         No, too bad                       @SC90264 06308000
  2716.          B     KFLLRET       Yes, return result                @SC90264 06308500
  2717. *                                                                       06309000
  2718. * (Re)set current directory within Kermit file system          @SC90264 06309500
  2719. *  R1->H(length),CLn new directory name.  If it begins with ', @SC90264 06310000
  2720. *  the name is a prefix for external file names.  If it is     @SC90264 06310500
  2721. *  just *, it is equivalent to the value in KUSERID.           @SC90264 06311000
  2722. *                                                                       06311500
  2723. KFLCWD   ENTER ALT                                             @SC90264 06312000
  2724.          L     8,DFHEIBP     Get addressability                @SC90264 06312500
  2725.          LH    7,0(1)        Get length                        @SC90264 06313000
  2726.          LA    6,2(,1)       And address                       @SC90264 06313500
  2727.          LTR   7,7           Anything in the string?           @SC90264 06314000
  2728.          BZ    KFLCDRP       No, just drop old directory       @SC90264 06314500
  2729.          CLI   0(6),C''''    External names?                   @SC90264 06315000
  2730.          BE    KFLCDRP       Yes, drop old                     @SC90264 06315500
  2731.          C     7,F1          Is string just '*'?               @SC90264 06316000
  2732.          BNE   KFLCCMP                                         @SC90264 06316500
  2733.          CLI   0(6),C'*'                                       @SC90264 06317000
  2734.          BNE   KFLCCMP       No                                @SC90264 06317500
  2735.          LA    6,KUSERID     Yes, use true userid instead      @SC90264 06318000
  2736. KFLLAUID LA    7,LFUID                                         @SC90264 06318500
  2737. KFLCCMP  LA    15,0(7,6)     Point past string                 @SC90264 06319000
  2738.          CH    7,KFLLAUID+2  Shorter than usual?               @SC90264 06319500
  2739.          BNL   *+10          No, that's ok                     @SC90264 06320000
  2740.           MVC  0(LFUID,15),=CL(LFUID)' ' Yes, pad with blanks  @SC90264 06320500
  2741.          CLC   CURFUID,0(6)  Compare with current directory    @SC90264 06321000
  2742.          BE    RTRN0         Matches, nothing to do            @SC90264 06321500
  2743. KFLCDRP  CLI   CURFUID,0     Any current directory?            @SC90264 06322000
  2744.          BE    KFLCSET       No, nothing to drop               @SC90264 06322500
  2745.          BAL   2,KFLCRB      Yes, drop all blocks              @SC90264 06323000
  2746.          MVI   CURFUID,0     and wipe out name                 @SC90264 06323500
  2747. KFLCSET  CLI   0(6),C''''    External names?                   @SC90264 06324000
  2748.          BE    RTRN0         Yes, no new directory             @SC90264 06324500
  2749.          MVC   USRTOTL,F0    Clear total space used            @SC90264 06325000
  2750.          MVC   CURFUID,0(6)  Set new directory name            @SC90264 06325500
  2751.          CLI   CURFUID,0     Final cleanup?                    @SC90264 06326000
  2752.          BE    KFLCLEAN      Yes, release storage              @SC90264 06326500
  2753.          MVC   KFLFUID,0(6)  Set key for reading               @SC90264 06327000
  2754.          XC    KFLFNAM(LFFNM),KFLFNAM                          @SC90264 06327500
  2755.          LA    7,PTRKFS      Anchor of chain                   @SC90264 06328000
  2756. KFLCLP   BAL   2,KFLCGB      Get a free block: ptr in R4       @SC90264 06328500
  2757.          BAL   2,KFLCRED     Read a directory block            @SC90264 06329000
  2758.           B    KFLCLQ        Couldn't, we must be finished     @SC90264 06329500
  2759.          ST    4,0(,7)       Link onto chain                   @SC90264 06330000
  2760.          ST    7,KFSPREV     Link backwards, too               @SC90264 06330500
  2761.          LR    7,4           Set new end of chain              @SC90264 06331000
  2762.          AL    0,USRTOTL     Add up space used                 @SC90264 06331500
  2763.          BC    12,*+8        No carry                          @SC90264 06332000
  2764.           SLR  0,0                                             @SC90264 06332500
  2765.           BCTR 0,0           Set total to max                  @SC90264 06333000
  2766.          ST    0,USRTOTL     Keep new total                    @SC90264 06333500
  2767.          LM    0,1,KFSFNAM   Get name of file                  @SC90264 06334000
  2768.          AL    1,F1          And bump 1                        @SC90264 06334500
  2769.          BC    12,*+8        No carry                          @SC90264 06335000
  2770.           AL   0,F1          Carry                             @SC90264 06335500
  2771.          STM   0,1,KFLFNAM   Save as next key for search       @SC90264 06336000
  2772.          B     KFLCLP        Go get another                    @SC90264 06336500
  2773. KFLCLQ   MVC   KFSNEXT,PTRFRE This block is left over          @SC90264 06337000
  2774.          ST    4,PTRFRE                                        @SC90264 06337500
  2775.          B     RTRN0                                           @SC90264 06338000
  2776. *                                                                       06338500
  2777. * Release all storage                                          @SC90264 06339000
  2778. KFLCLEAN MVC   PTRFRE,F0                                       @SC90264 06339500
  2779.          MVC   PTRKFS,F0                                       @SC90264 06340000
  2780.          MVC   TMPBLK,F0                                       @SC90264 06340500
  2781. KFLCLLP  ICM   1,15,PTRFREM  Get ptr to next megablock         @SC90264 06341000
  2782.          BZ    RTRN0         No more, done freeing             @SC90264 06341500
  2783.          MVC   PTRFREM,0(1)  Unchain it                        @SC90264 06342000
  2784.          LA    0,KFSDWDS*20+1                                  @SC90264 06342500
  2785.          DMSFRET LOC=(1),DWORDS=(0) ... and free it            @SC90264 06343000
  2786.          B     KFLCLLP                                         @SC90264 06343500
  2787. *                                                                       06344000
  2788. * Read a directory block into buffer: key set up in KFLFUID.   @SC90264 06344500
  2789. *   Return to (2) if ok, else skip. Clobbers R5                @SC90264 06345000
  2790. *   Returns R0 = size of file in bytes                         @SC90264 06345500
  2791. *                                                                       06346000
  2792. KFLCRED  EXEC CICS READ DATASET(KFILE) RIDFLD(KFLFUID),        @SC90264+06346500
  2793.                KEYLENGTH(=Y(LFUID+LFFNM)) GENERIC GTEQ,        @SC90264+06347000
  2794.                SET(5) LENGTH(KFLBLN) NOHANDLE,                 @SC90264 06347500
  2795.          CLC   F0,EIBRCODE                                     @SC90264 06348000
  2796.          BNER  2             I/O error of some sort            @SC90264 06348500
  2797.          CLC   KFLFUID,0(5)  Did we get the right uid?         @SC90264 06349000
  2798.          BNER  2             No, we must be finished           @SC90264 06349500
  2799.          MVC   KFSFUID(LFUID+LFFNM),0(5)  Ok so far, copy name @SC90264 06350000
  2800.          CLC   KFLBLN,=Y(KFSLEN*2+LFKEY) Valid block?          @SC90264 06350500
  2801. *        BNL   KFLCRPK       Ok so far, verify it              @SC90264 06351000
  2802. * - - - - - Insert code to compensate for missing info in any  @SC90264 06351500
  2803. *           supported shorter block length                     @SC90264 06352000
  2804.          BLR   2             No, quit now                      @SC90264 06352500
  2805. KFLCRPK  PACK  KFSDAT(8),LFKEY(15,5)                           @SC90264 06353000
  2806.          PACK  KFSDAT+7(8),LFKEY+14(15,5)                      @SC90264 06353500
  2807.          PACK  KFSDAT+14(2),LFKEY+28(3,5)                      @SC90264 06354000
  2808. * - - - - - - Extend these PACK instrs if KFSLEN grows         @SC90264 06354500
  2809.          ICM   0,3,KFSNREC   Is this a valid block?            @SC90264 06355000
  2810.          BNPR  2             No, stop here                     @SC90264 06355500
  2811.          ICM   0,15,KFSSIZE  ditto                             @SC90264 06356000
  2812.          BNPR  2                                               @SC90264 06356500
  2813.          B     4(,2)         Return and skip                   @SC90264 06357000
  2814. *                                                                       06357500
  2815. * Get a free block for directory, create new if necessary      @SC90264 06358000
  2816. *  Return via R2, ptr in R4, uses R0,R1,R14,R15                @SC90264 06358500
  2817. KFLCGB   ICM   4,15,PTRFRE   Get a free block                  @SC90264 06359000
  2818.          BNZ   KFLCGB2       Ok, use it                        @SC90264 06359500
  2819.          LA    0,KFSDWDS*20+1 No, must assign some more        @SC90264 06360000
  2820.          DMSFREE DWORDS=(0),ERR=RTRN1                          @SC90264 06360500
  2821.          MVC   0(4,1),PTRFREM Link to megablock chain          @SC90264 06361000
  2822.          ST    1,PTRFREM                                       @SC90264 06361500
  2823.          LA    4,4(,1)       Skip over megablock ptr           @SC90264 06362000
  2824.          LA    15,20         Partition into 20 blocks          @SC90264 06362500
  2825. KFLCGBLP MVC   KFSNEXT,PTRFRE Link to free chain               @SC90264 06363000
  2826.          ST    4,PTRFRE                                        @SC90264 06363500
  2827.          LA    4,KFSDWDS*8(,4) Skip to next block              @SC90264 06364000
  2828.          BCT   15,KFLCGBLP                                     @SC90264 06364500
  2829.          B     KFLCGB        Now try again                     @SC90264 06365000
  2830. KFLCGB2  MVC   PTRFRE,KFSNEXT Unchain the block                @SC90264 06365500
  2831.          MVC   KFSNEXT,F0                                      @SC90264 06366000
  2832.          BR    2                                               @SC90264 06366500
  2833. *                                                                       06367000
  2834. * Release all directory blocks in current directory            @SC90264 06367500
  2835. *  Return via R2.  Uses R0,R14,R15                             @SC90264 06368000
  2836. KFLCRB   ICM   0,15,PTRKFS   Any directory?                    @SC90264 06368500
  2837.          BZR   2             No, all done                      @SC90264 06369000
  2838.          MVC   PTRKFS,F0     Yes, unchain all blocks           @SC90264 06369500
  2839.          LA    15,PTRFRE     Start of free chain               @SC90264 06370000
  2840.          LR    14,15                                           @SC90264 06370500
  2841.          ICM   15,15,0(14)   Find end of free chain            @SC90264 06371000
  2842.          BNZ   *-6           Saw another, keep looking         @SC90264 06371500
  2843.          ST    0,0(,14)      Link whole directory onto end     @SC90264 06372000
  2844.          BR    2                                               @SC90264 06372500
  2845. *                                                                       06373000
  2846.          DROP  3,4,8                                           @SC91150 06373500
  2847. *                                                                       06374000
  2848. KFLHEXY  DC    C'0123456789',X'7A7B7C7D7E7F'  Printable codes  @SC90264 06374500
  2849. *                               : # @ ' = "  with proper digit @SC90264 06375000
  2850.          LOCALS ,                                              @SC90264 06375500
  2851. KFLDW    DS    0D            Temporary                         @SC90264 06376000
  2852. KFLFUID  DS    CL(LFUID)     Room for key                      @SC90264 06376500
  2853. KFLFNAM  DS    CL(LFFNM)     (including this)                  @SC90264 06377000
  2854. KFLRN    DS    CL5                                             @SC90264 06377500
  2855. KFLFDAT  DS    CL(2*KFSLEN)                                    @SC90264 06378000
  2856. KFLBLN   DS    H             Length of record                  @SC90264 06378500
  2857. KFLMNTH  DS    XL11          Month length table                @SC86299 06379000
  2858. *                                                                       06379500
  2859.          EXIT  ,                                               @SC90264 06380000
  2860.