Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Identification Division.
- Program-Id. LOCAL-DAT.
- Environment Division.
- special-names. decimal-point is comma.
- input-output section.
- file-control.
- select LOCAL assign to disk
- organization indexed
- access mode dynamic
- record key codigo-local
- alternate record key desc-local
- file status arqst-LO.
- select DEPTOS assign to disk
- organization indexed
- access mode dynamic
- record key codigo-depto
- alternate record key nome-depto
- file status arqst-DP.
- data division.
- file section.
- fd LOCAL label record standard
- value of file-id is "LOCAL.dat".
- 01 reg-local.
- 02 codigo-local pic 9(04).
- 02 desc-local pic x(30).
- 02 area-local pic 9(05).
- 02 codigo-dep pic 9(04).
- fd DEPTOS label record standard
- value of file-id is "DEPTOS.dat".
- 01 reg-depto.
- 02 codigo-depto pic 9(04).
- 02 nome-depto pic x(30).
- 02 responsavel pic x(30).
- 02 divisao-depto pic 9(02).
- working-storage section.
- 01 reg-local-e.
- 02 codigo-local-e pic 9(04).
- 02 desc-local-e pic x(30).
- 02 area-local-e pic 9(05).
- 02 codigo-dep-e pic 9(04).
- 01 reg-depto-e.
- 02 codigo-depto-e pic 9(04).
- 02 nome-depto-e pic x(30).
- 02 responsavel-e pic x(30).
- 02 divisao-depto-e pic 9(02).
- 01 data-sis.
- 02 ano pic 9999.
- 02 mes pic 99.
- 02 dia pic 99.
- 01 desmes.
- 02 filler pic x(10) value "Janeiro".
- 02 filler pic x(10) value "Fevereiro".
- 02 filler pic x(10) value "Mar‡o".
- 02 filler pic x(10) value "Abril".
- 02 filler pic x(10) value "Maio".
- 02 filler pic x(10) value "Junho".
- 02 filler pic x(10) value "Julho".
- 02 filler pic x(10) value "Agosto".
- 02 filler pic x(10) value "Setembro".
- 02 filler pic x(10) value "Outubro".
- 02 filler pic x(10) value "Novembro".
- 02 filler pic x(10) value "Dezembro".
- 01 tabela-meses redefines desmes.
- 02 mes-t pic x(10) occurs 12 times.
- 01 arqst-LO pic x(2).
- 01 arqst-DP pic x(2).
- 01 op pic x(1) value spaces.
- 01 salva pic x(1) value spaces.
- 01 wigual pic 9 value zeros.
- 01 espaco pic x(60) value spaces.
- 01 op-continua pic x(1) value spaces.
- screen section.
- 01 tela1.
- 02 BLANK SCREEN.
- 02 line 02 col 5 value "Santos, de de .".
- 02 line 02 col 55 value "Nome da Empresa qota".
- 02 line 04 col 29 value "Controle de Patrimonio" highlight.
- 02 line 06 col 29 value "1. Inclusao de novos Locais".
- 02 line 08 col 29 value "2. Alteracao de Locais Cadastrados".
- 02 line 10 col 29 value "3. Exclusao de Locais Cadastrados".
- 02 line 12 col 29 value "4. Consulta por Codigo".
- 02 line 16 col 29 value "5. Retorno".
- 02 line 20 col 25 value "Escolha uma Opcao:".
- 01 tela2.
- 02 BLANK SCREEN.
- 02 line 02 col 05 value "Santos, de de .".
- 02 line 06 col 19 value "Codigo Local: ".
- 02 line 08 col 19 value "Nome Local: ".
- 02 line 10 col 19 value "Area local: ".
- 02 line 12 col 19 value "Codigo departamento: ".
- 02 line 14 col 19 value "Divisao departamento: ".
- Procedure Division.
- Inicio.
- Perform abre-arq-LO.
- perform abre-arq-dp.
- Perform abertura until op = "5".
- CLOSE DEPTOS.
- CLOSE LOCAL.
- STOP run.
- abre-arq-dp.
- open i-o DEPTOS.
- if arqst-dp not = "00"
- display "erro de abertura Departamento" at 2155
- stop " "
- close DEPTOS
- STOP RUN.
- abre-arq-LO.
- open i-o LOCAL.
- if arqst-LO not = "00"
- display "erro de abertura Local" at 2155
- close LOCAL
- open output LOCAL
- STOP RUN.
- abertura.
- display tela1.
- Perform mostra-data.
- accept op at 2045 WITH PROMPT AUTO.
- move spaces to op-continua
- evaluate op
- when "1"
- perform inclusao until op-continua = "n" or "N"
- when "2"
- perform alteracao until op-continua = "n" or "N"
- when "3"
- perform exclusao until op-continua = "n" or "N"
- when "4"
- perform consulta until op-continua = "n" or "N".
- mostra-data.
- move function current-date to data-sis.
- display dia at 0213.
- display mes-t(mes) at 0219.
- display ano at 0233.
- inclusao.
- perform tela-inclusao.
- move zeros to wigual.
- perform inicializar.
- perform testa-cod-local until wigual = 1.
- perform recebe-dados.
- move zeros to wigual.
- perform testa-cod-depto until wigual = 1.
- move divisao-depto to divisao-depto-e.
- display divisao-depto-e at 1442.
- perform grava.
- perform continua.
- tela-inclusao.
- display tela2.
- display "Cadastro de Locais" at 0430 with highlight.
- perform mostra-data.
- inicializar.
- move spaces to op op-continua salva.
- move spaces to nome-depto-e desc-local-e.
- move zeros to codigo-depto-e divisao-depto-e area-local-e codigo-local-e codigo-dep-e.
- move zeros to wigual.
- display espaco at 2315.
- recebe-dados.
- perform testa-desc-local until desc-local-e not = spaces.
- perform testa-area-local until area-local-e not = zeros.
- testa-area-local.
- accept area-local-e at 1032.
- if area-local-e = spaces then
- display "Digite a area do local." at 2321
- else
- display espaco at 2321.
- * fazer mostra tipo depto
- testa-cod-depto.
- move 1 to wigual.
- move zeros to codigo-depto-e.
- accept codigo-depto-e at 1242 with prompt auto.
- if codigo-depto-e = zeros or spaces then
- display "Digite um codigo diferente de zero." at 2321
- set wigual to 0
- else
- move spaces to espaco.
- move codigo-depto-e to codigo-depto
- read DEPTOS not invalid key move reg-depto to reg-depto-e
- move codigo-depto-e to codigo-dep-e
- read DEPTOS invalid key perform nao-cadastrado.
- nao-cadastrado.
- display "Departamento nao cadastrado" at 2321
- set wigual to 0.
- testa-cod-local.
- move 1 to wigual.
- move zeros to codigo-local-e.
- accept codigo-local-e at 0632 with prompt auto.
- if codigo-local-e = zeros or spaces then
- display "Digite um codigo diferente de zero." at 2321
- set wigual to 0
- else
- move spaces to espaco.
- move codigo-local-e to codigo-local
- read LOCAL not invalid key perform ja-cadastrado.
- ja-cadastrado.
- display "Codigo ja cadastrado" at 2321
- set wigual to 0.
- testa-desc-local.
- accept desc-local-e at 0832.
- if desc-local-e = spaces then
- display "Digite o nome do local." at 2321
- else
- display espaco at 2321.
- grava.
- display "Salvar <S/N> [ ]" at 2321.
- accept salva at 2335 with prompt auto.
- if salva = "S" or "s" then
- move reg-local-e to reg-local
- write reg-local
- if arqst-LO <> "00"
- display arqst-DP at 2221
- display arqst-LO at 2321
- STOP " ".
- continua.
- display espaco at 2315.
- display "Continua <S/N> [ ]" at 2321.
- accept op-continua at 2337 with prompt auto.
- exclusao.
- perform inicializar.
- display erase at 0101.
- display tela2.
- display "Exclusao de Local" at 0430 with highlight.
- perform inicializar.
- perform le-dados.
- if arqst-LO = "00" then
- display "Deseja excluir o registro<S/N> [ ]" at 2319
- accept salva at 2351 with prompt auto
- else
- perform inicializar
- display espaco at 2319
- display "Registro nao encontrado." at 2321.
- if salva = "S" or "s" then
- display espaco at 2319
- Display "Registro apagado." at 2321
- delete LOCAL.
- stop " ".
- display espaco at 2315.
- perform continua.
- estuda-erro.
- display "Codigo nao encontrado." at 2321.
- stop " ".
- consulta.
- display erase at 0101.
- display tela2.
- display "Consulta de Registro" at 0430 with highlight.
- perform le-dados.
- perform continua.
- le-dados.
- perform inicializar.
- perform mostra-data.
- accept codigo-local-e at 0633.
- move codigo-local-e to codigo-local.
- read LOCAL key is codigo-local invalid key
- display "Local não encontrado" at 2320
- move 1 to wigual
- stop " ".
- if arqst-LO = "00" then
- display espaco at 2319
- perform mostra-tela.
- mostra-tela.
- move reg-local to reg-local-e.
- move codigo-dep-e to codigo-depto.
- read DEPTOS key is codigo-depto not invalid key move reg-depto to reg-depto-e.
- display codigo-local-e at 0633.
- display desc-local-e at 0833.
- display area-local-e at 1033.
- display codigo-dep-e at 1242.
- display divisao-depto-e at 1442.
- altera-dados.
- accept codigo-local-e at 0633 with prompt auto.
- accept desc-local-e at 0833.
- accept area-local-e at 1033.
- perform testa-cod-depto until wigual = 1.
- move divisao-depto to divisao-depto-e.
- display espaco at 1442.
- display divisao-depto-e at 1442.
- alteracao.
- perform inicializar.
- display erase at 0101.
- display tela2.
- display "Alteracao de Registro" at 0425 with highlight.
- perform le-dados.
- if wigual <> 1
- perform altera-dados
- display "Deseja salvar alteracao <S/N> [ ]" at 2319
- accept salva at 2350 with prompt auto
- if salva = "S" or "s" then
- move reg-local-e to reg-local
- rewrite reg-local invalid key perform estuda-erro
- display espaco at 2315.
- perform continua.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement