Boas,
alguem que perceba de cobol ?
preciso de extrair informação que está cheio de caracteres estranhos, para um ficheiro de texto, alguem me consegue ajudar?
cumps
Mário
Moderadores: Administradores, Moderadores


Tens que explicar isso melhor.fyngr Escreveu:Boas,
alguem que perceba de cobol ?
preciso de extrair informação que está cheio de caracteres estranhos, para um ficheiro de texto, alguem me consegue ajudar?
cumps
Mário
Será porque o ficheiro foi escrito por um programa (com source em Cobol) ?capricorn Escreveu:porquê cobol?



$ SET SOURCEFORMAT"FREE"
IDENTIFICATION DIVISION.
PROGRAM-ID. SeqWrite.
AUTHOR. Michael Coughlan.
* Example program showing how to create a sequential file
* using the ACCEPT and the WRITE verbs.
* Note: In this version of COBOL pressing the Carriage Return (CR)
* without entering any data results in StudentDetails being filled
* with spaces.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT StudentFile ASSIGN TO "STUDENTS.DAT"
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD StudentFile.
01 StudentDetails.
02 StudentId PIC 9(7).
02 StudentName.
03 Surname PIC X(8).
03 Initials PIC XX.
02 DateOfBirth.
03 YOBirth PIC 9(4).
03 MOBirth PIC 9(2).
03 DOBirth PIC 9(2).
02 CourseCode PIC X(4).
02 Gender PIC X.
PROCEDURE DIVISION.
Begin.
OPEN OUTPUT StudentFile
DISPLAY "Enter student details using template below. Enter no data to end."
PERFORM GetStudentDetails
PERFORM UNTIL StudentDetails = SPACES
WRITE StudentDetails
PERFORM GetStudentDetails
END-PERFORM
CLOSE StudentFile
STOP RUN.
GetStudentDetails.
DISPLAY "Enter - StudId, Surname, Initials, YOB, MOB, DOB, Course, Gender"
DISPLAY "NNNNNNNSSSSSSSSIIYYYYMMDDCCCCG"
ACCEPT StudentDetails. 3.1.1.1 Line Sequential Files
In line sequential files, each record in the file is separated from the next by a record delimiter. On DOS, Windows and OS/2 this is a carriage return (x"0D") and a line feed (x"0A") character. On UNIX it is just the line feed (x"0A") character. These characters are inserted after the last non-space character in each record so line sequential files always contain variable-length records.
Report files are line sequential, since most PC printers require the carriage return and/or line feed characters at the end of each record.
Most PC editors produce line sequential files, and these files can therefore be edited with almost any PC editor.
The primary use of line sequential files is for display-only data.

DATA DIVISION.
FILE SECTION.
FD StudentFile.
01 StudentDetails.
02 StudentId PIC 9(7).
02 StudentName.
03 Surname PIC X(8).
03 Initials PIC XX.
02 DateOfBirth.
03 YOBirth PIC 9(4).
03 MOBirth PIC 9(2).
03 DOBirth PIC 9(2).
02 CourseCode PIC X(4).
02 Gender PIC X.


Acho que simfyngr Escreveu:...
ja tinha esse programa que está nesse link, e é exactamente isso que queria, só que esse pograma custa 2.000 e tal dolares:x
achas que se te disponibilizar o ficheiro podes-me dar mais uma ajuda?
entretanto estou a ver se descubro qq coisa..
cumps
DATA DIVISION.
FILE SECTION.
FD StudentFile.
01 StudentDetails.
02 StudentId PIC 9(7). = 9999999
02 StudentName.
03 Surname PIC X(8 ). = XXXXXXXX
03 Initials PIC XX. = X(2)
02 DateOfBirth.
03 YOBirth PIC 9(4). = 9999
03 MOBirth PIC 9(2). = 99
03 DOBirth PIC 9(2). = 99
02 CourseCode PIC X(4). = XXXX
02 Gender PIC X. = X(1)

Utilizadores a ver este Fórum: Nenhum utilizador registado e 6 visitantes