From 4014037e505876ed8c4df229ace3a65092e64ca8 Mon Sep 17 00:00:00 2001 From: Murilo Ijanc Date: Mon, 27 Jul 2026 20:39:38 -0300 Subject: Expose the faixa a missing CEP would have belonged to A CEP that fails is rarely a random number: it is someone who knows the city and guessed the digits, and the classic guess is the -000 that 957 municipalities never received. The API now attaches that municipality to the 404, and a caller left with nothing but "does not exist" cannot tell a typo in a real city from a CEP that was never plausible. It goes in CEPIS-STATUS, not CEPIS-ADDRESS. The call has still failed and the address is still empty; putting a localidade where the address lives would let a caller that forgets to test the status read Areal as the answer to a CEP that does not exist. Parsing is best effort throughout. faixa is omitted rather than sent as null for a band no municipality owns, so its absence is the normal case and there is a flag instead of a marker value; a block that is missing, is not an object, or is short of localidade, uf, cep_ini, cep_fim and ceps is dropped and the not-found comes back clean. Failing a 404 the caller already understands over a decoration on it would be a poor trade. cep_ini and cep_fim are the CEPs that exist, not the bounds the Correios publish, and the span between them is mostly empty -- hence ceps beside them, so the pair is not read as a list. --- copy/cepis.cpy | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'copy/cepis.cpy') diff --git a/copy/cepis.cpy b/copy/cepis.cpy index 59d643c..84a9976 100644 --- a/copy/cepis.cpy +++ b/copy/cepis.cpy @@ -1,5 +1,5 @@ *> --------------------------------------------------------------------- -*> cepis 0.1.0 -- public data layouts for the cep.is client. +*> cepis 0.2.0 -- public data layouts for the cep.is client. *> *> Copy this into WORKING-STORAGE (callers) or LINKAGE (subprograms). *> It defines, in order: @@ -34,9 +34,13 @@ *> categories are split by the decision the caller has to make, not by *> the HTTP status that produced them. CEPIS-RETRIABLE covers the three *> the client already retried on its own before giving up. +*> +*> A CEPIS-NOT-FOUND may also carry CEPIS-FAIXA, the municipality the +*> missing CEP would have belonged to. CEPIS-FAIXA-PRESENT says whether +*> it does; the call has still failed either way. 01 CEPIS-STATUS. COPY "cepis-status.cpy" REPLACING - ==:P:== BY ==CEPIS== ==:L1:== BY ==05==. + ==:P:== BY ==CEPIS== ==:L1:== BY ==05== ==:L2:== BY ==10==. *> A CEP as the caller has it: "01001-000", "01001000" or "01001.000". 01 CEPIS-CEP-INPUT PIC X(20). -- cgit v1.3