Friday, October 6, 2017

Assembler to select only 101 records for a particular connection type


Original post 06/10/2017

31/10/2017 : Teasing  ... Coming Soon , Assembler to select 101 records by specifying  an SSID,  a beginning and ending period, and a connection type

Rexx is fun, but rexx is slow.
When you have millions of accounting record to process, and you run a rexx to read it, sooner or later you will hit the problem of performance ( cpu consumption).
That's why my aim before retirement [... still 20 years :-( ]  is to write all the accounting stuffs in assembler. But there is still a long road ahead as with assembler , if you don't write programs you quickly forget all ...

So here is an assembler which reads 101 records and preselect a particular connection type (in this example DDF  runs) , i also have another similar program to select a particular DB2 ID (useful when there is more than 1 DB2 on the LPAR)


BAL      OPSYN     BAS
BALR     OPSYN     BASR
SMF101   START       0
*----------------------------------------------------------*
* Program     : SMF101                                    -*
* Written on  : 21.09.2017                                -*
* Author      : Nguyen Duc Tuan                           -*
* DESCRIPTION : The SMF101 decoder project                -*
*----------------------------------------------------------*
BEGIN    SAVE  (14,12)
         BALR  3,0
         USING *,3
         ST    13,SAVE+4
         LA    13,SAVE
*
         OPEN      (SMFIN,INPUT,SMFOUT,OUTPUT)   OPEN INPUT OUTPUT
         OPEN      (SNAPDD,OUTPUT)
         SR        8,8               0=>R8 READ COUNT
         SR        9,9               0=>R9 WR COUNT
*----------------------------------------------------------*
*- MAIN LOOP                                              -*
*----------------------------------------------------------*
READON   BAL       6,READREC                     READ RECORD
         BAL       6,SELREC                      SELECT RECORD
         B         READON                        GET NEXT RECORD
*                                                END OF FILE
ENDFILE  SNAP      DCB=SNAPDD,ID=99,PDATA=(REGS)   SNAPSHOT
         CLOSE     (SMFIN,,SMFOUT,,SNAPDD)       CLOSE FILES
*
* STANDARD EXIT SEQUENCE
         L     13,SAVE+4
         LM    14,12,12(13)
         SR    15,15
         BR    14            R14 = RETURNED ADDRESS
*----------------------------------------------------------*
*- READREC ROUTINE                                        -*
*----------------------------------------------------------*
READREC  DS        0H
         USING     SM101,4     SET UP ADDR.ABILITY
         GET       SMFIN       GET RECORD LOCATE MODE
         LR        4,1         LOAD R4 WITH RECORD
         A         8,=F'1'     Increment R8 by 1
         BR        6
*----------------------------------------------------------*
*- SELREC  ROUTINE : SELECT ONLY SMF 101 RECORDS          -*
*----------------------------------------------------------*
SELREC   CLI       SM101RTY,X'65'       IS THIS SMF101 ?
         BE        PROCREC               YES
         BR        6
*----------------------------------------------------------*
*- PROCREC ROUTINE                                        -*
*----------------------------------------------------------*
PROCREC  DS        0H
* Begin processing
         LA        5,SM101END      Adresse de debut self-def
         USING     QWS0,5           --> Self def-Section
         L         7,QWS00PSO      QWD00PSO est un Offset par rapport
         AR        7,4             au debut du record, pour avoir
*                                  l'ad.absolue il faut + R4
         USING     QWHS,7           --> Prod section
         MVC       WKSSID,QWHSSSID
         MVC       WKIFCID,QWHSIID
*        WTO       MF=(E,WTOBLOCK),ROUTCDE=11
*        CLC       QWHSSSID,=C'DBT1'     SSID= DBT1
*        BE        FOUNDI
*        LA        15,4
         LA        5,QWHSEND       Adresse Correlation header
         USING     QWHC,5           --> adressabilite
*        MVC       WTOCONN,QWHCATYP
*        WTO       MF=(E,WTOBLOCK),ROUTCDE=11
         CLC       QWHCATYP,=F'8'   CONNTYPE DDF
         BE        FOUNDI
         BR        6                        RETURN
DBWORD   DS        D                DBLE WORD POUR CONVERSION
TOTRD    DS        PL5              PACK DECIMAL 5 (9 CHIFFRE + SIGNE)
PATTERN1 DC        X'40202020202020202020' MASQUE
WTOBLOC2 DC        H'84'
         DC        XL2'0000'
PRTTOTR  DS        CL10             TOTAL READ EN FORMAT DISPLAY
         DC        CL66'A'
WTOBLOCK DC        H'60'
         DC        XL2'0000'
WTOCONN  DS        F
         DC        CL72'ASM my test is ended'
WKSSID   DC        CL4'????'
WKIFCID  DC        CL4'????'
FOUNDI   DS        0H
         A         9,=F'1'   Increment R9 by 1
         PUT       SMFOUT,SM101
*        WTO       'FOUNDI',ROUTCDE=11
         BR        6
*----------------------------------------------------------*
*- FILE SECTION                                           -*
*----------------------------------------------------------*
SMFIN    DCB   DDNAME=SMFIN,                                           X
               DSORG=PS,                                               X
               MACRF=GL,                                               X
               EODAD=ENDFILE,                                          X
               BFTEK=A,                                                X
               RECFM=VBS
SMFOUT   DCB   DDNAME=SMFOUT,                                          X
               DSORG=PS,                                               X
               MACRF=PM,                                               X
               LRECL=32767,                                            X
               RECFM=VBS,                                              X
               BLKSIZE=27998
SNAPDD   DCB   DSORG=PS,RECFM=VBA,MACRF=W,LRECL=125,BLKSIZE=882,       X
               DDNAME=SNAPDD
*----------------------------------------------------------*
*- WORKING STORAGE SECTION                                -*
*----------------------------------------------------------*
SAVE     DS        18F
*----------------------------------------------------------*
*- DSECT/MACRO     SECTION                                -*
*----------------------------------------------------------*
SMFTYPDB DS        0H
         DSNDQWAS  DSECT=YES,SUBTYPE=
SMF101 CSECT
SELFDEFS DS        0H
         DSNDQWS0  DSECT=YES
SMF101 CSECT
PRODSECT DS        0H  Production Standard header
         DSNDQWHS  DSECT=YES
SMF101 CSECT
PRODSEC2 DS        0H Production Header type 2 for correlation Id
         DSNDQWHC  DSECT=YES
SMF101 CSECT
DATASECT DS        0H
         DSNDQW01  IFCID(QWHS0090)
SMF101 CSECT
LAST     DS    CL1
         END       BEGIN

No comments:

Post a Comment