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

Members: 0
Guests: 19

more...
Powered by
SourceForge

Xoops

Creative Commons

OpenCOBOL Forum Index
   OpenCOBOL
     Error in compiling "write myrec from spaces"
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
human
Posted on: 2009/2/23 10:05
Home away from home
Joined: 2007/5/15
From: GERMANY
Posts: 1416
Error in compiling "write myrec from spaces"
...
       FILE-CONTROL.
           SELECT myfil ASSIGN TO "Testfile"
                        ACCESS IS SEQUENTIAL
                        STATUS IS myfil-STATUS
                        ORGANIZATION IS LINE SEQUENTIAL.
       DATA DIVISION.
       FILE SECTION.
       FD myfil.
       01 myrec PIC X(2000).
...
           write myrec from spaces end-write
...
leads to Quote:
Error: syntax error, unexpected SPACE, expecting "Literal" or "Identifier"

I've compiled this program using OC 1.0 without any warning. What's the problem about this line?

human
btiffin
Posted on: 2009/2/23 19:48
Home away from home
Joined: 2008/6/7
From: CANADA
Posts: 1196
Re: Error in compiling "write myrec from spaces"
Good find human.

This has to do, afaik, with changes made to support PROGRAM-ID CaseSensitiveName.

And it uncovers another issue. Draft 20xx specs that WRITE FROM should handle FUNCTION (with category limitations) and the current parser.y doesn't account for that, along with missing the figurative constants you have discovered. Long live pre-releases and extended soak-time.

I have a trial patch, but it'll be not quite right, and in compiler speak that is the same as wrong, so I'm not posting it this time. ;)

Cheers,
Brian
human
Posted on: 2009/10/14 7:10
Home away from home
Joined: 2007/5/15
From: GERMANY
Posts: 1416
Re: Error in compiling "write myrec from spaces"
Brian, could you please submit (and if possible explain) your trial patch? What is wrong about it? Maybe we can fix this as a community?
I'd like to have that bug source fixed for Roger being able to just take this into the next tarball.

human
human
Posted on: 2012/6/20 13:58
Home away from home
Joined: 2007/5/15
From: GERMANY
Posts: 1416
Re: Error in compiling "write myrec from spaces"
Bumping up this one for a patch in OpenCOBOL-CE.
@brian: here you go

human
btiffin
Posted on: 2012/6/22 4:20
Home away from home
Joined: 2008/6/7
From: CANADA
Posts: 1196
Re: Error in compiling "write myrec from spaces"
Will do human.

I got parser.y and friends to all write from figuratives, but changes to the parse tree need very special care and attention. Changes are relatively easy ... but.

A change to the scan rules can have weird effects on completely unrelated usage of the reserved words (complex backtracking yadayada, stuff I don't feel comfortable pretending that I can internally visualize all at once).

Last time I tried to run a VCG (a visual representation of the compiler graph) it ran out of resources (OpenCOBOL is likely one of the most complex scanner.l and parser.y pairs in existence). Before I fling code on the world, I'd like to get a vcgview or similar tool working to verify deltas after the changes.

found a script that looks like it reads gcc -fdump-tree-vcg and outputs Graphviz .dot files, need to test and maybe tweak

Cheers,
Brian
human
Posted on: 2012/7/13 12:26
Home away from home
Joined: 2007/5/15
From: GERMANY
Posts: 1416
Re: Error in compiling "write myrec from spaces"
An addition as I've read this in the 20xx draft today:
WRITE FROM SPACES/SPACE should insert ONE space into the record (depends on additional clauses and FD, of course - in line sequential files you will have either a simple additional line break or many spaces (if COB_LS_FIXED is used)).

@Brian: just add it to the parser and place some test progs into the suite, we'll find errors later on, if they're in. And if you find good tools for visualizing, please use them when we have changes to parser/lexer stuff.

human
wmklein
Posted on: 2012/7/15 21:39
Home away from home
Joined: 2008/12/27
From:
Posts: 327
Re: Error in compiling "write myrec from spaces"
Just to be clear(er)

Write Rec-Name from Spaces

doesn't "exactly" insert one (space) character. Rather it is more accurate to say that it MOVEs "one space chacter" (eg " ") to the 01-record name and then writes that record.

This means that ALL normal rules for "padding" and writing apply, i.e. it is EXACTLY equivalent to

Move " " to Rec-Name
Write Rec-Name

(and if Rec-Name is a NATIONAL item, the space is a national space)

This may be what Human, meant, but I did want to make cerain that it was "clear".
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