HOME  NEWS  FORUM  DOWNLOAD  LINK
OpenCOBOL - an open-source COBOL compiler
Main Menu
Download
Documentation
Development
Who's Online
26 user(s) are online (14 user(s) are browsing Forum)

Members: 0
Guests: 26

more...
Powered by
SourceForge

Xoops

Creative Commons

OpenCOBOL Forum Index
   OpenCOBOL
     LX / Sequential File / Rewrite
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
eraso
Posted on: 2011/9/20 19:45
Not too shy to talk
Joined: 2006/11/22
From: SUTEC - Fontenay sous Bois (France)
Posts: 21
LX / Sequential File / Rewrite
Hello,

I may have found a problem with sequential files and the rewrite order :
I made a test of writing records of 4096 bytes and less then rewriting them : nothing special happens.
I made a test of writing records of more than 4096 bytes then rewriting them : the result is that the rewritten records are completely different from the original ones.

It seems that the SEEK_INIT macro should also be defined for linux system as for others systems.

Here is the test program I used :
        IDENTIFICATION DIVISION.
        PROGRAM-ID. TSTSEQREW INITIAL.
        ENVIRONMENT DIVISION.
        CONFIGURATION SECTION.
        SPECIAL-NAMES.
            DECIMAL-POINT IS COMMA.
        INPUT-OUTPUT SECTION.
        FILE-CONTROL.
        SELECT TSTTREW ASSIGN "TREW.seq"
             ORGANIZATION IS SEQUENTIAL
             FILE STATUS  IS FS-TSTTREW.


        DATA DIVISION.
        FILE SECTION.
        FD TSTTREW.
        01 TST-TREW.
           05 CH1 PIC X(02).
           05 CH2 PIC 9(05).
      *    05 CH3 PIC X(4089).
           05 CH3 PIC X(4090).

        WORKING-STORAGE SECTION.
        01  W-ID                          PIC 9(1) VALUE 0.

        LOCAL-STORAGE SECTION.

        77  W-CPT                         PIC 9(5) VALUE 0.
        77  FS-TSTTREW                        PIC 9(02).

        PROCEDURE DIVISION.
        DEBUT-PROGRAMME.
            INITIALIZE FS-TSTTREW.
            DISPLAY "LENGTH OF RECORD=" LENGTH OF TST-TREW.
            OPEN OUTPUT TSTTREW.
            PERFORM WITH TEST AFTER 
                    VARYING W-CPT FROM 1 BY 1 UNTIL W-CPT > 10
              MOVE W-CPT TO CH2 
              MOVE "TEST4" TO CH3 
              DISPLAY "["TST-TREW (1:77)"]" 
              WRITE TST-TREW 
            END-PERFORM.
            CLOSE TSTTREW.
            OPEN I-O TSTTREW.
            PERFORM UNTIL W-ID = 1
              READ TSTTREW
                AT END
                  MOVE 1 TO W-ID
                NOT AT END
                  MOVE "u" TO CH1
                  DISPLAY "["TST-TREW (1:77)"]"
                  REWRITE TST-TREW
              END-READ
            END-PERFORM.
            CLOSE TSTTREW.
        EXIT-PROGRAM.
            EXIT PROGRAM.


