Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

INSPECT and TRAILING syntax
Seems weird to me that alongside ALL, FIRST and LEADING
the TRAILING keyword never made it into any standard.
Bill, was it ever considered ?
ACU implements it and I have just put it into OpenCOBOL.

Roger While



Report this thread to moderator Post Follow-up to this message
Old Post
Roger While
05-09-06 02:55 AM


Re: INSPECT and TRAILING syntax
Roger (et al),
I think the thought is/was that "Function Reverse" lets you do much of this
(not REPLACING or CONVERTING - but tallying).  If you use REVERSE to move a
field to a temporary field, you can even do replacing and converting.

--
Bill Klein
wmklein <at> ix.netcom.com
"Roger While" <simrw@sim-basis.de> wrote in message
news:e3p2b2$fmv$01$1@news.t-online.com...
> Seems weird to me that alongside ALL, FIRST and LEADING
> the TRAILING keyword never made it into any standard.
> Bill, was it ever considered ?
> ACU implements it and I have just put it into OpenCOBOL.
>
> Roger While
>



Report this thread to moderator Post Follow-up to this message
Old Post
William M. Klein
05-09-06 08:55 AM


Re: INSPECT and TRAILING syntax
Yes, as I recall it J4 was of the opinion that anything you'd want to do
with TRAILING you could accomplish with existing syntax, even if it required
a "temporary" and an extra statement.

Adding new syntax for functionality that already exists -- particularly when
the syntax for that functionality is pretty straightforward -- adds
complexity to the language without adding functional feature content, and
for that reason the suggestions to provide TRAILING were not followed.

-Chuck Stevens

"William M. Klein" <wmklein@nospam.netcom.com> wrote in message
news:wqU7g.432129$7i1.140664@fe06.news.easynews.com...
> Roger (et al),
>  I think the thought is/was that "Function Reverse" lets you do much of
> this (not REPLACING or CONVERTING - but tallying).  If you use REVERSE to
> move a field to a temporary field, you can even do replacing and
> converting.
>
> --
> Bill Klein
> wmklein <at> ix.netcom.com
> "Roger While" <simrw@sim-basis.de> wrote in message
> news:e3p2b2$fmv$01$1@news.t-online.com... 
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Chuck Stevens
05-09-06 12:55 PM


Re: INSPECT and TRAILING syntax
>>>> Roger While<simrw@sim-basis.de> 05/08/06 9:29 PM >>>
>Seems weird to me that alongside ALL, FIRST and LEADING
>the TRAILING keyword never made it into any standard.
>Bill, was it ever considered ?
>ACU implements it and I have just put it into OpenCOBOL.

I totally agree.  I'm much more likely to use TRAILING than LEADING.  (In
fact I have utilized LEADING with FUNCTION REVERSE in order to simulate
TRAILING.  I don't agree with those that think that TRAILING should not be
added just because you can use LEADING with FUNCTION REVERSE.  I am all for
so-called "syntactic sugar" when it makes things easier to code and easier
to read.

Of course the (now dead?) COBOL 2008(?) standard appears to support even
more useful things such as FUNCTION TRIM(argument [left/right]) and the ANY
LENGTH clause.  For instance:

FD varlen-file.
01  varlen-record  PIC X ANY LENGTH LIMIT 120.

01  my-fixed-field PIC X(120).
01  my-varlen-field PIC X ANY LENGTH LIMIT 80 DELIMITED.

ACCEPT my-fixed-field
WRITE varlen-record FROM TRIM(my-fixed-field)

MOVE TRIM(my-fixed-field RIGHT) TO my-varlen-field
CALL c-func USING my-varlen-field

Not sure if I have all of the above correct, but I think the meaning is
fairly obvious.
Feel free to implement it into OpenCOBOL.  :-)

Frank


---
Frank Swarbrick
Senior Developer/Analyst - Mainframe Applications
FirstBank Data Corporation - Lakewood, CO  USA

Report this thread to moderator Post Follow-up to this message
Old Post
Frank Swarbrick
05-09-06 11:55 PM


Re: INSPECT and TRAILING syntax
On Tue, 9 May 2006 09:51:41 -0600, "Frank Swarbrick"
<Frank.Swarbrick@efirstbank.com> wrote:

>I totally agree.  I'm much more likely to use TRAILING than LEADING.  (In
>fact I have utilized LEADING with FUNCTION REVERSE in order to simulate
>TRAILING.  I don't agree with those that think that TRAILING should not be
>added just because you can use LEADING with FUNCTION REVERSE.  I am all for
>so-called "syntactic sugar" when it makes things easier to code and easier
>to read.

Using FUNCTION REVERSE for this purpose grates on me.   Sure,
computers are fast and this ugly code doesn't cost as much as it used
to.

I'd much rather use reference modification than use a function to copy
and reverse the string so that we can run a CoBOL command.

Report this thread to moderator Post Follow-up to this message
Old Post
Howard Brazee
05-09-06 11:55 PM


Re: INSPECT and TRAILING syntax
"Frank Swarbrick" <Frank.Swarbrick@efirstbank.com> wrote in message
news:4cbs4hF14rcseU1@individual.net...

> Of course the (now dead?) COBOL 2008(?) standard ...

Rumors to that effect are, I think, premature.

J4 plans to continue to meet, even with a vice-chair, for the foreseeable
future and has meetings scheduled next w, at the end of July, in October,
and in December of this year, presuming INCITS doesn't prevent it.  Note
that I'm acting vice-chair of J4, so we *can* conduct meetings, and we
expect to have a permanent vice-chair by the beginning of the July/August
meeting (so I won't have to act as host, secretary and chair all at the same
time for that meeting!).

WG4 meets in March 2007, and as far as I'm concerned the main goal of that
meeting is to move the 2008 draft on its path toward adoption, by which
point it is hoped that the work of J4 on that draft will be pretty much
done.

Membership of J4 is still sufficient for quorum -- in fact, because Micro
Focus has a designated alternate representative who is still employed by the
company, they're still a member despite Don Schricker's departure as their
primary representative and as chairperson of the committee, and we do have
more than one person "legitimized" by INCITS to conduct the meetings.

I do intend to lobby at the INCITS level for them to allow J4 to continue
its business even without a designated chairperson.

WG4 has delegated the technical work to J4 in the past.  If INCITS decides
(despite our efforts to the contrary) to disband J4 on the sole grounds that
nobody has (yet) stepped up to take on the permanent chairmanship, I don't
see any reason why WG4 can't continue the final editorial cleanup of the
2008 standard, as well as the development of future standards, if they so
chose.

-Chuck Stevens



Report this thread to moderator Post Follow-up to this message
Old Post
Chuck Stevens
05-09-06 11:55 PM


Re: INSPECT and TRAILING syntax
Frank Swarbrick wrote:
> Howard Brazee<howard@brazee.net> 05/09/06 10:07 AM >>> 
>
> I assume you mean something like...
>
> COMPUTE TRIMMED-LEN = FUNCTION LENGTH(MY-STRING)
> PERFORM VARYING R FROM FUNCTION LENGTH(MY-STRING) BY -1
>        UNTIL  R = ZERO OR MY-STRING(R:1) NOT = SPACE
>    SUBTRACT 1 FROM TRIMMED-LEN
> END-PERFORM
>
> Is than better than this?
> MOVE ZERO TO TALLY
> INSPECT FUNCTION REVERSE(MY-STRING) TALLYING TALLY FOR LEADING SPACES
> COMPUTE TRIMMED-LEN = FUNCTION LENGTH(MY-STRING) - TALLY
>
> Maybe, maybe not.  But I'd definitely prefer
> MOVE ZERO TO TALLY
> INSPECT MY-STRING TALLYING TALLY FOR TRAILING SPACES
> COMPUTE TRIMMED-LEN = FUNCTION LENGTH(MY-STRING) - TALLY
>
> Or, of course, best of all would be:
> COMPUTE TRIMMED-LEN = FUNCTION TRIM(MY-STRING RIGHT)
>
> Frank

Fujitsu has:

COMPUTE TRIMMED-LEN = FUNCTION STORED-CHAR-LENGTH(MY-STRING).




Report this thread to moderator Post Follow-up to this message
Old Post
HeyBub
05-10-06 08:55 AM


Re: INSPECT and TRAILING syntax
> Fujitsu has:
>
> COMPUTE TRIMMED-LEN = FUNCTION STORED-CHAR-LENGTH(MY-STRING).

Are these Fujitsu extensions documented anywhere on Internet ?


Re: using FUNCTION REVERSE (or whatever)
Of course, the Cobol runtime has to acquire memory to do this
(as with many other FUNCTION's) which may or may not ever
be free'd/reused.
So be careful using this in a paragraph you are perfoming a
couple of million times  :-)
Your symin might come knocking on your door  :-)

Roger While

"HeyBub" <heybubNOSPAM@gmail.com> schrieb im Newsbeitrag
news:1262gf5g7m80nbd@news.supernews.com...> Fujitsu has:
>
> COMPUTE TRIMMED-LEN = FUNCTION STORED-CHAR-LENGTH(MY-STRING).

> Frank Swarbrick wrote: 
>
> Fujitsu has:
>
> COMPUTE TRIMMED-LEN = FUNCTION STORED-CHAR-LENGTH(MY-STRING).
>
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Roger While
05-10-06 08:55 AM


Re: INSPECT and TRAILING syntax
"HeyBub" <heybubNOSPAM@gmail.com> schrieb im Newsbeitrag
news:1262gf5g7m80nbd@news.supernews.com...
> Fujitsu has:
>
> COMPUTE TRIMMED-LEN = FUNCTION STORED-CHAR-LENGTH(MY-STRING).
>
>

Sounds useful. Just implemented it in OpenCOBOL  :-)
Question, does it only check for trailing spaces or does it
also check for low-values ?

Roger While



Report this thread to moderator Post Follow-up to this message
Old Post
Roger While
05-10-06 08:55 AM


Re: INSPECT and TRAILING syntax
"Chuck Stevens" <charles.stevens@unisys.com> wrote in message
news:e3q4le$1lf5$1@si05.rsvl.unisys.com...
> Yes, as I recall it J4 was of the opinion that anything you'd want to do
> with TRAILING you could accomplish with existing syntax, even if it
> required a "temporary" and an extra statement.
>
> Adding new syntax for functionality that already exists -- particularly
> when the syntax for that functionality is pretty straightforward -- adds
> complexity to the language without adding functional feature content, and
> for that reason the suggestions to provide TRAILING were not followed.

Interesting.

That being the case...

Why was EVALUATE added to the language when IF was already there?

Why was SEARCH added when the same effect could be obtained with PERFORM?

Why was EXAMINE dropped in favour of INSPECT when they provide the same
functionality?

Why were scope delimiters added when we already had full stops?

Why was CONTINUE included when EXIT would have done?

Why was PICTURE provided in the langage when exactly the same functionality
was available with CLASS, and SIZE?

So much rhetoric, so little time... :-)

Pete.










Report this thread to moderator Post Follow-up to this message
Old Post
Pete Dashwood
05-10-06 11:55 PM


Sponsored Links




Last Thread Next Thread Next
Pages (6): [1] 2 3 4 5 6 »
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 02:47 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.