Exercício prático da linguagem de programação Assembly (On-line)

Nesta aula você terá conceitos da linguagem Assembly com a elaboração de um sistema de cadastro(On-line).

				
					*
*================================================================*
*                   FUTURE SCHOOL                                *
*----------------------------------------------------------------*
*                                                                *
*  PROGRAMA......: PGMENU1 - LINGUAGEM ASSEMBLY (ON-LINE)        *
*  MAPA..........: MAPASM  - LINGUAGEM ASSEMBLY                  *
*  TRANSACAO.....: MEN1                                          *
*  DATA..........: 02/2023                                       *
*  AUTOR.........: LESSA                                         *
*                                                                *
*     OBJETIVO...:  MENU DE OPCOES                               *
*                                                                *
*----------------------------------------------------------------*
*
         PRINT NOGEN
DFHEISTG DSECT
*
R0       EQU   0
R1       EQU   1
R2       EQU   2
R3       EQU   3
R4       EQU   4
R5       EQU   5
R6       EQU   6
R7       EQU   7
R8       EQU   8
R9       EQU   9
R10      EQU   10
R11      EQU   11
R12      EQU   12
R13      EQU   13
R14      EQU   14
R15      EQU   15
*
DOUBLE   DS    D          PARA DESCOMPACTAR EIBTIME
*
WS_OPCAO DS    CL1
MENSA    DS    CL20
TRANS    DS    CL4
AUXCICS  DS    CL8
AUXTIME  DS    PL8
DDMMAAAA DS    CL10
AADDD    DS    CL6
DATAJUL  DS    PL3
AUXHORA  DS    CL8
*
COMAREA  DS CL1
OPCAO    DS CL1
*
         COPY  DFHBMSCA
         COPY  DFHAID
         COPY  MAPASM
         SPACE
*--------------------------------------
*    INICIO DO PROGRAMA
*--------------------------------------
PGMENU1  DFHEIENT CODEREG=R3,DATAREG=R13,EIBREG=R11
PGMENU1  AMODE 31
PGMENU1  RMODE ANY
*     MAPASMI    MAPASMO
INICIO   EQU   *
         MVC   TRANS,=C'MEN1'
         MVI   OPCAOO,C'0'
         MVC   MENS2O(60),=CL60' '     PREENCHE COM BRANCOS
         MVC   MENSAO(60),=CL60' '
         CLC   EIBCALEN,=H'0'          PRIMEIRA VEZ.
         BNE   RETORNO
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETRAN
*
*--------------------------------------
*        ROTINA PARA PEGAR DATA E HORA
*--------------------------------------
PEGDATA  EQU   *
         EXEC  CICS ASKTIME ABSTIME(AUXTIME) NOHANDLE
*
         EXEC  CICS FORMATTIME                                         X
                    ABSTIME (AUXTIME)                                  X
                    DDMMYYYY (DDMMAAAA)                                X
                    NOHANDLE
*
         MVI   DATA1A,X'61'           DFHBMPRF
         MVI   TRANSA,X'61'
         MVI   HORAA,X'61'
         MVI   TERMA,X'61'
         MVI   PROGMA,X'61'
*
         MVC   DATA1O(2),DDMMAAAA
         MVI   DATA1O+2,C'/'
         MVC   DATA1O+3(2),DDMMAAAA+2
         MVI   DATA1O+5,C'/'
         MVC   DATA1O+6(4),DDMMAAAA+4
         UNPK  DOUBLE,EIBTIME        HORA
         MVC   HORAO(2),DOUBLE+2
         MVI   HORAO+2,C':'
         MVC   HORAO+3(2),DOUBLE+4
         MVC   PROGMO,=C'PGMENU1 '   CODIGO DO PROGRAMA
         MVC   TRANSO,=C'MEN1'       CODIGO DA TRANSACAO
         MVC   TERMO,EIBTRMID        TERMINAL
         BR    R7
*
*--------------------------------------
*          ROTINA PARA ENVIAR TELA
*--------------------------------------
ENVTELA  EQU   *
         MVC   MENSAO(60),=CL60' '       BRANCOS
         MVC   MENSAO(31),=C'ESCOLHA UMA OPCAO E TECLE ENTER'
         EXEC  CICS SEND                                               X
               MAPSET ('MAPASM')                                       X
               MAP    ('MAPASM')                                       X
               FROM (MAPASMO)                                          X
               ERASE
         BR    R7
*--------------------------------------
*        ROTINA DE RETORNO
*--------------------------------------
RETORNO  EQU   *
*
         EXEC  CICS HANDLE AID                                         X
               PF3(RETRAN)                                             X
               CLEAR(RETRAN)
*
*        L     R6,DFHEICAP      CARREGA COMMAREA
*        MVC   COMAREA,0(R6)
*
         BAL   R7,RECTELA
         B     TRATOPC
*
*--------------------------------------
*        ROTINA RECEBE TELA
*--------------------------------------
RECTELA  EQU   *
*
         CLC   EIBAID,DFHCLEAR
         BE    ENCERRA
*
         EXEC  CICS RECEIVE                                            X
               MAP('MAPASM')                                           X
               MAPSET('MAPASM')                                        X
               INTO (MAPASMI)                                          X
               NOHANDLE
*
         BR    R7
*
ENCERRA  EQU   *
         MVC   MENSAO(60),=CL60' '
         MVC   MENSAO(20),=C'PROGRAMA ENCERRADO  '
         EXEC  CICS SEND FROM (MENSAO)

         EXEC  CICS RETURN
*
*--------------------------------------
*        TRATA OPCAO
*--------------------------------------
TRATOPC  EQU   *
         CLC   OPCAOI,C'0'
*        CLI   OPCAOI,X'F0'
         BH    VEROPC
         B     RETRAN
*
*--------------------------------------
*        VEREFICA OPCAO
*--------------------------------------
VEROPC   EQU   *
         MVC   COMAREA,OPCAOI
*
         CLI   OPCAOI,X'F1'       INCLUSAO
         BE    VAIOPC1
         CLI   OPCAOI,X'F2'       ALTERACAO
         BE    VAIOPC2
         CLI   OPCAOI,X'F3'       CONSULTA
         BE    VAIOPC3
         CLI   OPCAOI,X'F4'       EXCLUSAO
         BE    VAIOPC4
         CLI   OPCAOI,X'F5'       RELATORIO TELA
         BE    VAIOPC5
         CLI   OPCAOI,X'F6'       ENCERRA PGM
         BE    VAIOPC6
         BNE   OPCINVL            OPCAO INVALIDA
VAIOPC1  EQU   *
         EXEC  CICS XCTL PROGRAM('PGINCL1')
*
VAIOPC2  EQU   *
         EXEC  CICS XCTL PROGRAM('PGALTE1')
*
VAIOPC3  EQU   *
         EXEC  CICS XCTL PROGRAM('PGCONS1')
*
VAIOPC4  EQU   *
         EXEC  CICS XCTL PROGRAM('PGEXCL1')
*
VAIOPC5  EQU   *
         B     OPCINVL
*        EXEC  CICS XCTL PROGRAM('PGRELA1')
*
VAIOPC6  EQU   *
         MVC   MENSA(20),=CL20'PROGAMA ENCERRADO   '
         EXEC  CICS SEND                                               X
               FROM(MENSA)                                             X
               ERASE
         EXEC  CICS RETURN
*--------------------------------------
*         OPCAO INVALIDA (RETORNA)
*--------------------------------------
OPCINVL  EQU   *
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         MVC   MENS2O(60),=CL60' '
         MVC   MENS2O(14),=C'OPCAO INVALIDA'
         EXEC  CICS SEND                                               X
               MAPSET ('MAPASM')                                       X
               MAP    ('MAPASM')                                       X
               FROM (MAPASMO)                                          X
               ERASE
         B     RETRAN
*
*--------------------------------------
*      ROTINA DE RETORNO TRANSACAO
*--------------------------------------
RETRAN   EQU   *
         EXEC  CICS RETURN                                             X
               TRANSID('MEN1')                                         X
               LENGTH (L'COMAREA)                                      X
               COMMAREA(COMAREA) NOHANDLE
*
         END   PGMENU1
				
			
				
					*
*================================================================*
*                   FUTURE SCHOOL                                *
*----------------------------------------------------------------*
*                                                                *
*  MAPA..........: MAPASM  - LINGUAGEM ASSEMBLY                  *
*  DATA..........: 05/2023                                       *
*  AUTOR.........: LESSA                                         *
*                                                                *
*     OBJETIVO...:  MENU DE OPCOES                               *
*                                                                *
*----------------------------------------------------------------*
*
MAPASM   DFHMSD TYPE=MAP,                                              X
               TIOAPFX=YES,                                            X
               LANG=ASM,                                               X
               MODE=INOUT,                                             X
               CTRL=(FREEKB,FRSET)
MAPASM   DFHMDI SIZE=(24,80),                                          X
               LINE=1,                                                 X
               COLUMN=1
DATA1    DFHMDF POS=(1,1),                                             X
               LENGTH=10,                                              X
               ATTRB=PROT
         DFHMDF POS=(1,25),                                            X
               LENGTH=13,                                              X
               ATTRB=PROT,                                             X
               INITIAL='FUTURE SCHOOL'
HORA     DFHMDF POS=(1,71),                                            X
               LENGTH=8,                                               X
               ATTRB=PROT
         DFHMDF POS=(2,1),                                             X
               LENGTH=10,                                              X
               ATTRB=PROT,                                             X
               INITIAL='TERMINAL:'
TERM     DFHMDF POS=(2,12),                                            X
               LENGTH=4,                                               X
               ATTRB=PROT,                                             X
               INITIAL='    '
         DFHMDF POS=(2,25),                                            X
               LENGTH=13,                                              X
               ATTRB=PROT,                                             X
               INITIAL='CURSO DE CICS'
         DFHMDF POS=(2,60),                                            X
               LENGTH=10,                                              X
               ATTRB=PROT,                                             X
               INITIAL='TRANSACAO:'
TRANS    DFHMDF POS=(2,70),                                            X
               LENGTH=4,                                               X
               ATTRB=PROT,                                             X
               INITIAL='    '
         DFHMDF POS=(03,02),LENGTH=06,ATTRB=PROT,                      X
               INITIAL='CPROG:'
PROGM    DFHMDF POS=(03,08),LENGTH=08,ATTRB=PROT
         DFHMDF POS=(5,25),                                            X
               LENGTH=10,                                              X
               ATTRB=PROT,                                             X
               INITIAL='1-INCLUSAO'
         DFHMDF POS=(6,25),                                            X
               LENGTH=11,                                              X
               ATTRB=PROT,                                             X
               INITIAL='2-ALTERACAO'
         DFHMDF POS=(7,25),                                            X
               LENGTH=10,                                              X
               ATTRB=PROT,                                             X
               INITIAL='3-CONSULTA'
         DFHMDF POS=(8,25),                                            X
               LENGTH=10,                                              X
               ATTRB=PROT,                                             X
               INITIAL='4-EXCLUSAO'
         DFHMDF POS=(9,25),                                            X
               LENGTH=11,                                              X
               ATTRB=PROT,                                             X
               INITIAL='5-RELATORIO'
         DFHMDF POS=(10,25),                                           X
               LENGTH=10,                                              X
               ATTRB=PROT,                                             X
               INITIAL='6-FINALIZA'
         DFHMDF POS=(13,25),                                           X
               LENGTH=15,                                              X
               ATTRB=PROT,                                             X
               INITIAL='QUAL SUA OPCAO:'
OPCAO    DFHMDF POS=(13,42),                                           X
               LENGTH=1,                                               X
               ATTRB=(NUM,UNPROT,IC),                                  X
               INITIAL='0'
         DFHMDF POS=(13,44),                                           X
               ATTRB=ASKIP
         DFHMDF POS=(23,1),                                            X
               LENGTH=9,                                               X
               ATTRB=PROT,                                             X
               INITIAL='MENSAGEM:'
MENSA    DFHMDF POS=(23,11),                                           X
               LENGTH=60,                                              X
               ATTRB=PROT
MENS2    DFHMDF POS=(24,11),                                           X
               LENGTH=60,                                              X
               ATTRB=(ASKIP,BRT)
         DFHMSD TYPE=FINAL
         END
				
			
				
					*
*================================================================*
*                   FUTURE SCHOOL                                *
*----------------------------------------------------------------*
*                                                                *
*  PROGRAMA......: PGINCL1 - LINGUAGEM ASSEMBLY (ON-LINE)        *
*  MAPA..........: MAP3ASM - LINGUAGEM ASSEMBLY                  *
*  TRANSACAO.....: INC1                                          *
*  ARQUIVO...VSAM: CADCONS - COM TAMANHO DE 121 POSICOES         *
*                            CHAVE NAS PRIMEIRAS 5 POSICOES      *
*  DATA..........: 05/2023                                       *
*  AUTOR.........: LESSA                                         *
*                                                                *
*     OBJETIVO...:  INCLUSAO DE CODIGOS CADASTRAIS               *
*                                                                *
*----------------------------------------------------------------*
*
         PRINT NOGEN
DFHEISTG DSECT
*
R0       EQU   0
R1       EQU   1
R2       EQU   2
R3       EQU   3
R4       EQU   4
R5       EQU   5
R6       EQU   6
R7       EQU   7
R8       EQU   8
R9       EQU   9
R10      EQU   10
R11      EQU   11
R12      EQU   12
R13      EQU   13
R14      EQU   14
R15      EQU   15
*
*         AREA DE COMUNICACAO (COMAREA)
*
COMAREA  DS 0CL10
COM_FASE DS CL5
COM_CODI DS CL5
*
         SPACE
*
REGISTRO DS CL121
CODIREG  DS CL5
RAZAO    DS CL30
ENDER    DS CL50
TELEF    DS CL16
CONTATO  DS CL20
*
*        LAYOUT DO CADASTRO COM 121 POSICOES
*
WKS_CADCONS DS CL121
WKS_CODIGO  DS CL05
WKS_RAZAO   DS CL30
WKS_ENDER   DS CL50
WKS_TELEF   DS CL16
WKS_CONTATO DS CL20
*
*        AREAS AUXILIARES
*
RESPONSE DS    1F
QTRANS   DS    CL8
RESP     DS    XL2
DOUBLE   DS    D
TAMANHO  DS    H
POSIS    DS    XL2
MENSA    DS    CL20
AUXCICS  DS    CL8
AUXTIME  DS    PL8
DDMMAAAA DS    CL10
AADDD    DS    CL6
DATAJUL  DS    PL3
AUXHORA  DS    CL8
RBA      DS    F
*
         COPY  DFHBMSCA
         COPY  DFHAID
         COPY  MAP3ASM
         SPACE
*
*--------------------------------------
*    INICIO DO PROGRAMA
*--------------------------------------
PGINCL1  DFHEIENT CODEREG=R3,DATAREG=R13,EIBREG=R11
PGINCL1  AMODE 31
PGINCL1  RMODE ANY
*
INICIO   EQU   *
*
         EXEC  CICS ASSIGN  APPLID (AUXCICS) NOHANDLE
         MVC   TPOPERGO(09),=C'INCLUSAO '
         CLC   EIBCALEN,=H'0'          PRIMEIRA VEZ.
         BNE   RETORNO
         XC    MAP3ASMO(MAP3ASMI-MAP3ASMO),MAP3ASMO CLEAR MAP
         BAL   R7,PEGDATA
         MVI   DATAGA,X'61'           DFHBMPRF
         MVC   TRANSGO(4),=C'INC1'
         MVI   TRANSGA,X'61'
         MVI   HORAGA,X'61'
         MVI   TERMGA,X'61'
         MVC   TERMGO,EIBTRMID
         MVC   PROGGO(8),=C'PGINCL1 '
         MVI   PROGGA,X'61'
         MVI   CODIGA,X'C1'
         MVC   CODIGO(5),X'F0'
*        MVC   CODIREG(5),CODIGO
         MVI   TPCICGA,X'61'
         MVC   RAZAOGO(30),=CL30' '
         MVC   ENDERGO(50),=CL50' '
         MVI   ENDERGA,X'61'
         MVI   RAZAOGA,X'61'
         MVC   TELEFGO(16),X'F0'
         MVI   TELEFGA,X'61'
         MVC   CONTAGO(20),=CL20' '
         MVI   CONTAGA,X'61'
         MVC   TPCICGO(8),AUXCICS
         MVI   TPCICGA,X'61'
         MVC   TPOPERGO(9),=C'INCLUSAO '
         MVC   TPOPERGA,X'61'
         MVC   MENSAGO(60),=CL60' '
         MVC   OUTROGO(11),=CL11' '
         MVC   POSIS,=H'0585'   POSICIONA NO PRIMEIRO BYTE DO CODIGO
         MVC   COM_FASE(5),=C'FASE1'
         BAL   R7,ENVTELA
         B     RETTRAN
*
*--------------------------------------
*        ROTINA PARA PEGAR DATA E HORA
*--------------------------------------
PEGDATA  EQU   *
         EXEC  CICS ASKTIME ABSTIME(AUXTIME) NOHANDLE
*
         EXEC  CICS FORMATTIME                                         X
                    ABSTIME (AUXTIME)                                  X
                    DDMMYYYY (DDMMAAAA)                                X
                    NOHANDLE
*
         MVI   DATAGA,X'61'
         MVI   TRANSGA,X'61'
         MVI   HORAGA,X'61'
         MVI   TERMGA,X'61'
         MVC   TERMGO,EIBTRMID
         MVC   PROGGO(8),=C'PGINCL1 '
         MVC   TRANSGO(4),=C'INC1'
         MVC   TPOPERGA,X'F8'
         MVC   TPCICGO(8),AUXCICS
         MVC   DATAGO(2),DDMMAAAA
         MVI   DATAGO+2,C'/'
         MVC   DATAGO+3(2),DDMMAAAA+2
         MVI   DATAGO+5,C'/'
         MVC   DATAGO+6(4),DDMMAAAA+4
         UNPK  DOUBLE,EIBTIME
         MVC   HORAGO(2),DOUBLE+2
         MVI   HORAGO+2,C':'
         MVC   HORAGO+3(2),DOUBLE+4
         MVC   TPOPERGO(9),=C'INCLUSAO '
*
         BR    R7
*
*--------------------------------------
*          ROTINA PARA ENVIAR TELA
*--------------------------------------
ENVTELA  EQU   *
         EXEC  CICS SEND                                               X
               MAPSET ('MAP3ASM') NOHANDLE                             X
               MAP    ('MAP3ASM')                                      X
               FROM (MAP3ASMO)                                         X
               ERASE                                                   X
               CURSOR(POSIS)                                           X
               FREEKB
*
         BR    R7
*--------------------------------------
*        ROTINA DE RETORNO
*--------------------------------------
RETORNO  EQU   *
*
         EXEC  CICS HANDLE AID                                         X
               PF3(VAIMENU)                                            X
               CLEAR(VAIMENU)
*
         L     R6,DFHEICAP      CARREGA COMMAREA
         MVC   COMAREA,0(R6)
*
         BAL   R7,RECTELA
         B     TRAFASE
*
*--------------------------------------
*        RECEBE TELA
*--------------------------------------
RECTELA  EQU   *
*
         EXEC  CICS RECEIVE                                            X
               MAP('MAP3ASM')                                          X
               MAPSET('MAP3ASM')                                       X
               INTO (MAP3ASMI)                                         X
               NOHANDLE
*
         BR    R7
*
*--------------------------------------
*      ROTINA VOLTA PARA MENU
*--------------------------------------
VAIMENU  EQU   *
*
         EXEC CICS XCTL PROGRAM('PGMENU1')
*
*--------------------------------------
*      ROTINA TRATA FASE
*--------------------------------------
TRAFASE  EQU   *
*
         CLC   COM_FASE,=C'FASE1'
         BE    VECODIGO
         CLC   COM_FASE,=C'FASE2'
         BE    CONSISTE
         CLC   COM_FASE,=C'FASE3'
         BE    GRAVACAO
         CLC   COM_FASE,=C'FASE4'
         BE    CONTPROC
         B     RETTRAN
*
*--------------------------------------
* ROTINA QUE VERIFICA SE CODIGO VALIDO
*--------------------------------------
VECODIGO EQU   *
*
         CLC   CODIGI(5),X'F0'     COMPARA COM ZERO
         BE    CDINVAL           CODIGO INVALIDO
         MVC   COM_CODI(5),CODIGI
         MVC   POSIS,=H'0585'   POSICIONA NO PRIMEIRO BYTE DO CODIGO
         B     LEITURA
*
*--------------------------------------
*      ROTINA CODIGO INVALIDO
*--------------------------------------
CDINVAL  EQU   *
*        MVI   MENSAGA,X'F8'
         MVI   MENSAGA,X'F4'
         MVC   MENSAGO(60),=CL60' '   MOVE BRANCOS
         MVC   MENSAGO(15),=CL15'CODIGO INVALIDO'
         MVC   POSIS,=H'0585'   POSICIONA NO PRIMEIRO BYTE DO CODIGO
         MVC   CODIGA,DFHBMFSE
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN         RETORNA A TRANSACAO
*
*--------------------------------------
*      ROTINA DE LEITURA
*--------------------------------------
LEITURA  EQU   *
         MVC   WKS_CODIGO(5),CODIGI
         MVC   COM_CODI(5),CODIGI
         MVC   CODIREG(5),CODIGI
         MVC   TAMANHO,=H'121'
         EXEC  CICS READ                                               X
               DATASET('CADCONS')                                      X
               RIDFLD(WKS_CODIGO)                                      X
               INTO(WKS_CADCONS)                                       X
               LENGTH (TAMANHO)                                        X
               RESP(RESPONSE)
*
         CLC   RESPONSE,DFHRESP(NORMAL)
         BNE   ACEITA
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(60),=CL60' '
         MVC   MENSAGO(31),=C'CODIGO EXISTENTE, TECLE ENTER  '
*
         MVC   CODIGO(05),WKS_CADCONS
         MVC   RAZAOGO(30),WKS_CADCONS+5
         MVC   ENDERGO(50),WKS_CADCONS+35
         MVC   TELEFGO(16),WKS_CADCONS+85
         MVC   CONTAGO(20),WKS_CADCONS+101
*
         MVC   OUTROGO(11),=CL11' '
         MVC   OUTROGO(11),=C'JA EX FASE1'
         MVC   POSIS,=H'0585'   POSICIONA NO PRIMEIRO BYTE DO CODIGO
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
*--------------------------------------
*      ROTINA CODIGO ACEITO
*--------------------------------------
ACEITA   EQU   *
         MVC   COM_FASE(5),=C'FASE2'
         MVC   POSIS,=H'0745'   POSICIONA NO PRIMEIRO BYTE DO RAZAO
         MVI   CODIGA,DFHBMPRF
         MVI   RAZAOGA,DFHBMFSE
         MVI   ENDERGA,DFHBMFSE
         MVI   TELEFGA,DFHBMFSE
         MVI   CONTAGA,DFHBMFSE
         MVI   TCONFGA,DFHBMFSE
         MVC   OUTROGO(11),=C'ACEIT FASE2'
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
*---------------------------------------
*      ROTINA DE CONSISTENCIA DE CAMPOS
*---------------------------------------
CONSISTE EQU   *
*
         MVI   CODIGA,DFHBMPRF
         MVI   RAZAOGA,DFHBMPRF
         MVI   ENDERGA,DFHBMPRF
         MVI   TELEFGA,DFHBMPRF
         MVI   CONTAGA,DFHBMPRF

VERAZAO  EQU   *
         CLC   RAZAOGI,=CL30' '
         BNE   PROTRAZ
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(60),=CL60' '
         MVC   MENSAGO(19),=C'NOME RAZAO INVALIDO'
         MVI   RAZAOGA,DFHBMFSE
         MVC   POSIS,=H'0745'   POSICIONA NO PRIMEIRO BYTE DO RAZAO
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
PROTRAZ  EQU   *
         MVI   RAZAOGA,DFHBMPRF
*
VEENDER  EQU   *
         CLC   ENDERGI,=CL50' '
         BNE   PROTEND
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(17),=C'ENDERECO INVALIDO'
         MVI   ENDERGA,DFHBMFSE
         MVC   POSIS,=H'0905'   POSICIONA NO PRIMEIRO BYTE DO ENDER
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
PROTEND  EQU   *
         MVI   ENDERGA,DFHBMPRF
*
VETELEF  EQU   *
         CLC   TELEFGI,=CL16' '
         BNE   PROTTEL
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(17),=C'TELEFONE INVALIDO'
         MVC   POSIS,=H'1065'  POSICIONA NO PRIMEIRO BYTE DO FONE
         MVI   TELEFGA,DFHBMFSE
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
PROTTEL  EQU   *
         MVI   TELEFGA,DFHBMPRF
*
VECONTA  EQU   *
         CLC   CONTAGI,=CL20' '
         BNE   PROTCTA
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(17),=C'CONTATO  INVALIDO'
         MVI   CONTAGA,DFHBMFSE
         MVC   POSIS,=H'1225'   POSICIONA NO PRIMEIRO BYTE DO CONTATO
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
PROTCTA  EQU   *
         MVI   CONTAGA,DFHBMPRF
*
VAIFASE3 EQU   *
*
         MVI   CODIGA,DFHBMPRF
         MVI   RAZAOGA,DFHBMPRF
         MVI   ENDERGA,DFHBMPRF
         MVI   TELEFGA,DFHBMPRF
         MVI   CONTAGA,DFHBMPRF
         MVI   TCONFGA,DFHBMFSE
         MVC   POSIS,=H'1696'   POSICIONA NO CONFIRMA
         MVC   TDCONFGO(12),=C'CONFIRMA S/N'
         MVC   COM_FASE(5),=C'FASE3'
         MVC   OUTROGO(11),=C'ACEIT FASE3'
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
*---------------------------------------
*       ROTINA CONFIRMA GRAVACAO
*---------------------------------------
GRAVACAO EQU   *
         CLI   TCONFGI,C'S'      CONFIRMA INCLUSAO
         BNE   VOLTMENU
*
         MVC   WKS_CODIGO,COM_CODI
         MVC   WKS_CADCONS(05),CODIGI
         MVC   WKS_CADCONS(05),COM_CODI
         MVC   WKS_CADCONS+5(30),RAZAOGI
         MVC   WKS_CADCONS+35(50),ENDERGI
         MVC   WKS_CADCONS+85(16),TELEFGI
         MVC   WKS_CADCONS+101(20),CONTAGI
         MVC   TAMANHO,=H'121'
         EXEC CICS WRITE                                               X
              DATASET ('CADCONS')                                      X
              RIDFLD(WKS_CODIGO)                                       X
              FROM (WKS_CADCONS)                                       X
              LENGTH(TAMANHO)                                          X
              RESP(RESPONSE)
*
         CLC   RESPONSE,DFHRESP(NORMAL)
         BNE   ERROINCL
         MVC   CODIGA,X'61'     DFHBMPRF
         MVC   RAZAOGA,X'61'
         MVC   ENDERGA,X'61'
         MVC   TELEFGA,X'61'
         MVC   CONTAGA,X'61'
         MVC   TCONFGA,X'C1'    DFHBMFSE
         MVC   TDCONFGO(14),=C'NOVA INCLUSAO:'
         MVC   POSIS,=H'1696'   POSICIONA NO CONFIRMA
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(21),=C'INCLUSAO COM SUSCESSO'
         MVC   TCONFGI,C' '
         MVC   COM_FASE(5),=C'FASE4'
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
ERROINCL EQU   *
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(16),=C'ERRO NA INCLUSAO'
         MVC   COM_FASE(5),=C'     '
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*        EXEC CICS XCTL PROGRAM('PGMENU1')
*
*---------------------------------------------
*       ROTINA PARA CONTINUA PROCESSO INCLUSAO
*---------------------------------------------
CONTPROC EQU   *
         CLI   TCONFGI,C'S'
         BNE   VOLTMENU
         EXEC CICS XCTL  PROGRAM('PGINCL1')
VOLTMENU EQU   *
         MVC   COM_FASE(5),=C'     '
         EXEC CICS XCTL  PROGRAM('PGMENU1')
*
*--------------------------------------
*      ROTINA DE RETORNO TRANSACAO
*--------------------------------------
RETTRAN  EQU   *
*
         EXEC  CICS RETURN                                             X
               TRANSID('INC1')                                         X
               COMMAREA(COMAREA) NOHANDLE                              X
               LENGTH (L'COMAREA)
*
         END   PGINCL1
				
			
				
					*
*================================================================*
*                   FUTURE SCHOOL                                *
*----------------------------------------------------------------*
*                                                                *
*  MAPA..........: MAP3ASM - LINGUAGEM ASSEMBLY                  *
*  DATA..........: 05/2023                                       *
*  AUTOR.........: LESSA                                         *
*                                                                *
*     OBJETIVO...:  DADOS CADASTRAIS                             *
*                                                                *
*----------------------------------------------------------------*
*
MAP3ASM  DFHMSD TYPE=MAP,                                              X
               TIOAPFX=YES,                                            X
               LANG=ASM,                                               X
               MODE=INOUT,                                             X
               CTRL=(FREEKB,FRSET)
MAP3ASM  DFHMDI SIZE=(24,80),                                          X
               LINE=1,                                                 X
               COLUMN=1
DATAG    DFHMDF POS=(1,1),                                             X
               LENGTH=10,                                              X
               ATTRB=PROT,                                             X
               INITIAL='          '
         DFHMDF POS=(1,25),                                            X
               LENGTH=13,                                              X
               ATTRB=PROT,                                             X
               INITIAL='FUTURE SCHOOL'
HORAG    DFHMDF POS=(1,71),                                            X
               LENGTH=8,                                               X
               ATTRB=PROT,                                             X
               INITIAL='        '
         DFHMDF POS=(2,1),                                             X
               LENGTH=9,                                               X
               ATTRB=PROT,                                             X
               INITIAL='TERMINAL:'
TERMG    DFHMDF POS=(2,11),                                            X
               LENGTH=4,                                               X
               ATTRB=PROT
         DFHMDF POS=(2,25),                                            X
               LENGTH=13,                                              X
               ATTRB=PROT,                                             X
               INITIAL='CURSO DE CICS'
         DFHMDF POS=(2,60),                                            X
               LENGTH=10,                                              X
               ATTRB=PROT,                                             X
               INITIAL='TRANSACAO:'
TRANSG   DFHMDF POS=(2,70),                                            X
               LENGTH=4,                                               X
               ATTRB=PROT,                                             X
               INITIAL='0000'
         DFHMDF POS=(03,02),LENGTH=06,ATTRB=PROT,                      X
               INITIAL='CPROG:'
PROGG    DFHMDF POS=(03,08),LENGTH=08,ATTRB=PROT,                      X
               INITIAL='        '
         DFHMDF POS=(03,60),LENGTH=07,ATTRB=PROT,                      X
               INITIAL='SICSG:'
TPCICG   DFHMDF POS=(03,67),LENGTH=08,ATTRB=PROT,                      X
               INITIAL='        '
         DFHMDF POS=(06,10),                                           X
               LENGTH=14,                                              X
               ATTRB=PROT,                                             X
               INITIAL='OPERACAO.....:'
TPOPERG  DFHMDF POS=(06,25),                                           X
               LENGTH=09,                                              X
               ATTRB=PROT
         DFHMDF POS=(08,10),                                           X
               LENGTH=14,                                              X
               ATTRB=PROT,                                             X
               INITIAL='CODIGO.......:'
CODIG    DFHMDF POS=(08,25),                                           X
               LENGTH=05,                                              X
               ATTRB=(UNPROT,NUM,IC),                                  X
               INITIAL='00000'
         DFHMDF POS=(08,31),                                           X
               LENGTH=1,                                               X
               ATTRB=ASKIP
         DFHMDF POS=(10,10),                                           X
               LENGTH=14,                                              X
               ATTRB=PROT,                                             X
               INITIAL='RAZAO SOCIAL.:'
RAZAOG   DFHMDF POS=(10,25),                                           X
               LENGTH=30,JUSTIFY=(LEFT,BLANK),                         X
               ATTRB=PROT,                                             X
               INITIAL='                              '
         DFHMDF POS=(10,56),                                           X
               LENGTH=1,                                               X
               ATTRB=ASKIP
         DFHMDF POS=(12,10),                                           X
               LENGTH=14,                                              X
               ATTRB=PROT,                                             X
               INITIAL='ENDERECO.....:'
ENDERG   DFHMDF POS=(12,25),                                           X
               LENGTH=50,                                              X
               ATTRB=PROT,                                             X
               INITIAL='                                               X
                 '
         DFHMDF POS=(12,76),                                           X
               LENGTH=1,                                               X
               ATTRB=ASKIP
         DFHMDF POS=(14,10),                                           X
               LENGTH=14,                                              X
               ATTRB=PROT,                                             X
               INITIAL='TELEFONE.....:'
TELEFG   DFHMDF POS=(14,25),                                           X
               LENGTH=16,                                              X
               ATTRB=PROT
         DFHMDF POS=(14,42),                                           X
               LENGTH=1,                                               X
               ATTRB=ASKIP
         DFHMDF POS=(16,10),                                           X
               LENGTH=14,                                              X
               ATTRB=PROT,                                             X
               INITIAL='CONTATO......:'
CONTAG   DFHMDF POS=(16,25),                                           X
               LENGTH=20,                                              X
               ATTRB=PROT
         DFHMDF POS=(16,46),                                           X
               LENGTH=1,                                               X
               ATTRB=ASKIP
         DFHMDF POS=(21,02),                                           X
               LENGTH=20,                                              X
               ATTRB=PROT,                                             X
               INITIAL='F3 - RETORNA AO MENU'
         DFHMDF POS=(21,28),                                           X
               LENGTH=29,                                              X
               ATTRB=PROT,                                             X
               INITIAL='DIGITE O CODIGO E TECLE ENTER'
TDCONFG  DFHMDF POS=(22,2),                                            X
               LENGTH=13,                                              X
               ATTRB=PROT,                                             X
               INITIAL='              '
TCONFG   DFHMDF POS=(22,16),                                           X
               LENGTH=1,                                               X
               INITIAL=' ',                                            X
               ATTRB=(UNPROT,IC)
         DFHMDF POS=(22,18),                                           X
               ATTRB=ASKIP
OUTROG   DFHMDF POS=(22,28),                                           X
               LENGTH=11,                                              X
               ATTRB=PROT,                                             X
               INITIAL='           '
VERFASE  DFHMDF POS=(23,28),                                           X
               LENGTH=05,                                              X
               ATTRB=PROT,                                             X
               INITIAL='     '
         DFHMDF POS=(24,1),                                            X
               LENGTH=9,                                               X
               ATTRB=PROT,                                             X
               INITIAL='MENSAGEM:'
MENSAG   DFHMDF POS=(24,11),                                           X
               LENGTH=60,                                              X
               ATTRB=PROT,                                             X
               INITIAL='                                               X
                           '
         DFHMSD TYPE=FINAL
         END
				
			
				
					*
*================================================================*
*                   FUTURE SCHOOL                                *
*----------------------------------------------------------------*
*                                                                *
*  PROGRAMA......: PGALTE1 - LINGUAGEM ASSEMBLY (ON-LINE)        *
*  MAPA..........: MAP3ASM - LINGUAGEM ASSEMBLY                  *
*  TRANSACAO.....: ALT1                                          *
*  ARQUIVO...VSAM: CADCONS - COM TAMANHO DE 121 POSICOES         *
*                            CHAVE NAS PRIMEIRAS 5 POSICOES      *
*  DATA..........: 05/2023                                       *
*  AUTOR.........: LESSA                                         *
*                                                                *
*     OBJETIVO...:  ALTERACAO DE DADOS CADASTRAIS                *
*                                                                *
*----------------------------------------------------------------*
         PRINT NOGEN
DFHEISTG DSECT
*
R0       EQU   0
R1       EQU   1
R2       EQU   2
R3       EQU   3
R4       EQU   4
R5       EQU   5
R6       EQU   6
R7       EQU   7
R8       EQU   8
R9       EQU   9
R10      EQU   10
R11      EQU   11
R12      EQU   12
R13      EQU   13
R14      EQU   14
R15      EQU   15
*
*         AREA DE COMUNICACAO (COMAREA)
*
COMAREA  DS 0CL10
COM_FASE DS CL5
COM_CODI DS CL5
*
         SPACE
*
REGISTRO DS CL121
CODIREG  DS CL5
RAZAO    DS CL30
ENDER    DS CL50
TELEF    DS CL16
CONTATO  DS CL20
*
*        LAYOUT DO CADASTRO COM 121 POSICOES
*
WKS_CADCONS DS CL121
WKS_CODIGO  DS CL05
WKS_RAZAO   DS CL30
WKS_ENDER   DS CL50
WKS_TELEF   DS CL16
WKS_CONTATO DS CL20
*
*        AREAS AUXILIARES
*
RESPONSE DS    1F
QTRANS   DS    CL8
RESP     DS    XL2
DOUBLE   DS    D
TAMANHO  DS    H
POSIS    DS    XL2
MENSA    DS    CL20
AUXCICS  DS    CL8
AUXTIME  DS    PL8
DDMMAAAA DS    CL10
AADDD    DS    CL6
DATAJUL  DS    PL3
AUXHORA  DS    CL8
RBA      DS    F
*
         COPY  DFHBMSCA
         COPY  DFHAID
         COPY  MAP3ASM
         SPACE
*
*--------------------------------------
*    INICIO DO PROGRAMA
*--------------------------------------
PGALTE1  DFHEIENT CODEREG=R3,DATAREG=R13,EIBREG=R11
PGALTE1  AMODE 31
PGALTE1  RMODE ANY
*
INICIO   EQU   *
*
         EXEC  CICS ASSIGN  APPLID (AUXCICS) NOHANDLE
         MVC   TPOPERGO(09),=C'ALTERACAO'
         CLC   EIBCALEN,=H'0'          PRIMEIRA VEZ.
         BNE   RETORNO
         XC    MAP3ASMO(MAP3ASMI-MAP3ASMO),MAP3ASMO CLEAR MAP
         BAL   R7,PEGDATA
         MVI   DATAGA,X'61'           DFHBMPRF
         MVC   TRANSGO(4),=C'ALT1'
         MVI   TRANSGA,X'61'
         MVI   HORAGA,X'61'
         MVI   TERMGA,X'61'
         MVC   TERMGO,EIBTRMID
         MVC   PROGGO(8),=C'PGALTE1 '
         MVI   PROGGA,X'61'
         MVI   CODIGA,X'C1'
         MVC   CODIGO(5),X'F0'
         MVC   CODIREG(5),CODIGO
         MVI   TPCICGA,X'61'
         MVC   RAZAOGO(30),=CL30' '
         MVC   ENDERGO(50),=CL50' '
         MVI   ENDERGA,X'61'
         MVI   RAZAOGA,X'61'
         MVC   TELEFGO(16),X'F0'
         MVI   TELEFGA,X'61'
         MVC   CONTAGO(20),=CL20' '
         MVI   CONTAGA,X'61'
         MVC   TPCICGO(8),AUXCICS
         MVI   TPCICGA,X'61'
         MVC   TPOPERGO(9),=C'ALTERACAO'
         MVC   TPOPERGA,X'61'
         MVC   MENSAGO(60),=CL60' '
         MVC   OUTROGO(11),=CL11' '
         MVC   POSIS,=H'0585'   POSICIONA NO PRIMEIRO BYTE DO CODIGO
         MVC   COM_FASE(5),=C'FASE1'
         BAL   R7,ENVTELA
         B     RETTRAN
*
*--------------------------------------
*        ROTINA PARA PEGAR DATA E HORA
*--------------------------------------
PEGDATA  EQU   *
         EXEC  CICS ASKTIME ABSTIME(AUXTIME) NOHANDLE
*
         EXEC  CICS FORMATTIME                                         X
                    ABSTIME (AUXTIME)                                  X
                    DDMMYYYY (DDMMAAAA)                                X
                    NOHANDLE
*
         MVI   DATAGA,X'61'
         MVI   TRANSGA,X'61'
         MVI   HORAGA,X'61'
         MVI   TERMGA,X'61'
         MVC   TERMGO,EIBTRMID
         MVC   PROGGO(8),=C'PGALTE1 '
         MVC   TRANSGO(4),=C'ALT1'
         MVC   TPOPERGA,X'F8'
         MVC   TPCICGO(8),AUXCICS
         MVC   DATAGO(2),DDMMAAAA
         MVI   DATAGO+2,C'/'
         MVC   DATAGO+3(2),DDMMAAAA+2
         MVI   DATAGO+5,C'/'
         MVC   DATAGO+6(4),DDMMAAAA+4
         UNPK  DOUBLE,EIBTIME
         MVC   HORAGO(2),DOUBLE+2
         MVI   HORAGO+2,C':'
         MVC   HORAGO+3(2),DOUBLE+4
         MVC   TPOPERGO(9),=C'ALTERACAO'
*
         BR    R7
*
*--------------------------------------
*          ROTINA PARA ENVIAR TELA
*--------------------------------------
ENVTELA  EQU   *
         EXEC  CICS SEND                                               X
               MAPSET ('MAP3ASM') NOHANDLE                             X
               MAP    ('MAP3ASM')                                      X
               FROM (MAP3ASMO)                                         X
               ERASE                                                   X
               CURSOR(POSIS)                                           X
               FREEKB
*
         BR    R7
*--------------------------------------
*        ROTINA DE RETORNO
*--------------------------------------
RETORNO  EQU   *
*
         EXEC  CICS HANDLE AID                                         X
               PF3(VAIMENU)                                            X
               CLEAR(VAIMENU)
*
         L     R6,DFHEICAP      CARREGA COMMAREA
         MVC   COMAREA,0(R6)
*
         BAL   R7,RECTELA
         B     TRAFASE
*
*--------------------------------------
*        RECEBE TELA
*--------------------------------------
RECTELA  EQU   *
*
         EXEC  CICS RECEIVE                                            X
               MAP('MAP3ASM')                                          X
               MAPSET('MAP3ASM')                                       X
               INTO (MAP3ASMI)                                         X
               NOHANDLE
*
         BR    R7
*
*--------------------------------------
*      ROTINA VOLTA PARA MENU
*--------------------------------------
VAIMENU  EQU   *
*
         EXEC CICS XCTL PROGRAM('PGMENU1')
*
*--------------------------------------
*      ROTINA TRATA FASE
*--------------------------------------
TRAFASE  EQU   *
*
         CLC   COM_FASE,=C'FASE1'
         BE    VECODIGO
         CLC   COM_FASE,=C'FASE2'
         BE    CONSISTE
         CLC   COM_FASE,=C'FASE3'
         BE    REGRAVA
         CLC   COM_FASE,=C'FASE4'
         BE    CONTPROC
         B     RETTRAN
*
*--------------------------------------
* ROTINA QUE VERIFICA SE CODIGO VALIDO
*--------------------------------------
VECODIGO EQU   *
*
         CLC   CODIGI(5),X'F0'     COMPARA COM ZERO
         BE    CDINVAL           CODIGO INVALIDO
         MVC   COM_CODI(5),CODIGI
         MVC   POSIS,=H'0585'   POSICIONA NO PRIMEIRO BYTE DO CODIGO
         B     LEITURA
*
*--------------------------------------
*      ROTINA CODIGO INVALIDO
*--------------------------------------
CDINVAL  EQU   *
*        MVI   MENSAGA,X'F8'
         MVI   MENSAGA,X'F4'
         MVC   MENSAGO(60),=CL60' '   MOVE BRANCOS
         MVC   MENSAGO(15),=CL15'CODIGO INVALIDO'
         MVC   POSIS,=H'0585'   POSICIONA NO PRIMEIRO BYTE DO CODIGO
         MVC   CODIGA,DFHBMFSE
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN         RETORNA A TRANSACAO
*
*--------------------------------------
*      ROTINA DE LEITURA
*--------------------------------------
LEITURA  EQU   *
         MVC   WKS_CODIGO(5),CODIGI
         MVC   COM_CODI(5),CODIGI
         MVC   CODIREG(5),CODIGI
         MVC   TAMANHO,=H'121'
         EXEC  CICS READ                                               X
               DATASET('CADCONS')                                      X
               RIDFLD(WKS_CODIGO)                                      X
               INTO(WKS_CADCONS)                                       X
               LENGTH (TAMANHO)                                        X
               RESP(RESPONSE)
*
         CLC   RESPONSE,DFHRESP(NORMAL)
         BE    ACEITA
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(60),=CL60' '
         MVC   MENSAGO(31),=C'CODIGO NAO EXISTE, TECLE ENTER '
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN         RETORNA A TRANSACAO
*
*--------------------------------------
*      ROTINA CODIGO ACEITO
*--------------------------------------
ACEITA   EQU   *
         MVC   MENSAGO(15),=C'ALTERE OS DADOS'
         MVC   CODIGO(05),WKS_CADCONS
         MVC   RAZAOGO(30),WKS_CADCONS+5
         MVC   ENDERGO(50),WKS_CADCONS+35
         MVC   TELEFGO(16),WKS_CADCONS+85
         MVC   CONTAGO(20),WKS_CADCONS+101
*
         MVC   COM_FASE(5),=C'FASE2'
         MVC   POSIS,=H'0745'   POSICIONA NO PRIMEIRO BYTE DO RAZAO
         MVI   CODIGA,DFHBMPRF
         MVI   RAZAOGA,DFHBMFSE
         MVI   ENDERGA,DFHBMFSE
         MVI   TELEFGA,DFHBMFSE
         MVI   CONTAGA,DFHBMFSE
         MVI   TCONFGA,DFHBMFSE
         MVC   OUTROGO(11),=C'ACEIT FASE2'
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
*---------------------------------------
*      ROTINA DE CONSISTENCIA DE CAMPOS
*---------------------------------------
CONSISTE EQU   *
         MVC   TPOPERGO(09),=C'ALTERACAO'
         MVI   CODIGA,DFHBMPRF
         MVI   RAZAOGA,DFHBMPRF
         MVI   ENDERGA,DFHBMPRF
         MVI   TELEFGA,DFHBMPRF
         MVI   CONTAGA,DFHBMPRF

VERAZAO  EQU   *
         CLC   RAZAOGI,=CL30' '
         BNE   PROTRAZ
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(60),=CL60' '
         MVC   MENSAGO(19),=C'NOME RAZAO INVALIDO'
         MVI   RAZAOGA,DFHBMFSE
         MVC   POSIS,=H'0745'   POSICIONA NO PRIMEIRO BYTE DO RAZAO
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
PROTRAZ  EQU   *
         MVI   RAZAOGA,DFHBMPRF
*
VEENDER  EQU   *
         CLC   ENDERGI,=CL50' '
         BNE   PROTEND
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(17),=C'ENDERECO INVALIDO'
         MVI   ENDERGA,DFHBMFSE
         MVC   POSIS,=H'0905'   POSICIONA NO PRIMEIRO BYTE DO ENDER
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
PROTEND  EQU   *
         MVI   ENDERGA,DFHBMPRF
*
VETELEF  EQU   *
         CLC   TELEFGI,=CL16' '
         BNE   PROTTEL
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(17),=C'TELEFONE INVALIDO'
         MVC   POSIS,=H'1065'  POSICIONA NO PRIMEIRO BYTE DO FONE
         MVI   TELEFGA,DFHBMFSE
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
PROTTEL  EQU   *
         MVI   TELEFGA,DFHBMPRF
*
VECONTA  EQU   *
         CLC   CONTAGI,=CL20' '
         BNE   PROTCTA
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(17),=C'CONTATO  INVALIDO'
         MVI   CONTAGA,DFHBMFSE
         MVC   POSIS,=H'1225'   POSICIONA NO PRIMEIRO BYTE DO CONTATO
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
PROTCTA  EQU   *
         MVI   CONTAGA,DFHBMPRF
*
VAIFASE3 EQU   *
*
         MVI   CODIGA,DFHBMPRF
         MVI   RAZAOGA,DFHBMPRF
         MVI   ENDERGA,DFHBMPRF
         MVI   TELEFGA,DFHBMPRF
         MVI   CONTAGA,DFHBMPRF
         MVI   TCONFGA,DFHBMFSE
         MVC   POSIS,=H'1696'   POSICIONA NO CONFIRMA
         MVC   TDCONFGO(12),=C'CONFIRMA S/N'
         MVC   COM_FASE(5),=C'FASE3'
         MVC   OUTROGO(11),=C'ACEIT FASE3'
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
*---------------------------------------
*       ROTINA CONFIRMA REGRAVACAO
*---------------------------------------
REGRAVA  EQU   *
         CLI   TCONFGI,C'S'      CONFIRMA INCLUSAO
         BNE   VOLTMENU
*
         MVC   WKS_CODIGO(5),CODIGI
         MVC   WKS_CODIGO(5),COM_CODI
         EXEC  CICS READ FILE('CADCONS')                               X
               RIDFLD(WKS_CODIGO)                                      X
               INTO(WKS_CADCONS)                                       X
               UPDATE                                                  X
               NOHANDLE
*
         MVC   WKS_CADCONS(05),CODIREG
         MVC   WKS_CADCONS(05),COM_CODI
         MVC   WKS_CADCONS+5(30),RAZAOGI
         MVC   WKS_CADCONS+35(50),ENDERGI
         MVC   WKS_CADCONS+85(16),TELEFGI
         MVC   WKS_CADCONS+101(20),CONTAGI
         MVC   TAMANHO,=H'121'
         EXEC CICS REWRITE                                             X
              DATASET ('CADCONS')                                      X
              FROM (WKS_CADCONS)                                       X
              LENGTH(TAMANHO)                                          X
              RESP(RESPONSE)
*
         CLC   RESPONSE,DFHRESP(NORMAL)
         BNE   ERROALTE
         MVI   CODIGA,DFHBMPRF
         MVI   RAZAOGA,DFHBMPRF
         MVI   ENDERGA,DFHBMPRF
         MVI   TELEFGA,DFHBMPRF
         MVI   CONTAGA,DFHBMPRF
         MVI   TCONFGA,DFHBMFSE
         MVC   TDCONFGO(14),=C'NOVA ALTERACA:'
         MVC   POSIS,=H'1696'   POSICIONA NO CONFIRMA
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(22),=C'ALTERACAO COM SUSCESSO'
         MVC   TCONFGI,C' '
         MVC   COM_FASE(5),=C'FASE4'
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
ERROALTE EQU   *
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(17),=C'ERRO NA ALTERACAO'
         MVC   MENSAGO+17(7),=C'DUPREC'
         MVC   MENSAGO+27(05),CODIREG
         MVC   COM_FASE(5),=C'     '
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*        EXEC CICS XCTL PROGRAM('PGMENU1')
*
*---------------------------------------------
*       ROTINA PARA CONTINUA PROCESSO ALTERACAO
*---------------------------------------------
CONTPROC EQU   *
         CLI   TCONFGI,C'S'
         BNE   VOLTMENU
         EXEC CICS XCTL  PROGRAM('PGALTE1')
*
VOLTMENU EQU   *
         MVC   COM_FASE(5),=C'     '
         EXEC CICS XCTL  PROGRAM('PGMENU1')
*
*--------------------------------------
*      ROTINA DE RETORNO TRANSACAO
*--------------------------------------
RETTRAN  EQU   *
*
         EXEC  CICS RETURN                                             X
               TRANSID('ALT1')                                         X
               COMMAREA(COMAREA) NOHANDLE                              X
               LENGTH (L'COMAREA)
*
         END   PGALTE1
				
			
				
					*
*================================================================*
*                   FUTURE SCHOOL                                *
*----------------------------------------------------------------*
*                                                                *
*  PROGRAMA......: PGCONS1 - LINGUAGEM ASSEMBLY (ON-LINE)        *
*  MAPA..........: MAP3ASM - LINGUAGEM ASSEMBLY                  *
*  TRANSACAO.....: CON1                                          *
*  ARQUIVO...VSAM: CADCONS - COM TAMANHO DE 121 POSICOES         *
*                            CHAVE NAS PRIMEIRAS 5 POSICOES      *
*  DATA..........: 04/2023                                       *
*  AUTOR.........: LESSA                                         *
*                                                                *
*     OBJETIVO...:  CONSULTA DE CODIGOS CADASTRAIS               *
*                                                                *
*----------------------------------------------------------------*
*
         PRINT NOGEN
DFHEISTG DSECT
*
R0       EQU   0
R1       EQU   1
R2       EQU   2
R3       EQU   3
R4       EQU   4
R5       EQU   5
R6       EQU   6
R7       EQU   7
R8       EQU   8
R9       EQU   9
R10      EQU   10
R11      EQU   11
R12      EQU   12
R13      EQU   13
R14      EQU   14
R15      EQU   15
*
*         AREA DE COMUNICACAO (COMAREA)
*
COMAREA  DS 0CL126
FASE     DS CL5
REGISTRO DS CL121
CODIREG  DS CL5
RAZAO    DS CL30
ENDER    DS CL50
TELEF    DS CL16
CONTATO  DS CL20
         SPACE
*
*        LAYOUT DO CADASTRO COM 121 POSICOES
*
WKS_CADCONS DS CL121
WKS_CODIGO  DS 0CL5
WKS_RAZAO   DS CL30
WKS_ENDER   DS CL50
WKS_TELEF   DS CL16
WKS_CONTATO DS CL20
*
*        AREAS AUXILIARES
*
AUXTIME  DS    PL8
QFASES   DS    CL8
AUXCICS  DS    CL8
DDMMAAAA DS    CL10
AADDD    DS    CL6
DATAJUL  DS    PL3
*
AUXHORA  DS    CL8
RESPONSE DS    1F
RESP     DS    XL2
DOUBLE   DS    D
TAMANHO  DS    H
CURSOR   DS    XL2
*
         COPY  DFHBMSCA
         COPY  DFHAID
         COPY  MAP3ASM
         SPACE
*
*--------------------------------------
*    INICIO DO PROGRAMA
*--------------------------------------
PGCONS1  DFHEIENT CODEREG=R3,DATAREG=R13,EIBREG=R11
PGCONS1  AMODE 31
PGCONS1  RMODE ANY
*
INICIO   EQU   *
*
         EXEC  CICS ASSIGN  APPLID (AUXCICS) NOHANDLE
         MVC   TPOPERGO(09),=C'CONSULTA '
         CLC   EIBCALEN,=H'0'          PRIMEIRA VEZ.
         BNE   RETORNO
         XC    MAP3ASMO(MAP3ASMI-MAP3ASMO),MAP3ASMO CLEAR MAP
         MVC   TPOPERGO(09),=C'CONSULTA '
         MVI   TPOPERGA,X'61'          DFHBMPRF
         MVC   TPCICGO(8),AUXCICS
         MVI   TPCICGA,X'61'
*
         BAL   R7,PEGDATA
         MVI   DATAGA,X'61'
         MVI   TRANSGA,X'61'
         MVC   TRANSGO(4),=C'CON1'
         MVI   HORAGA,X'61'
         MVI   TERMGA,X'61'
         MVI   PROGGA,X'61'
         MVC   TERMGO,EIBTRMID
         MVC   PROGGO(8),=C'PGCONS1 '
         MVI   CODIGA,X'C1'             DFHBMFSE
         MVC   CODIGO(5),X'F0'
         MVI   RAZAOGA,X'61'
         MVC   RAZAOGO(30),=CL30' '
         MVI   ENDERGA,X'61'
         MVC   ENDERGO(50),=CL50' '
         MVC   TELEFGO(16),X'F0'
         MVI   TELEFGA,X'61'
         MVI   CONTAGA,X'61'
         MVC   CONTAGO(20),X'40'
         MVC   MENSAGO(60),=CL60' '
         MVC   CURSOR,=H'0585'   POSICIONA NO PRIMEIRO BYTE DO CODIGO
         MVC   FASE(5),=C'FASE1'
         MVC   CODIREG(5),CODIGO
         MVC   VERFASEO(5),FASE
         BAL   R7,ENVTELA
         B     RETTRAN
*
*--------------------------------------
*        ROTINA PARA PEGAR DATA E HORA
*--------------------------------------
PEGDATA  EQU   *
         EXEC  CICS ASKTIME ABSTIME(AUXTIME) NOHANDLE
*
         EXEC  CICS FORMATTIME                                         X
                    ABSTIME (AUXTIME)                                  X
                    DDMMYYYY (DDMMAAAA)                                X
                    NOHANDLE
*
         MVI   DATAGA,X'61'
         MVI   TRANSGA,X'61'
         MVI   HORAGA,X'61'
         MVI   TERMGA,X'61'
         MVC   TERMGO,EIBTRMID
         MVC   PROGGO(8),=C'PGCONS1 '
         MVC   TRANSGO(4),=C'CON1'
         MVC   TPOPERGA,X'F8'
         MVC   TPCICGO(8),AUXCICS
         MVC   DATAGO(2),DDMMAAAA
         MVI   DATAGO+2,C'/'
         MVC   DATAGO+3(2),DDMMAAAA+2
         MVI   DATAGO+5,C'/'
         MVC   DATAGO+6(4),DDMMAAAA+4
         UNPK  DOUBLE,EIBTIME
         MVC   HORAGO(2),DOUBLE+2
         MVI   HORAGO+2,C':'
         MVC   HORAGO+3(2),DOUBLE+4
         MVC   TPOPERGO(09),=C'CONSULTA '
*
         BR    R7
*
*--------------------------------------
*          ROTINA PARA ENVIAR TELA
*--------------------------------------
ENVTELA  EQU   *
*
         EXEC  CICS SEND                                               X
               MAPSET ('MAP3ASM')                                      X
               MAP    ('MAP3ASM') NOHANDLE                             X
               FROM (MAP3ASMO)                                         X
               CURSOR(CURSOR)                                          X
               FREEKB                                                  X
               ERASE
*
         BR    R7
*--------------------------------------
*        ROTINA DE RETORNO
*--------------------------------------
RETORNO  EQU   *
         L     R6,DFHEICAP      CARREGA COMMAREA
         MVC   COMAREA,0(R6)
*
         BAL   R8,RECTELA
         B     TRAFASE
*
*--------------------------------------
*        RECEBE TELA
*--------------------------------------
RECTELA  EQU   *
*
         CLC   EIBAID,DFHPF3
         BE    VOLTA
         CLC   EIBAID,DFHCLEAR
         BE    VOLTA
*
         EXEC  CICS RECEIVE                                            X
               MAP('MAP3ASM')                                          X
               MAPSET('MAP3ASM')                                       X
               INTO (MAP3ASMI)                                         X
               NOHANDLE
*
         BR    R8
*
*--------------------------------------
*      ROTINA TRATA FASE
*--------------------------------------
TRAFASE  EQU   *
*
         MVC   TPOPERGO(09),=C'CONSULTA '
         MVC   VERFASEO(5),FASE
*
         CLC   FASE,=C'FASE1'
         BE    VECODIGO
         CLC   FASE,=C'FASE2'
         BE    CONTPROC
         B     VOLTMENU
*
*--------------------------------------
* ROTINA QUE VERIFICA SE CODIGO VALIDO
*--------------------------------------
VECODIGO EQU   *
*
         MVC   CODIREG(5),CODIGI
         CLC   CODIREG(5),X'F0'     COMPARA COM ZEROS
         BE    CDINVAL           CODIGO INVALIDO
         MVC   CURSOR,=H'0585'   POSICIONA NO PRIMEIRO BYTE DO CODIGO
         B     LEITURA
*
*--------------------------------------
*      ROTINA CODIGO INVALIDO
*--------------------------------------
CDINVAL  EQU   *
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(60),=CL60' '    BRANCOS
         MVC   MENSAGO(15),=CL15'CODIGO INVALIDO'
         MVC   CURSOR,=H'0585'   POSICIONA NO PRIMEIRO BYTE DO CODIGO
         MVC   CODIGA,X'C1'            DFHBMFSE
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN         RETORNA A TRANSACAO
*
*--------------------------------------
*      ROTINA DE LEITURA
*--------------------------------------
LEITURA  EQU   *
         MVC   WKS_CODIGO,CODIGI
         MVC   TAMANHO,=H'121'
         EXEC  CICS READ                                               X
               FILE('CADCONS')                                         X
               RIDFLD(WKS_CODIGO)                                      X
               INTO(WKS_CADCONS)                                       X
               LENGTH (TAMANHO)                                        X
               RESP(RESPONSE)                                          X
               NOHANDLE
*
         CLC   RESPONSE,DFHRESP(NORMAL)
         BNE   INEXISTE
         BE    ACEITA
         B     VAIERRO
*
INEXISTE EQU   *
*
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(60),=CL60' '   PREENCHE COM BRANCOS
         MVC   MENSAGO(31),=C'CODIGO INEXISTENTE, TECLE CLEAR'
         MVI   CODIGA,X'61'
         MVC   RAZAOGO(30),X'40'      BRANCOS
         MVI   RAZAOGA,X'61'
         MVC   ENDERGO(50),X'40'
         MVI   ENDERGA,X'61'
         MVC   TELEFGO(16),X'40'
         MVI   TELEFGA,X'61'
         MVC   CONTAGO(20),X'40'
         MVI   CONTAGA,X'61'
         MVI   TCONFGA,X'61'
         MVI   TCONFGL,X'61'
         MVC   VERFASEO(5),FASE
         MVC   CURSOR,=H'0585'   POSICIONA NO PRIMEIRO BYTE DO CODIGO
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
*--------------------------------------
*      ROTINA CODIGO ACEITO
*--------------------------------------
ACEITA   EQU   *
*
         MVC   REGISTRO,WKS_CADCONS
         MVC   CODIGA,X'C1'                  DFHBMFSE
         MVC   RAZAOGA,X'C1'
         MVC   ENDERGA,X'C1'
         MVC   TELEFGA,X'C1'
         MVC   CONTAGA,X'C1'
         MVC   TCONFGA,X'C1'
         MVC   TCONFGL,=C'-1'
*
*        MOVE POR DESLOCAMENTO DA COMAREA
*
         MVC   CODIGO(05),COMAREA+5
         MVC   RAZAOGO(30),COMAREA+10
         MVC   ENDERGO(50),COMAREA+40
         MVC   TELEFGO(16),COMAREA+90
         MVC   CONTAGO(20),COMAREA+106
         MVC   FASE(5),=C'FASE2'
         MVC   VERFASEO(5),FASE
*
         MVC   TDCONFGO(14),=C'NOVA CONSULTA:'
         MVC   CURSOR,=H'1696'   POSICIONA O CURSOR EM S OU N
         MVC   OUTROGO(11),=C'DIGITE  S/N'
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
VAIERRO  EQU   *
         MVC   MENSAGO,=C'ERRO NA CONSULTA'
         MVC   FASE(5),X'40'                   MOVE BRANCOS
         MVC   CODIGO(5),X'F0'                 MOVE ZEROS
*
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
SEGUE    EQU   *
         CLC   EIBAID,DFHPF3
         BE    VOLTA
*
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
VOLTA    EQU   *
         EXEC  CICS XCTL PROGRAM('PGMENU1')
*
*---------------------------------------------
*       ROTINA PARA CONTINUA CONSULTA
*---------------------------------------------
CONTPROC EQU   *
         CLI   TCONFGI,X'E2'      COMPARA COM S
         BNE   VOLTMENU
         EXEC CICS XCTL  PROGRAM('PGCONS1')
*
VOLTMENU EQU   *
         MVC   FASE(5),X'40'      BRANCOS EM FASE
         MVC   CODIGO(5),X'F0'    ZEROS EM CODIGO
         EXEC CICS XCTL  PROGRAM('PGMENU1')
*
*--------------------------------------
*      ROTINA DE RETORNO TRANSACAO
*--------------------------------------
RETTRAN  EQU   *
*
         EXEC  CICS RETURN                                             X
               TRANSID('CON1')                                         X
               LENGTH (L'COMAREA)                                      X
               COMMAREA(COMAREA)
*
         END   PGCONS1
				
			
				
					*
*================================================================*
*                   FUTURE SCHOOL                                *
*----------------------------------------------------------------*
*                                                                *
*  PROGRAMA......: PGEXCL1 - LINGUAGEM ASSEMBLY (ON-LINE)        *
*  MAPA..........: MAP3ASM - LINGUAGEM ASSEMBLY                  *
*  TRANSACAO.....: EXC1                                          *
*  ARQUIVO...VSAM: CADCONS - COM TAMANHO DE 121 POSICOES         *
*                            CHAVE NAS PRIMEIRAS 5 POSICOES      *
*  DATA..........: 05/2023                                       *
*  AUTOR.........: LESSA                                         *
*                                                                *
*     OBJETIVO...:  EXCLUSAO DE CODIGOS CADASTRAIS               *
*                                                                *
*----------------------------------------------------------------*
*
         PRINT NOGEN
DFHEISTG DSECT
*
R0       EQU   0
R1       EQU   1
R2       EQU   2
R3       EQU   3
R4       EQU   4
R5       EQU   5
R6       EQU   6
R7       EQU   7
R8       EQU   8
R9       EQU   9
R10      EQU   10
R11      EQU   11
R12      EQU   12
R13      EQU   13
R14      EQU   14
R15      EQU   15
*
*         AREA DE COMUNICACAO (COMAREA)
*
COMAREA  DS 0CL5
FASE     DS CL5
*
REGISTRO DS CL121
CODIREG  DS CL5
RAZAO    DS CL30
ENDER    DS CL50
TELEF    DS CL16
CONTATO  DS CL20
         SPACE
*
*        LAYOUT DO CADASTRO COM 121 POSICOES
*
WKS_CADCONS DS CL121
WKS_CODIGO  DS 0CL5
WKS_RAZAO   DS CL30
WKS_ENDER   DS CL50
WKS_TELEF   DS CL16
WKS_CONTATO DS CL20
*
*        AREAS AUXILIARES
*
DATASET  DS    CL8
POSIS    DS    XL2
AUXTIME  DS    PL8
QFASES   DS    CL8
AUXCICS  DS    CL8
DDMMAAAA DS    CL10
AADDD    DS    CL6
DATAJUL  DS    PL3
*
AUXHORA  DS    CL8
RESPONSE DS    1F
RESP     DS    XL2
DOUBLE   DS    D
TAMANHO  DS    H
*
         COPY  DFHBMSCA
         COPY  DFHAID
         COPY  MAP3ASM
         SPACE
*
*--------------------------------------
*    INICIO DO PROGRAMA
*--------------------------------------
PGEXCL1  DFHEIENT CODEREG=R3,DATAREG=R13,EIBREG=R11
PGEXCL1  AMODE 31
PGEXCL1  RMODE ANY
*
INICIO   EQU   *
*
         EXEC  CICS ASSIGN  APPLID (AUXCICS) NOHANDLE
         MVC   TPOPERGO(09),=C'EXCLUSAO '
         CLC   EIBCALEN,=H'0'          PRIMEIRA VEZ.
         BNE   RETORNO
         XC    MAP3ASMO(MAP3ASMI-MAP3ASMO),MAP3ASMO CLEAR MAP
         MVC   TPOPERGO(09),=C'EXCLUSAO '
         MVI   TPOPERGA,X'61'          DFHBMPRF
         MVC   TPCICGO(8),AUXCICS
         MVI   TPCICGA,X'61'
*
         BAL   R7,PEGDATA
         MVI   DATAGA,X'61'
         MVI   TRANSGA,X'61'
         MVC   TRANSGO(4),=C'EXC1'
         MVI   HORAGA,X'61'
         MVI   TERMGA,X'61'
         MVI   PROGGA,X'61'
         MVC   TERMGO,EIBTRMID
         MVC   PROGGO(8),=C'PGEXCL1 '
         MVI   CODIGA,X'C1'             DFHBMFSE
         MVC   CODIGO(5),X'F0'
         MVI   RAZAOGA,X'61'
         MVC   RAZAOGO(30),=CL30' '
         MVI   ENDERGA,X'61'
         MVC   ENDERGO(50),=CL50' '
         MVC   TELEFGO(16),X'F0'
         MVI   TELEFGA,X'61'
         MVI   CONTAGA,X'61'
         MVC   CONTAGO(20),X'40'
         MVC   MENSAGO(60),=CL60' '
         MVC   POSIS,=H'0585'   POSICIONA NO PRIMEIRO BYTE DO CODIGO
         MVC   FASE(5),=C'FASE1'
         MVC   CODIREG(5),CODIGO
         MVC   VERFASEO(5),FASE
         BAL   R7,ENVTELA
         B     RETTRAN
*
*--------------------------------------
*        ROTINA PARA PEGAR DATA E HORA
*--------------------------------------
PEGDATA  EQU   *
         EXEC  CICS ASKTIME ABSTIME(AUXTIME) NOHANDLE
*
         EXEC  CICS FORMATTIME                                         X
                    ABSTIME (AUXTIME)                                  X
                    DDMMYYYY (DDMMAAAA)                                X
                    NOHANDLE
*
         MVI   DATAGA,X'61'
         MVI   TRANSGA,X'61'
         MVI   HORAGA,X'61'
         MVI   TERMGA,X'61'
         MVC   TERMGO,EIBTRMID
         MVC   PROGGO(8),=C'PGEXCL1 '
         MVC   TRANSGO(4),=C'EXC1'
         MVC   TPOPERGA,X'F8'
         MVC   TPCICGO(8),AUXCICS
         MVC   DATAGO(2),DDMMAAAA
         MVI   DATAGO+2,C'/'
         MVC   DATAGO+3(2),DDMMAAAA+2
         MVI   DATAGO+5,C'/'
         MVC   DATAGO+6(4),DDMMAAAA+4
         UNPK  DOUBLE,EIBTIME
         MVC   HORAGO(2),DOUBLE+2
         MVI   HORAGO+2,C':'
         MVC   HORAGO+3(2),DOUBLE+4
         MVC   TPOPERGO(09),=C'EXCLUSAO '
*
         BR    R7
*
*--------------------------------------
*          ROTINA PARA ENVIAR TELA
*--------------------------------------
ENVTELA  EQU   *
*
         EXEC  CICS SEND                                               X
               MAPSET ('MAP3ASM')                                      X
               MAP    ('MAP3ASM') NOHANDLE                             X
               FROM (MAP3ASMO)                                         X
               CURSOR(POSIS)                                           X
               FREEKB                                                  X
               ERASE
*
         BR    R7
*--------------------------------------
*        ROTINA DE RETORNO
*--------------------------------------
RETORNO  EQU   *
*
         EXEC  CICS HANDLE AID                                         X
               PF3(VOLTMENU)                                           X
               CLEAR(VOLTMENU)
*
         L     R6,DFHEICAP      CARREGA COMMAREA
         MVC   COMAREA,0(R6)
*
         BAL   R8,RECTELA
         B     TRAFASE
*
*--------------------------------------
*        RECEBE TELA
*--------------------------------------
RECTELA  EQU   *
*
         CLI   EIBAID,DFHPF3
         BE    VOLTMENU
         CLI   EIBAID,DFHCLEAR
         BE    VOLTMENU
*
         EXEC  CICS RECEIVE                                            X
               MAP('MAP3ASM')                                          X
               MAPSET('MAP3ASM')                                       X
               INTO (MAP3ASMI)                                         X
               NOHANDLE
*
         BR    R8
*
*--------------------------------------
*      ROTINA TRATA FASE
*--------------------------------------
TRAFASE  EQU   *
*
         MVC   TPOPERGO(09),=C'EXCLUSAO '
         MVC   VERFASEO(5),FASE
*
         CLC   FASE,=C'FASE1'
         BE    VECODIGO
         CLC   FASE,=C'FASE2'
         BE    EXCLUSAO
         CLC   FASE,=C'FASE3'
         BE    CONTPROC
         B     VOLTMENU
*
*--------------------------------------
* ROTINA QUE VERIFICA SE CODIGO VALIDO
*--------------------------------------
VECODIGO EQU   *
*
         MVC   CODIREG(5),CODIGI
         CLC   CODIREG(5),X'F0'     COMPARA COM ZEROS
         BE    CDINVAL              CODIGO INVALIDO
         MVC   POSIS,=H'0585'    POSICIONA NO PRIMEIRO BYTE DO CODIGO
         B     LEITURA
*
*--------------------------------------
*      ROTINA CODIGO INVALIDO
*--------------------------------------
CDINVAL  EQU   *
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(60),=CL60' '    BRANCOS
         MVC   MENSAGO(15),=CL15'CODIGO INVALIDO'
         MVC   POSIS,=H'0585'   POSICIONA NO PRIMEIRO BYTE DO CODIGO
         MVC   CODIGA,X'C1'            DFHBMFSE
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN         RETORNA A TRANSACAO
*
*--------------------------------------
*      ROTINA DE LEITURA
*--------------------------------------
LEITURA  EQU   *
         MVC   WKS_CODIGO(5),CODIGI
         MVC   TAMANHO,=H'121'
         EXEC  CICS READ DATASET ('CADCONS')                           X
               RIDFLD(WKS_CODIGO)                                      X
               INTO(WKS_CADCONS)                                       X
               LENGTH (TAMANHO)                                        X
               RESP(RESPONSE)                                          X
               NOHANDLE
*
         CLC   RESPONSE,DFHRESP(NORMAL)
         BNE   INEXISTE
         BE    ACEITA
         B     VAIERRO
*
*--------------------------------------
*      ROTINA DE CODIGO INEXISTENTE
*--------------------------------------
INEXISTE EQU   *
*
         MVI   MENSAGA,X'F8'
         MVC   MENSAGO(60),=CL60' '   PREENCHE COM BRANCOS
         MVC   MENSAGO(31),=C'CODIGO INEXISTENTE, TECLE CLEAR'
         MVI   CODIGA,X'61'           DFHBMPRF
         MVC   RAZAOGO(30),X'40'      BRANCOS
         MVI   RAZAOGA,X'61'
         MVC   ENDERGO(50),X'40'
         MVI   ENDERGA,X'61'
         MVC   TELEFGO(16),X'40'
         MVI   TELEFGA,X'61'
         MVC   CONTAGO(20),X'40'
         MVI   CONTAGA,X'61'
         MVI   TCONFGA,X'61'
         MVI   TCONFGL,X'61'
         MVC   VERFASEO(5),FASE
         MVC   POSIS,=H'0585'   POSICIONA NO PRIMEIRO BYTE DO CODIGO
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
*--------------------------------------
*    ROTINA CODIGO ACEITO (ENCONTRADO)
*--------------------------------------
ACEITA   EQU   *
*
         MVC   MENSAGO(60),=CL60' '   PREENCHE COM BRANCOS
         MVC   MENSAGO(17),=C'CODIGO ENCONTRATO'
         MVC   CODIGO(05),WKS_CADCONS
         MVC   RAZAOGO(30),WKS_CADCONS+5
         MVC   ENDERGO(50),WKS_CADCONS+35
         MVC   TELEFGO(16),WKS_CADCONS+85
         MVC   CONTAGO(20),WKS_CADCONS+101
*
         MVI   CODIGA,X'F9'       PROTEGE  CAMPO CODIGO
         MVC   RAZAOGA,X'61'
         MVC   ENDERGA,X'61'
         MVC   TELEFGA,X'61'                 DFHBMPRF
         MVC   CONTAGA,X'61'
         MVC   TCONFGA,X'C1'                 DFHBMFSE
         MVC   TCONFGL,=C'-1'
         MVC   FASE(5),=C'FASE2'
         MVC   TDCONFGO(14),=C'EXCLUIR (S/N)?'
         MVC   POSIS,=H'1696'   POSICIONA NO CONFIRMA
         MVC   VERFASEO(5),FASE
*
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
*--------------------------------------
*       ROTINA CONFIRMA EXCLUSAO
*--------------------------------------
EXCLUSAO EQU   *
*
         CLI   TCONFGI,C'S'     CONFIRMA EXCLUSAO
         BNE   VOLTMENU
*
         MVC   WKS_CODIGO(5),CODIGI
         MVC   TAMANHO,=H'121'
         EXEC  CICS DELETE                                             X
               DATASET('CADCONS')                                      X
               RIDFLD(WKS_CODIGO)                                      X
               KEYLENGTH(+05)                                          X
               RESP(RESPONSE)                                          X
               NOHANDLE
*
         MVC   CODIGA,X'61'                  DFHBMPRF
         MVC   RAZAOGA,X'61'
         MVC   ENDERGA,X'61'
         MVC   TELEFGA,X'61'
         MVC   CONTAGA,X'61'
         MVC   TCONFGA,X'C1'                 DFHBMFSE
         MVC   TCONFGL,=C'-1'
*
         CLC   RESPONSE,DFHRESP(NORMAL)
         BNE   ERROEXCL
         MVI   TCONFGI,C' '
         MVC   TDCONFGO(14),=C'NOVA EXCLUSAO:'
         MVC   POSIS,=H'1696'   POSICIONA EM NOVA EXCLUSAO
         MVC   MENSAGO(60),=CL60' '   PREENCHE COM BRANCOS
         MVC   MENSAGO(20),=C'EXCLUSAO COM SUCESSO'
         MVC   FASE(5),=C'FASE3'
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
*--------------------------------------
*       ROTINA ERRO DE EXCLUSAO
*--------------------------------------
*
ERROEXCL EQU   *
         MVI   MENSAGA,X'F8'
         MVC   FASE(5),=C'     '      BRANCOS EM FASE
         MVC   MENSAGO(60),=CL60' '   PREENCHE COM BRANCOS
         MVC   MENSAGO(16),=C'ERRO NA EXCLUSAO'
         MVC   CODIGO(5),X'F0'                 MOVE ZEROS
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
*--------------------------------------
*       ERRO DA ROTINA DE LEITURA
*--------------------------------------
*
VAIERRO  EQU   *
         MVC   MENSAGO,=C'ERRO NA LEITURA'
         MVC   FASE(5),X'40'                   MOVE BRANCOS
         MVC   CODIGO(5),X'F0'                 MOVE ZEROS
*
         BAL   R7,PEGDATA
         BAL   R7,ENVTELA
         B     RETTRAN
*
*---------------------------------------------
*       ROTINA PARA CONTINUA EXCLUSAO
*---------------------------------------------
CONTPROC EQU   *
         CLI   TCONFGI,C'S'     CONFIRMA EXCLUSAO
         BNE   VOLTMENU
         MVC   CODIGO(5),X'F0'    ZEROS EM CODIGO
         EXEC CICS XCTL  PROGRAM('PGEXCL1')
*
*---------------------------------------------
*       ROTINA PARA VOLTA AO MENU
*---------------------------------------------
VOLTMENU EQU   *
         MVC   FASE(5),X'40'      BRANCOS EM FASE
         MVC   CODIGO(5),X'F0'    ZEROS EM CODIGO
         EXEC CICS XCTL  PROGRAM('PGMENU1')
*
*--------------------------------------
*      ROTINA DE RETORNO TRANSACAO
*--------------------------------------
RETTRAN  EQU   *
*
         EXEC  CICS RETURN                                             X
               TRANSID('EXC1')                                         X
               LENGTH (L'COMAREA)                                      X
               COMMAREA(COMAREA)
*
         END   PGEXCL1
				
			

Ainda tem dúvidas?

Entre em contato conosco para mais informações via whatsapp abaixo.

Formulário para WhatsApp

Envie suas dúvidas sobre o Exercício prático da linguagem de programação Assembly (On-line), via whatsapp aqui…

Participe!

 Doar para a “Future School EAD” é essencial para manter e expandir o acesso à educação gratuita em informática. Esta escola oferece cursos de alta qualidade sem custo, capacitando jovens e adultos com habilidades essenciais para o mercado de trabalho atual.

Sua contribuição permite que mais pessoas transformem suas vidas por meio do aprendizado digital, reduzindo desigualdades sociais e promovendo a inclusão digital. Apoiar a Future School EAD é investir em um futuro mais justo e tecnológico para todos.

 

Participe do grupo do WhatsAapp (11-98342.2503) no plantão de dúvidas (Sábados).

Você quer ajudar a manter este site?

PIX é celular (11-98342.2503) Favorecido: Jorge Gilberto.

Descubra uma ampla variedade de cursos online para expandir seus conhecimentos e impulsionar sua carreira.

Inscrever

Tire suas dúvidas acerca desse curso além  de receber nossas novidades e atualizações por e-mail.

Ao se inscrever, você concorda com nossa
Política de Privacidade e autoriza o recebimento de atualizações da nossa empresa. 

© 2017/2024 Future School EAD. Todos os direitos reservados | Desenvolvido por Poeta Alberto Lima Soluções Digitais.