For Programmers: Free Programming Magazines  


Home > Archive > Cobol > September 2005 > fixed and variable length record file under fujitsu









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author fixed and variable length record file under fujitsu
ari

2005-09-05, 6:55 pm

Using fujitsu .net cobol I am trying to create 2 files - a fixed length
data file and a variable length data file. The code sample is below:

000190 DATA DIVISION.
000200
000210 FILE SECTION.
000220
000230 FD TEST-FILE
000240
000250 LABEL RECORDS STANDARD
000260
000280 RECORD 30
000290 BLOCK CONTAINS 0.
000300
000310 01 TST-REC.
000320
000330 05 TST-KUKU PIC X(10).
000340
000350 05 TST-DATA PIC X(20).
000360
000230 FD TEST-FILEV
000240
000250 LABEL RECORDS STANDARD
000260
000290 BLOCK CONTAINS 0.
000300
000310 01 TST-RECV.
05 VAR-TXT.
10 PIC X OCCURS 0 TO 100 DEPENDING ON VAR-LEN.
Frederico Fonseca

2005-09-05, 9:56 pm

On 5 Sep 2005 09:11:39 -0700, "ari" <unikoski@yahoo.com> wrote:

>Using fujitsu .net cobol I am trying to create 2 files - a fixed length
>data file and a variable length data file. The code sample is below:

Please add the SELECT bit as this is of MAJOR importance for your
problem.


>
>000190 DATA DIVISION.
>000200
>000210 FILE SECTION.
>000220
>000230 FD TEST-FILE
>000240
>000250 LABEL RECORDS STANDARD
>000260
>000280 RECORD 30
>000290 BLOCK CONTAINS 0.
>000300
>000310 01 TST-REC.
>000320
>000330 05 TST-KUKU PIC X(10).
>000340
>000350 05 TST-DATA PIC X(20).
>000360
>000230 FD TEST-FILEV
>000240
>000250 LABEL RECORDS STANDARD
>000260
>000290 BLOCK CONTAINS 0.
>000300
>000310 01 TST-RECV.
> 05 VAR-TXT.
> 10 PIC X OCCURS 0 TO 100 DEPENDING ON VAR-LEN.
> .
> .
> .
>
>
>000610 OPEN OUTPUT TEST-FILEV.
> MOVE 5 TO VAR-LEN
> MOVE 'HELLO' TO VAR-TXT.
> WRITE TST-RECV.
> SUBTRACT 1 FROM VAR-TXT.
> WRITE TST-RECV.
>000690 CLOSE TEST-FILEV.
>000590
>000600
>000610 OPEN OUTPUT TEST-FILE.
>000620
>000630 MOVE 'KUKU' TO TST-KUKU.
>000640
>000650 MOVE 'STUM' TO TST-DATA.
>000660
>000670 WRITE TST-REC.
>000630 MOVE 'KUKU' TO TST-DATA.
>000640
>000650 MOVE 'STUM' TO TST-KUKU.
>000660
>000670 WRITE TST-REC.
>000680
>
>
>A number of strange things are happening as a result:
>
>a/ On both output files I receive a very strange extra 3 bytes at the
>beginning of the file. The hexadecimal values of these bytes are: EF BB
>BF.
>
>b/ I am getting an extra 0D 0A at the end of every record.
>
>Any ideas on how to avoid this?



Frederico Fonseca
ema il: frederico_fonseca at syssoft-int.com
ari

2005-09-05, 9:56 pm

Thanks for you reply, and sorry for missing the "SELECT" (silly me!)-
it is:

000110 FILE-CONTROL.
000120
000130 SELECT TEST-FILE
000140
000150 ORGANIZATION LINE SEQUENTIAL
ASSIGN TO MYFILE.

000130 SELECT TEST-FILEV
000140
000150 ORGANIZATION LINE SEQUENTIAL
ASSIGN TO MYFILEV.

William M. Klein

2005-09-05, 9:56 pm

LINE SEQUENTIAL files are neither "fixed" nor "variable" in the normal (ANSI/ISO
Standard) files are.

--
Bill Klein
wmklein <at> ix.netcom.com
"ari" <unikoski@yahoo.com> wrote in message
news:1125939868.185272.104620@g14g2000cwa.googlegroups.com...
> Thanks for you reply, and sorry for missing the "SELECT" (silly me!)-
> it is:
>
> 000110 FILE-CONTROL.
> 000120
> 000130 SELECT TEST-FILE
> 000140
> 000150 ORGANIZATION LINE SEQUENTIAL
> ASSIGN TO MYFILE.
>
> 000130 SELECT TEST-FILEV
> 000140
> 000150 ORGANIZATION LINE SEQUENTIAL
> ASSIGN TO MYFILEV.
>



Richard

2005-09-05, 9:56 pm

> 000150 ORGANIZATION LINE SEQUENTIAL

Line sequential files are like text editor files. The Carriage Return
(x0D) and Line Feed (x0A) at the end of each line are the line
terminators. The trailing spaces should have been stripped from the
record, but this may need an environment variable to tell it to do so.

I have no idea what the EF BB BF are.

You may want these files to be SEQUENTIAL (ie without LINE). For
variable length sequential files you will get file and record headers
because _something_ has to tell where the records start and end.

HeyBub

2005-09-05, 9:56 pm

ari wrote:
> Using fujitsu .net cobol I am trying to create 2 files - a fixed
> length data file and a variable length data file. The code sample is
> below:
>
> 000190 DATA DIVISION.
> 000200
> 000210 FILE SECTION.
> 000220
> 000230 FD TEST-FILE
> 000240
> 000250 LABEL RECORDS STANDARD
> 000260
> 000280 RECORD 30
> 000290 BLOCK CONTAINS 0.
> 000300
> 000310 01 TST-REC.
> 000320
> 000330 05 TST-KUKU PIC X(10).
> 000340
> 000350 05 TST-DATA PIC X(20).
> 000360
> 000230 FD TEST-FILEV
> 000240
> 000250 LABEL RECORDS STANDARD
> 000260
> 000290 BLOCK CONTAINS 0.
> 000300
> 000310 01 TST-RECV.
> 05 VAR-TXT.
> 10 PIC X OCCURS 0 TO 100 DEPENDING ON VAR-LEN.
> .
> .
> .
>
>
> 000610 OPEN OUTPUT TEST-FILEV.
> MOVE 5 TO VAR-LEN
> MOVE 'HELLO' TO VAR-TXT.
> WRITE TST-RECV.
> SUBTRACT 1 FROM VAR-TXT.
> WRITE TST-RECV.
> 000690 CLOSE TEST-FILEV.
> 000590
> 000600
> 000610 OPEN OUTPUT TEST-FILE.
> 000620
> 000630 MOVE 'KUKU' TO TST-KUKU.
> 000640
> 000650 MOVE 'STUM' TO TST-DATA.
> 000660
> 000670 WRITE TST-REC.
> 000630 MOVE 'KUKU' TO TST-DATA.
> 000640
> 000650 MOVE 'STUM' TO TST-KUKU.
> 000660
> 000670 WRITE TST-REC.
> 000680
>
>
> A number of strange things are happening as a result:
>
> a/ On both output files I receive a very strange extra 3 bytes at the
> beginning of the file. The hexadecimal values of these bytes are: EF
> BB BF.
>
> b/ I am getting an extra 0D 0A at the end of every record.
>
> Any ideas on how to avoid this?


The '0D0A' is easy. That's Carriage-return/Line-feed which is appended to
the end of every record whose SELECT statement contains "ORGANIZATION IS
LINE SEQUENTIAL"

Take out the following stuff:

LABEL RECORDS STANDARD
BLOCK CONTAINS 0
RECORD nnn


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com