Usina BRAdvPL Guide
Sign in
← All topics
HISTORICAL SOURCEPublished

Protheus Programming Manual (2001)

31 páginas · qualidade · variáveis · banco de dados · interfaces · customização

Review programming principles and upgrade cautions from an AP5/TopConnect-era internal manual.

HistoryBest practicesProtheusAP5ReferenceEditorial planning
01 · OVERVIEW

Overview

This 31-page collaborative Microsiga manual covers readability, documentation, variables, record positioning, reports, interfaces, entry points, SX dictionaries, transactions, preprocessor directives, queries, branches, referential integrity and automatic routines. Its general principles remain useful, but product names, functions and procedures require confirmation against current TDN documentation.

02 · SYNTAX

Syntax

31 páginas · qualidade · variáveis · banco de dados · interfaces · customização

Parameters

Qualidade e documentação
SeçãoOptional

Planning, testing, impact, useful comments, headers and expressive names.

Variáveis e estado
SeçãoOptional

Declaration, initialization, scope and work-area preservation.

Dados e relatórios
SeçãoOptional

Searches, indexes, filters, branches, totals and loop safety.

Customização
SeçãoOptional

Entry points, SX dictionaries, transactions, includes and localization.

Arquitetura e integração
SeçãoOptional

Client/server files, TopConnect, queries, integrity and automatic routines.

03 · PRACTICAL EXAMPLE

Modern checklist derived from the manual

// See the Portuguese example; localize only user-facing text.
Expected result

Historical principles become verifiable modern review criteria.

04 · PRACTICAL EXAMPLE

Safe read with environment restoration

User Function ExLeituraSegura()
    Local aArea := GetArea()

    DbSelectArea("SB1")
    DbSetOrder(1)
    If SB1->(DbSeek(xFilial("SB1") + "000001"))
        ConOut(SB1->B1_DESC)
    EndIf

    RestArea(aArea)
Return
Expected result

The search is checked and the caller work area is restored.

BEST PRACTICES
  • Study the routine and its consumers before changing code.
  • Document intent, rules, preconditions and impact.
  • Declare and initialize variables explicitly with the narrowest suitable scope.
  • Validate searches and restore received work-area state.
  • Give every loop an exit condition, cursor advance and branch boundary.
  • Centralize shared report and query rules.
  • Use current supported mechanisms for dictionary changes.
COMMON PITFALLS
  • AP5, TopConnect, ATUSX, Quark and SourceSafe are historical context.
  • Some signatures contain typographical or parameter inconsistencies.
  • Historical internal functions and practices are not universal modern rules.
  • Accounting, file-transfer and automation APIs vary by module and release.
  • No individual author or edition is identified.

Related content

REFERENCES
  1. MICROSIGA. Programming Manual. Collaborative document with no individual author or edition identified. Supplied file dated July 11, 2001, 31 pages.
Status
Published
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR