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

Members: 1
Guests: 11

giacomo, more...
Powered by
SourceForge

Xoops

Creative Commons

OpenCOBOL Forum Index
   OpenCOBOL
     LINE ADVANCING clause for PRINTING
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
EdBorchert
Posted on: 2010/7/29 10:39
Just popping in
Joined: 2010/7/28
From:
Posts: 9
LINE ADVANCING clause for PRINTING
I have implemented the LINE ADVANCING clause (MF) in the compiler and libcob. (Including trailing space trimming)
To whom can I send the code changes?

Also a VERY big change to allow "VALUES" synonymous for "VALUE". :lol:

Regards,
Ed Borchert
Franklin
Posted on: 2010/7/29 12:00
Not too shy to talk
Joined: 2006/6/22
From: Hamburg, Germany
Posts: 21
Re: LINE ADVANCING clause for PRINTING
Hi Ed,

just place the diff file right here between code tags.
Here is how i did it for some of my changes: http://www.opencobol.org/modules/newbb/viewtopic.php?topic_id=1019&forum=1

Regards
Franklin
Mado
Posted on: 2010/7/29 12:03
Just popping in
Joined: 2010/5/25
From:
Posts: 15
Re: LINE ADVANCING clause for PRINTING
Hi,

the changes you can post with code tags here in the forum.

Can you provide example programs to? Perhaps your changes already implemented in a new OpenCOBOL version.

This works for example in OC 1.1.0 Packaged Jun 10 2010 06:45:57 UTC:

           SELECT FXX001 ASSIGN LINE ADVANCING "E1"
              ORGANIZATION LINE SEQUENTIAL.


But I am surprised that it works, because LINE ADVANCING and ORGANIZATION LINE SEQUENTIAL may not be specified together.

Regards,
Mado
EdBorchert
Posted on: 2010/7/29 13:40
Just popping in
Joined: 2010/7/28
From:
Posts: 9
Re: LINE ADVANCING clause for PRINTING
I am using version 1.1.0 and is was not implemented there.
The syntax I use :

select list-a assign to line advancing "list-a"
organization is sequential
file status is ph-status.
EdBorchert
Posted on: 2010/7/29 14:19
Just popping in
Joined: 2010/7/28
From:
Posts: 9
Re: LINE ADVANCING clause for PRINTING
OK, here we go.
First of all .... all lines of code that area changed are recognizable by the string "/* EB */"

*** open-cobol-1.1/cobc/parser.y	2010-07-09 08:41:03.000000000 +0200
--- /opt/old/open-cobol-1.1/cobc/parser.y	2009-02-04 17:56:18.000000000 +0100
***************
*** 18,30 ****
   * Boston, MA 02110-1301 USA
   */
  
- /*
-  * EB
-  * Implemented :
-  * LINE ADVANCING in select
-  * VALUES as alias for VALUE
-  */
- 
  %expect 118
  
  %defines
--- 18,23 ----
***************
*** 736,742 ****
  %token USE
  %token USING
  %token VALUE
- %token VALUES			/* EB */
  %token VARYING
  %token WAIT
  %token WHEN
--- 729,734 ----
***************
*** 1579,1585 ****
  	/* build new file */
  	current_file = build_file ($3);
  	current_file->optional = CB_INTEGER ($2)->val;
- 	current_file->line_advancing = 0;		/* EB */
  
  	/* register the file */
  	current_program->file_list =
--- 1571,1576 ----
***************
*** 1615,1639 ****
  /* ASSIGN clause */
  
  assign_clause:
!   ASSIGN _to _line_advancing_clause _ext_clause _device assignment_name		/* EB */
    {
! 	current_file->assign = cb_build_assignment_name (current_file, $6);
    }
! | ASSIGN _to _line_advancing_clause _ext_clause DISK
    {
  	current_file->fileid_assign = 1;
    }
  ;
  
- /* START EB */
- _line_advancing_clause:
- | LINE ADVANCING
-   {
- 	current_file->line_advancing = 1;
-   }
- ;
- /* END EB */
- 
  _device:
  | DISK
  | PRINTER	{ current_file->organization = COB_ORG_LINE_SEQUENTIAL; }
--- 1606,1621 ----
  /* ASSIGN clause */
  
  assign_clause:
!   ASSIGN _to _ext_clause _device assignment_name
    {
! 	current_file->assign = cb_build_assignment_name (current_file, $5);
    }
! | ASSIGN _to _ext_clause DISK
    {
  	current_file->fileid_assign = 1;
    }
  ;
  
  _device:
  | DISK
  | PRINTER	{ current_file->organization = COB_ORG_LINE_SEQUENTIAL; }
***************
*** 2794,2805 ****
  /* VALUE clause */
  
  value_clause:
!   VALUE value_field_list	/* EB */
! | VALUES value_field_list	/* EB */
! ;				/* EB */
! 
! value_field_list:		/* EB */
!   _is_are value_item_list	{ current_field->values = $2; }	/* EB */
    _when _set _to false_is
  ;
  
--- 2776,2782 ----
  /* VALUE clause */
  
  value_clause:
!   VALUE _is_are value_item_list	{ current_field->values = $3; }
    _when _set _to false_is
  ;
  
***************
*** 4553,4558 ****
--- 4530,4536 ----
  | END_EVALUATE			{ terminator_clear (TERM_EVALUATE); }
  ;
  
+ 
  /*
   * EXIT statement
   */
***************
*** 6959,6962 ****
--- 6937,6941 ----
  _when:		| WHEN ;
  _with:		| WITH ;
  
+ 
  %%

=======================================================
*** open-cobol-1.1/cobc/reserved.c	2010-07-29 12:05:38.000000000 +0200
--- /opt/old/open-cobol-1.1/cobc/reserved.c	2009-02-01 13:37:01.000000000 +0100
***************
*** 597,603 ****
    {"VALIDATE",			-1},			/* 2002 */
    {"VALIDATE-STATUS",		-1},			/* 2002 */
    {"VALUE",			VALUE},			/* 2002 */
!   {"VALUES",			VALUE},			/* EB */
    {"VARYING",			VARYING},		/* 2002 */
    {"WAIT",			WAIT},			/* extension */
    {"WHEN",			WHEN},			/* 2002 */
--- 597,603 ----
    {"VALIDATE",			-1},			/* 2002 */
    {"VALIDATE-STATUS",		-1},			/* 2002 */
    {"VALUE",			VALUE},			/* 2002 */
!   {"VALUES",			VALUE},			/* 2002 */
    {"VARYING",			VARYING},		/* 2002 */
    {"WAIT",			WAIT},			/* extension */
    {"WHEN",			WHEN},			/* 2002 */

==========================================================
*** open-cobol-1.1/cobc/tree.h	2010-07-09 08:30:16.000000000 +0200
--- /opt/old/open-cobol-1.1/cobc/tree.h	2009-02-04 17:56:27.000000000 +0100
***************
*** 602,608 ****
  	char			*cname;			/* The name used in C */
  	/* SELECT */
  	cb_tree			assign;			/* ASSIGN */
- 	int			line_advancing;		/* LINE ADVANCING EB */
  	cb_tree			file_status;		/* FILE STATUS */
  	cb_tree			sharing;		/* SHARING */
  	cb_tree			key;			/* RELATIVE/RECORD KEY */
--- 602,607 ----

===========================================================
*** open-cobol-1.1/cobc/typeck.c	2010-07-09 09:46:34.000000000 +0200
--- /opt/old/open-cobol-1.1/cobc/typeck.c	2009-01-28 18:57:25.000000000 +0100
***************
*** 5773,5779 ****
  	cb_emit (cb_build_funcall_1 ("cob_stop_run", cb_build_cast_integer (x)));
  }
  
- 
  /*
   * STRING statement
   */
--- 5773,5778 ----
***************
*** 5936,5946 ****
  		    opt == cb_int0) {
  			opt = cb_int (COB_WRITE_BEFORE | COB_WRITE_LINES | 1);
  		}
- 		/* EB line advancing */
- 		if (CB_FILE (file)->line_advancing && opt == cb_int0) /* EB */
- 		{ /* EB */
- 			opt = cb_int (COB_WRITE_AFTER | COB_WRITE_LINES) + 1; /* EB */
- 		} /* EB */
  		/* RXW - This is horrible */
  		if (current_statement->handler_id == COB_EC_I_O_EOP &&
  		    current_statement->handler1) {
--- 5935,5940 ----

==========================================================
*** open-cobol-1.1/libcob/fileio.c	2010-06-30 08:08:26.000000000 +0200
--- /opt/old/open-cobol-1.1/libcob/fileio.c	2009-01-24 14:31:30.000000000 +0100
***************
*** 876,883 ****
  				putc ('\n', (FILE *)f->file);
  			}
  		}
