blob: b98a7537ceabb95eb685f0349ef75b80eae95f44 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
*> ---------------------------------------------------------------------
*> Status layout without its 01 level, so the library can keep a private
*> scratch status alongside the caller's without duplicating the
*> definition. Replace the field-name tag and the two level numbers.
*>
*> The six failure categories are split by the decision the caller has to
*> make, not by the HTTP status that produced them.
*> ---------------------------------------------------------------------
:L1: :P:-STATUS-CODE PIC 9(2).
88 :P:-OK VALUE 0.
88 :P:-INVALID-CEP VALUE 1.
88 :P:-NOT-FOUND VALUE 2.
88 :P:-RATE-LIMITED VALUE 3.
88 :P:-SERVER-ERROR VALUE 4.
88 :P:-NETWORK-ERROR VALUE 5.
88 :P:-INVALID-RESPONSE VALUE 6.
88 :P:-FAILED VALUE 1 THRU 6.
88 :P:-RETRIABLE VALUE 3 THRU 5.
:L1: :P:-STATUS-MESSAGE PIC X(200).
:L1: :P:-STATUS-HTTP PIC 9(3).
:L1: :P:-STATUS-RETRY-AFTER-MS PIC S9(9)
SIGN IS LEADING SEPARATE.
:L1: :P:-STATUS-ATTEMPTS PIC 9(4).
*> The municipality a CEP that does not exist would have belonged to.
*> Context for the error, never an address: the lookup is still
*> :P:-NOT-FOUND and CEPIS-ADDRESS is still empty. Only GET /{cep} fills
*> it, so it stays absent after a batch or a health call.
*>
*> :P:-FAIXA-CEP-INI and :P:-FAIXA-CEP-FIM are the smallest and the
*> largest CEP the municipality actually has, not the bounds the Correios
*> publish -- the DNE's own start for Areal/RJ is 25845000, exactly the
*> CEP that just failed. The range is sparse: Areal's 118 CEPs are
*> scattered over the ~4900 numbers between 25845001 and 25849899, so the
*> pair is a span to show a human, never a list of valid CEPs. That is
*> what :P:-FAIXA-CEPS counts.
*>
*> The API omits "faixa" -- it never sends null -- when the CEP falls in
*> a band no municipality owns, so test the flag before reading anything
*> below it.
:L1: :P:-FAIXA.
:L2: :P:-FAIXA-PRESENT PIC X.
88 :P:-FAIXA-KNOWN VALUE "Y".
88 :P:-FAIXA-ABSENT VALUE "N".
:L2: :P:-FAIXA-LOCALIDADE PIC X(100).
:L2: :P:-FAIXA-UF PIC X(2).
:L2: :P:-FAIXA-ESTADO PIC X(60).
:L2: :P:-FAIXA-REGIAO PIC X(30).
:L2: :P:-FAIXA-IBGE PIC X(10).
:L2: :P:-FAIXA-CEP-INI PIC X(8).
:L2: :P:-FAIXA-CEP-FIM PIC X(8).
:L2: :P:-FAIXA-CEPS PIC 9(9).
|