$set callfh"extmysql" ************************************************************** * PROGRAMA - TSMYSQLC Demontra uso do comando MysqlQueryFcd * ************************************************************** IDENTIFICATION DIVISION. PROGRAM-ID. TSMYSQL. DATE-COMPILED. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT CADASTRO ASSIGN TO DYNAMIC W-ARQUIVOS ORGANIZATION IS INDEXED *> Tipo de arquivo ACCESS MODE IS DYNAMIC *> Forma de acesso aos dados do arquivo FILE STATUS IS ESTADO *> Campo que armazena FILE STATUS LOCK MODE IS AUTOMATIC *> Bloqueio de registros automático WITH ROLLBACK *> Usa transação para efetivar os I-O RECORD KEY IS CD-CHA. DATA DIVISION. FILE SECTION. FD CADASTRO. 01 CD-REG. 02 CD-CHA PIC X(18). *> Chave principal 02 CD-LIMPA. 03 CD-DES PIC X(60). *> Descrição do produto 03 CD-UME PIC X(02). *> Unidade de medida 03 CD-UPE PIC X(02). *> Unidade de Peso 03 CD-QEM PIC S9(05)V9999 COMP-3. *> Quantidade a movimentar 03 CD-PES PIC S9(06)V9999 COMP-3. *> peso bruto 03 CD-MIN PIC S9(09)V99 COMP-3. *> qtde de estoque mínimo 03 CD-MAX PIC S9(09)V99 COMP-3. *> qtde de estoque máximo 03 CD-MAR PIC S9(03)V99 COMP-3. *> Margem de lucro 03 CD-PVA PIC S9(11)V9999 COMP-3. *> Preco de venda A 03 CD-PVB PIC S9(11)V9999 COMP-3. *> Preco de venda B 03 CD-PVC PIC S9(11)V9999 COMP-3. *> Preco de venda C 03 CD-PVD PIC S9(11)V9999 COMP-3. *> Preco de venda D WORKING-STORAGE SECTION. 77 W-DTCMP PIC X(20) VALUE SPACES. 77 W-ARQUIVOS PIC X(128) VALUE Z"@127.0.0.1@3306@root@@imed@cadastro". 77 W-COMANDO PIC X(64000). 77 W-QRTM PIC 9(09) COMP-5. 77 W-SALAVR PIC 9(01). 88 SALVAR VALUE 1. 88 NAO-SALVAR VALUE ZEROS. 77 ESTADO PIC X(02). 01 KERNEL32-POINTER procedure-pointer. 01 W-POINTER POINTER. 01 W-PNTR POINTER. 78 INVALID-HANDLE-VALUE value -1. 01 W-HANDLE USAGE POINTER. LINKAGE SECTION. 01 CADASTRO-FCD. COPY XFHFCD.CPY. *> Estrutura usada pelo COBOL para fazer todos acessos a arquivos PROCEDURE DIVISION. PRINCIPAL. DISPLAY ERASE. DISPLAY "Vou abrir arquivos, compilado em". DISPLAY FUNCTION WHEN-COMPILED. MOVE FUNCTION WHEN-COMPILED TO W-DTCMP. SET NAO-SALVAR TO TRUE. OPEN I-O CADASTRO. *> Processo executando diversos I-O *> . *> . *> . *> . IF SALVAR COMMIT ELSE ROLLBACK. CLOSE CADASTRO. STOP RUN.