TITLE  'ICATS PARSE ROUTINE'                                   PAR00010
*********************************************************************** PAR00020
*                                                                     * PAR00030
*  MODULE NAME =  PARSE                                               * PAR00040
*                                                                     * PAR00050
*  FUNCTION =  TAKE AN UNPARSED CHARACTER STRING, SUCH AS THAT FROM   * PAR00060
*              AN SMSG OR A CONSOLE READ, AND PARSE THAT STRING       * PAR00070
*              INTO 15 8-BYTE TOKENS USING CMS'S PARSE ROUTINE.       * PAR00080
*              THE PARSED TOKENS GET PUT INTO THE 120-BYTE AREA       * PAR00090
*              POINTED TO BY R0.                                      * PAR00100
*                                                                     * PAR00110
*  ENTRY POINTS =  PARSE                                              * PAR00120
*                                                                     * PAR00130
*  LINKAGE =  BALR R14,R15 FROM ANYWHERE IN ICATS PROGRAM.            * PAR00140
*             THE ADDRESS OF THIS ROUTINE IS KEPT IN AN ADDRESS       * PAR00150
*             CONSTANT IN THE ICATS COMMON DATA AREA (ICDATA).        * PAR00160
*             FOR EXAMPLE,                                            * PAR00170
*                 LA    R0,WHERE PARSED PARMS ARE TO GO               * PAR00180
*                 LA    R1,CHARACTER LENGTH + STRING                  * PAR00190
*                 L     R15,APARSE                                    * PAR00200
*                 BALR  R14,R15                                       * PAR00210
*                                                                     * PAR00220
*  REGISTER CONTENTS UPON ENTRY =                                     * PAR00230
*     R0  = CONTAINS THE ADDRESS OF THE 120-BYTE BUFFER WHERE THE     * PAR00240
*           PARSED PARAMETERS ARE TO GO.  THIS AREA IS INITIALIZED    * PAR00250
*           TO ALL BLANKS, THEN UP TO 16 8-BYTE PARMS ARE MOVED IN.   * PAR00260
*     R1  = CONTAINS THE ADDRESS OF THE CHARACTER STRING LENGTH AND   * PAR00270
*           THE STRING ITSELF IN THIS FORMAT,                         * PAR00280
*                 DS CL1        CHARACTER STRING LENGTH               * PAR00290
*                 DS CL??       CHARACTER STRING TO BE PARSED         * PAR00300
*     R2  = POINTS TO THE ICATS COMMON DATA AREA AS ALWAYS.           * PAR00310
*     R14 = RETURN ADDRESS BACK TO CALLER.                            * PAR00320
*     R15 = ADDRESS OF THIS SUBROUTINE (USED FOR BASE REG).           * PAR00330
*                                                                     * PAR00340
*  REGISTER USAGE:                                                    * PAR00350
*      R0 = FREE                                                      * PAR00360
*      R2 = USED TO ADDRESS ICDATA.                                   * PAR00370
*  R3-R13 = FREE                                                      * PAR00380
*     R14 = RETURN ADDRESS FOR WHEN I CALL SUBROUTINES                * PAR00390
*     R15 = SUBROUTINE ADDRESS                                        * PAR00400
*                                                                     * PAR00410
*  MODULE LOGIC =                                                     * PAR00420
*      I)  BRANCH TO CMS'S SCAN ROUTINE (ADDRESS IS IN NUCON)         * PAR00430
*          TO HAVE HIM PARSE THE CHARACTER STRING.                    * PAR00440
*     II)  MOVE PARSED TOKENS INTO USERS BUFFER AREA AFTER            * PAR00450
*          PADDING WITH BLANKS.                                       * PAR00460
*                                                                     * PAR00470
*  NORMAL EXIT =                                                      * PAR00480
*      R15 = 0                                                        * PAR00490
*                                                                     * PAR00500
*  EXTERNAL REFERENCES = USES ASCANN IN NUCON WHICH IS THE ADDRESS    * PAR00510
*                        OF CMS'S PARSE ROUTINE                       * PAR00520
*                                                                     * PAR00530
*  CONTROL BLOCKS =  ICDATA   (ICATS COMMON DATA AREA)                * PAR00540
*                                                                     * PAR00550
*  NON-STANDARD MACROS (FOUND IN ICATS MACLIB)                        * PAR00560
*            ICDATA = ICATS COMMON DATA AREA DSECT.                   * PAR00570
*                                                                     * PAR00580
*  CHANGE ACTIVITY                                                    * PAR00590
*    DATE        NAME       REASON FOR CHANGE                         * PAR00600
*  04/18/83  RICK JASPER    BROKEN AWAY FROM ICATS MAINLINE INTO      * PAR00610
*                           SEPARATE SUBROUTINE                       * PAR00620
*  09/15/83  RICK JASPER    RESTRUCTURED MODULE TO HAVE CALLER        * PAR00630
*                           SPECIFY OUTPUT BUFFER.                    * PAR00640
*                                                                     * PAR00650
*********************************************************************** PAR00660
         EJECT                                                          PAR00670
         PRINT   GEN,NODATA                                             PAR00680
PARSE    CSECT                                                          PAR00690
         USING NUCON,R0             NUCON DOESN'T NEED A BASE REGISTER  PAR00700
         USING ICDATA,R2            ADDRESS ICATS COMMON DATA AREA      PAR00710
         USING PARSE,R15      USE R15 FOR NEXT INSTRUCTION ONLY         PAR00720
         STM   R0,R14,PARSREGS   SAVE CALLERS REGISTERS                 PAR00730
         USING PARSE,R11      SWITCH BASE REG CAUSE PARSE CALL USES R15 PAR00740
         LR    R11,R15                                                  PAR00750
         DROP  R15                                                      PAR00760
         LR    R6,R0          SAVE CALLER'S OUTPUT BUFFER ADDRESS       PAR00770
         SR    R0,R0                                                    PAR00780
         ICM   R0,1,0(R1)     GET CHARACTER STRING LENGTH               PAR00790
         LA    R1,1(R1)       POINT TO START OF CHARACTER STRING        PAR00800
         L     R15,ASCANN     GET CMS'S SCAN ROUTINE ADDRESS FROM NUCON PAR00810
         SPKA  0(0)           PSW KEY MUST BE 0 FOR CMS'S SCAN ROUTINE  PAR00820
         BALR  R14,R15           GO PARSE THE COMMAND LINE              PAR00830
         SPKA  X'E0'          SET IT BACK TO NORMAL                     PAR00840
*********************************************************************** PAR00850
*    ON RETURN FROM ASCANN,                                           * PAR00860
*    R0 = BYTE COUNT OF THE NUMBER OF PARMS HE FOUND INCLUDING AN     * PAR00870
*         8-BYTE DELIMITER OF 8X'FF'.                                 * PAR00880
*    R1 = ADDRESS OF WHERE PARSED PARAMETERS ARE.  THE PARMS ARE      * PAR00890
*         SITTING IN CONSECUTIVE DOUBLEWORDS PADDED WITH BLANKS.      * PAR00900
*********************************************************************** PAR00910
         MVI   0(R6),C' '          BLANK OUT PARM AREA                  PAR00920
         MVC   1(119,R6),0(R6)                                          PAR00930
         LR    R15,R0         GET BYTE COUNT OF PARMS                   PAR00940
         SRL   R15,3          DIVIDE BY 8                               PAR00950
         BCTR  R15,R0         DECREMENT PARM COUNT-DON'T WANT DELIMITER PAR00960
         C     R15,=F'15'     MAKE SURE WE DON'T GET MORE THAN 15 PARMS PAR00970
         BNH   PARSCONA                                                 PAR00980
         LA    R15,15         MOVE ONLY THE FIRST 15 PARMS              PAR00990
PARSCONA DS    0H                                                       PAR01000
         LTR   R15,R15        MAKE SURE THERE WERE SOME PARMS           PAR01010
         BZ    PARSEBYE       IF NOT, DON'T BOTHER MOVING ANYTHING      PAR01020
         SLL   R15,3          GET BYTE COUNT OF # PARMS TO MOVE         PAR01030
         BCTR  R15,R0         DECREMENT BYTE COUNT FOR THE MVC INSTR.   PAR01040
         EX    R15,PARSEMVC   MOVE TOKENIZED PARMS INTO PLACE           PAR01050
PARSEBYE DS    0H                                                       PAR01060
         LM    R0,R14,PARSREGS   RESTORE CALLERS REGISTERS              PAR01070
         BR    R14               BYE                                    PAR01080
PARSREGS DS    16F                                                      PAR01090
PARSEMVC MVC   0(0,R6),0(R1)                                            PAR01100
         LTORG                                                          PAR01110
         ICDATA                                                         PAR01120
         NUCON                                                          PAR01130
         END                                                            PAR01140