And the results are :
1/
LENGTH OF RECORD=4096
cob_open deb
cob_open fin
[00001TEST4                                                                 ]
[00002TEST4                                                                 ]
[00003TEST4                                                                 ]
[00004TEST4                                                                 ]
[00005TEST4                                                                 ]
[00006TEST4                                                                 ]
[00007TEST4                                                                 ]
[00008TEST4                                                                 ]
[00009TEST4                                                                 ]
[00010TEST4                                                                 ]
[00011TEST4                                                                 ]
cob_open deb
cob_open fin
cob_read deb
read 4096/4096>[                                                                             ]
cob_read fin
[u 00001TEST4                                                                 ]
cob_rewr deb
rewr -4096/4096>[u 00001TEST4                                                                 ]
cob_rewr fin
cob_read deb
read 4096/4096>[                                                                             ]
cob_read fin
[u 00002TEST4                                                                 ]
cob_rewr deb
rewr -4096/4096>[u 00002TEST4                                                                 ]
cob_rewr fin
cob_read deb
read 4096/4096>[                                                                             ]
cob_read fin
[u 00003TEST4                                                                 ]
cob_rewr deb
rewr -4096/4096>[u 00003TEST4                                                                 ]
cob_rewr fin
cob_read deb
read 4096/4096>[                                                                             ]
cob_read fin
[u 00004TEST4                                                                 ]
cob_rewr deb
rewr -4096/4096>[u 00004TEST4                                                                 ]
cob_rewr fin
cob_read deb
read 4096/4096>[                                                                             ]
cob_read fin
[u 00005TEST4                                                                 ]
cob_rewr deb
rewr -4096/4096>[u 00005TEST4                                                                 ]
cob_rewr fin
cob_read deb
read 4096/4096>[                                                                             ]
cob_read fin
[u 00006TEST4                                                                 ]
cob_rewr deb
rewr -4096/4096>[u 00006TEST4                                                                 ]
cob_rewr fin
cob_read deb
read 4096/4096>[                                                                             ]
cob_read fin
[u 00007TEST4                                                                 ]
cob_rewr deb
rewr -4096/4096>[u 00007TEST4                                                                 ]
cob_rewr fin
cob_read deb
read 4096/4096>[                                                                             ]
cob_read fin
[u 00008TEST4                                                                 ]
cob_rewr deb
rewr -4096/4096>[u 00008TEST4                                                                 ]
cob_rewr fin
cob_read deb
read 4096/4096>[                                                                             ]
cob_read fin
[u 00009TEST4                                                                 ]
cob_rewr deb
rewr -4096/4096>[u 00009TEST4                                                                 ]
cob_rewr fin
cob_read deb
read 4096/4096>[                                                                             ]
cob_read fin
[u 00010TEST4                                                                 ]
cob_rewr deb
rewr -4096/4096>[u 00010TEST4                                                                 ]
cob_rewr fin
cob_read deb
read 4096/4096>[                                                                             ]
cob_read fin
[u 00011TEST4                                                                 ]
cob_rewr deb
rewr -4096/4096>[u 00011TEST4                                                                 ]
cob_rewr fin
cob_read deb
cob_read fin


2/
LENGTH OF RECORD=4097
cob_open deb
cob_open fin
[00001TEST4                                                                 ]
[00002TEST4                                                                 ]
[00003TEST4                                                                 ]
[00004TEST4                                                                 ]
[00005TEST4                                                                 ]
[00006TEST4                                                                 ]
[00007TEST4                                                                 ]
[00008TEST4                                                                 ]
[00009TEST4                                                                 ]
[00010TEST4                                                                 ]
[00011TEST4                                                                 ]
cob_open deb
cob_open fin
cob_read deb
read 4097/4097>[                                                                             ]
cob_read fin
[u 00001TEST4                                                                 ]
cob_rewr deb
rewr -4097/4097>[u 00001TEST4                                                                 ]
cob_rewr fin
cob_read deb
read 4097/4097>[                                                                             ]
cob_read fin
[u 00002TEST4                                                                ]
cob_rewr deb
rewr -4097/4097>[                                                                           u ]
cob_rewr fin
cob_read deb
read 4097/4097>[                                                                             ]
cob_read fin
[u 00003TEST4                                                               ]
cob_rewr deb
rewr -4097/4097>[                                                                           u ]
cob_rewr fin
cob_read deb
read 4097/4097>[                                                                             ]
cob_read fin
[u  00004TEST4                                                              ]
cob_rewr deb
rewr -4097/4097>[                                                                          u  ]
cob_rewr fin
cob_read deb
read 4097/4097>[                                                                             ]
cob_read fin
[u   00005TEST4                                                             ]
cob_rewr deb
rewr -4097/4097>[                                                                         u   ]
cob_rewr fin
cob_read deb
read 4097/4097>[                                                                             ]
cob_read fin
[u    00006TEST4                                                            ]
cob_rewr deb
rewr -4097/4097>[                                                                        u    ]
cob_rewr fin
cob_read deb
read 4097/4097>[                                                                             ]
cob_read fin
[u     00007TEST4                                                           ]
cob_rewr deb
rewr -4097/4097>[                                                                       u     ]
cob_rewr fin
cob_read deb
read 4097/4097>[                                                                             ]
cob_read fin
[u      00008TEST4                                                          ]
cob_rewr deb
rewr -4097/4097>[                                                                      u      ]
cob_rewr fin
cob_read deb
read 4097/4097>[                                                                             ]
cob_read fin
[u       00009TEST4                                                         ]
cob_rewr deb
rewr -4097/4097>[                                                                     u       ]
cob_rewr fin
cob_read deb
read 4097/4097>[                                                                             ]
cob_read fin
[u        00010TEST4                                                        ]
cob_rewr deb
rewr -4097/4097>[                                                                    u        ]
cob_rewr fin
cob_read deb
read 4097/4097>[                                                                             ]
cob_read fin
[u         00011TEST4                                                       ]
cob_rewr deb
rewr -4097/4097>[                                                                   u         ]
cob_rewr fin
cob_read deb
cob_read fin
[u          00011TEST4                                                       ]
cob_rewr deb
cob_read deb
cob_read fin