- 		if ((FILE *)f->line_advancing)		/* EB */
- 			putc ('\r', (FILE *)f->file);	/* EB */
  #ifdef HAVE_FCNTL
  		/* unlock the file */
  		memset ((unsigned char *)&lock, 0, sizeof (struct flock));
--- 876,881 ----
***************
*** 973,986 ****
  	}
  	if (opt & COB_WRITE_LINES) {
  		for (i = opt & COB_WRITE_MASK; i > 0; i--)
- 		{ /* EB */
- 			if ((FILE *)f->line_advancing)		/* EB */
- 				putc ('\r', (FILE *)f->file);	/* EB */
  			putc ('\n', (FILE *)f->file);
- 		} /* EB */
  	} else if (opt & COB_WRITE_PAGE) {
- 		if ((FILE *)f->line_advancing)		/* EB */
- 			putc ('\r', (FILE *)f->file);	/* EB */
  		putc ('\f', (FILE *)f->file);
  	}
  	return 0;
--- 971,978 ----
***************
*** 1061,1068 ****
  sequential_write (cob_file *f, const int opt)
  {
  	int	ret;
- 	int	i;	/* EB */
- 	char	*p;	/* EB */
  
  #if	WITH_VARSEQ == 0 || WITH_VARSEQ == 1 || WITH_VARSEQ == 3
  	union {
--- 1053,1058 ----
***************
*** 1122,1142 ****
  	}
  
  	/* write the record */
! 	/* START EB */
! 	/* Trim record in case of line advancing */
! 	i = (FILE *)f->record->size;
! 	if ((FILE *)f->line_advancing)
! 	{
! 		p = f->record->data + i - 1;
! 		while (*p == ' ' && i)
! 		{
! 			p--;
! 			i--;
! 		}
! 	}
! 	/* END EB */
! //	if (unlikely(fwrite (f->record->data, f->record->size, 1, (FILE *)f->file) != 1)) { /* EB */
! 	if (unlikely(fwrite (f->record->data, i, 1, (FILE *)f->file) != 1)) {
  		return COB_STATUS_30_PERMANENT_ERROR;
  	}
  
--- 1112,1118 ----
  	}
  
  	/* write the record */
! 	if (unlikely(fwrite (f->record->data, f->record->size, 1, (FILE *)f->file) != 1)) {
  		return COB_STATUS_30_PERMANENT_ERROR;
  	}
  

===========================================================
Mado
Posted on: 2010/7/30 7:23
Just popping in
Joined: 2010/5/25
From:
Posts: 15
Re: LINE ADVANCING clause for PRINTING
Hi Ed,

not every version 1.1.0 is the same version. You have to look for the packaged date (cobc -V). In my version 1.1.0 with "Packaged Jun 10 2010 06:45:57 UTC" your example works fine (there is no compile warning/error).

You should wait for the user human. He can probably give you the current version.
human
Posted on: 2010/7/30 9:15
Home away from home
Joined: 2007/5/15
From:
Posts: 958
Re: LINE ADVANCING clause for PRINTING
The most current official pre-release can be found in the download area (and is from Feb 06 2009 10:30:55 CET). Other unofficial versions should not be shared.

I hope Roger find the time to release 2.0pre soon, but I guess it will need some weeks if not even months.

@mado: Good that you've checked that on a newer version, so there is no patch to current OC source necessary.

@Ed: Good that you've submitted a patch for the last official pre-release, we do not know how long we need to wait for first 2.0. PLEASE edit your post and use code tags for code snippets/diffs/... It's good to have another person looking at OC source.

human
EdBorchert
Posted on: 2010/7/30 9:41
Just popping in
Joined: 2010/7/28
From:
Posts: 9
Re: LINE ADVANCING clause for PRINTING
@human,
What do you mean by "use code tags"?
I just used "diff -rc" (on a Linux box).
Ed
Franklin
Posted on: 2010/7/30 10:18
Not too shy to talk
Joined: 2006/6/22
From: Hamburg, Germany
Posts: 21
Re: LINE ADVANCING clause for PRINTING
Ed

what is meant is that you should mark your diff file
with surrounding code tags. The beginning tag is "["code"]"
and the end tag is "["/code"]", just leave the quotes away.

Franklin
EdBorchert
Posted on: 2010/7/30 14:15
Just popping in
Joined: 2010/7/28
From:
Posts: 9
Re: LINE ADVANCING clause for PRINTING
Thanks!

Done. And now I understand the meaning of the tags too
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