Thanks for your help.

eraso
human
Posted on: 2011/9/21 6:27
Webmaster
Joined: 2007/5/15
From: GERMANY
Posts: 1416
Re: LX / Sequential File / Rewrite
Hi eraso!

You did a good job with the sample. I added missing code tags for easier copy+paste and reading - and did some minor changes. Afterwards I did some checks:
- 1.1 (feb 09) MinGW package: works
- 1.1 / 2.0 Win-binaries: work
- early 1.1 (not feb 09) Unix: same problem as you've described
- 2.0 (dev-only version) Unix: works

Therefore Roger had solved this issue already for the next version (no idea when it will see the public light). Nonetheless it's good we're aware that 1.1 has this problem.

human
eraso
Posted on: 2011/9/21 7:02
Not too shy to talk
Joined: 2006/11/22
From: SUTEC - Fontenay sous Bois (France)
Posts: 21
Re: LX / Sequential File / Rewrite
Hello Human,

Thank you for your answer but I have a question that comes in my mind (maybe in mind of others too) :
- How can I be sure to have the latest package of OC 1.1 since it is not available on opencobol.org site but on simrw site (I found that info on this URL "http://www.kiska.net/opencobol/1.1/" with some binaries packages) ?
- Is there an updated changelog reminding which major bugs were fixed like the one above

By the way, I am still in the process of migrating from oc 0.33 to oc 1.1 on a 64 bit platform and it's going well globally speaking.

eraso
human
Posted on: 2011/9/21 10:53
Webmaster
Joined: 2007/5/15
From: GERMANY
Posts: 1416
Re: LX / Sequential File / Rewrite
The latest package is always available here (to the left in the download area). The latest 1.1 is feb 09 (and I guess it will be the last 1.1-version), any later version is part of the 2.0 development (where nothing is guaranteed to work at all) and should not be used.
You may want to use some patches that you can find in the forum (and at least some of them gathered together at kiska.net).
I wish I'd had such a nice change log, but I don't have one. There was some doc I made for myself with links for solved/open bugs ans feature requests but it was lost in a HDD crash. You're invited to start a document in the wiki (you could search the forum for "bug" and "fr"). I hope Roger has it and if not, I'm quite sure he can come up with it by crawling the CVS logs on his dev server.

human
eraso
Posted on: 2011/9/22 9:44
Not too shy to talk
Joined: 2006/11/22
From: SUTEC - Fontenay sous Bois (France)
Posts: 21
Re: LX / Sequential File / Rewrite
OK, maybe the date of the last commit should just be showed somewhere.
Threaded | Newest First Previous Topic | Next Topic | Top

Register To Post
 
Copyright (C) 2005 The OpenCOBOL Project. All rights reserved.
Powered by Xoops2 | PHP | MySQL | Apache
ocean-net