From: Frank Swarbrick on 17 Jul 2008 14:13 >>> On 7/17/2008 at 8:14 AM, in message <dpku74pfes1grlmr4v0uefgrrbu5b82isu(a)4ax.com>, Howard Brazee<howard(a)brazee.net> wrote: > On Wed, 16 Jul 2008 18:30:26 -0600, "Frank Swarbrick" > <Frank.Swarbrick(a)efirstbank.com> wrote: > >>I guess I am one of those 'nervous programmers'. If only Cobol had >>"DELIMITED BY TRAILING SPACES" or some such thing. > > I've found that I have moved away from one of the basics of CoBOL, > preferring to use reference modification to wordy commands. Do we > need DELIMITED BY TRAILING SPACES or TRIM to be clear? I think that > may be overkill, reference modification loops aren't hard to > understand. No, but they are wordy, and I'd rather avoid them for something this basic.
From: Howard Brazee on 17 Jul 2008 14:24 On Thu, 17 Jul 2008 12:39:43 -0500, Robert <no(a)e.mail> wrote: >There are several management types. The worst is a former programmer Peter Principled into >a corner office. For him, time stopped when he last wrote code. If he had trouble with, >say complex conditionals or the sort verb, those features will be verboten until he >retires. The shop will be stuck with old technology so long as he's there. I've come across them - they are not the worst. >Managers like that are found in medium sized companies. They don't survive in large >companies like the ones where I perfer to work. I've come across them in large companies. Sometimes we live with their standards after they retire. >>'He who pays the piper calls the tune' is a sentiment which pre-dates >>computer programming by a few years, Mr Wagner. Are you saying your >>experience is so limited you've never been exposed to it? > >I heard it often in Asian bars. Unlike IT contractors, whores set limits on how low >they'll go. They have more dignity. I've experienced both sides of IT contracting, and just as with everything else I've experienced, how low we will go as whores is variable. I've read that it's variable with the kind of whores you mentioned as well - but we are all whores, with different prices, and different willingness to meet those prices. >No, but just this morning I saw a repulsive GO TO DEPENDING ON. Fortunately, my stomach >was empty. I remember when that was taught and recommended. Old code doesn't bother me anymore than old people. If it happened to be young code, then my feeling is pity. If I was the kind of person to get so easily repulsed, I couldn't go to the bathroom, with results that are not favorable to my health and happiness.
From: Howard Brazee on 17 Jul 2008 14:35 On Thu, 17 Jul 2008 12:13:53 -0600, "Frank Swarbrick" <Frank.Swarbrick(a)efirstbank.com> wrote: >> I've found that I have moved away from one of the basics of CoBOL, >> preferring to use reference modification to wordy commands. Do we >> need DELIMITED BY TRAILING SPACES or TRIM to be clear? I think that >> may be overkill, reference modification loops aren't hard to >> understand. > >No, but they are wordy, and I'd rather avoid them for something this basic. I have to try to decide which would be easier for maintenance programmers to understand correctly. If the commands aren't used much, I need to put in comments, but I've experienced maintenance programmers updating the code, but not the comments. Nowadays, I expect reference modification will be more obvious (provided I code it with that in mind).
From: Pete Dashwood on 17 Jul 2008 23:44 "Frank Swarbrick" <Frank.Swarbrick(a)efirstbank.com> wrote in message news:487F372A.6F0F.0085.0(a)efirstbank.com... >>>> On 7/16/2008 at 11:21 PM, in message > <epjt74dastquiojsap46u6vlk72b0o0704(a)4ax.com>, Robert<no(a)e.mail> wrote: >> On Wed, 16 Jul 2008 18:30:26 -0600, "Frank Swarbrick" >> <Frank.Swarbrick(a)efirstbank.com> >> wrote: >> >>>>>> On 7/15/2008 at 10:19 PM, in message >>><pupq74t94srcr2ps97vc6qikc24he4gq1u(a)4ax.com>, Robert<no(a)e.mail> wrote: >> >>>> STRING 'SQL error in ' SQL-ERRLOC ' -- Consult documentation. ' >>>> DELMITED BY ' ' *> literal is 10 spaces >>>> INTO ERROR-MSG >>> >>>I guess I am one of those 'nervous programmers'. If only Cobol had >>>"DELIMITED BY TRAILING SPACES" or some such thing. >> >> Good point. The standards committee dropped the ball, then tried to >> recover by adding >> TRIM() to the 2008 spec. >> >> AcuCobol does have TRAILING SPACES. >> >>>> A way to trim left spaces with a single statement is >>>> >>>> UNSTRING sloppy-word DELIMITED BY ALL SPACE INTO trimmed trimmed >>>> >>>> If it doesn't have a leading space, the first mention of trimmed is the > >>>> destination. If it >>>> does have leading spaces, they go into the first mention of trimmed, >>>> only to be >>>> overwritten by the word going into the second mention of trimmed. >>> >>>How about trimming right spaces? >> >> MOVE ZEROS TO SQL-ERRLOC-LEN >> INSPECT ERRLOC TALLYING SQL-ERRLOC-LEN FOR CHARACTERS BEFORE INITIAL ' > >> ' >> >> Not much better than ten spaces on STRING. >> >>>The best would be the proposed TRIM instrinsic function: >>>STRING 'SQL error in ' >>> FUNCTION TRIM(SQL-ERRLOC) >>> ' -- Consult documentation.' >>> DELIMITED BY SIZE >>> INTO ERROR-MSG >>> >>>OpenCobol supports it! But VSE won't in my lifetime. Ah well! >> >> Can't you write user-defined functions in VSE Cobol? > > If you mean "FUNCTION-ID. TRIM." then no, you cannot. Cobol VSE supports > only the 1985 standard with the 1989 addenda, and nothing newer. Fujitsu extends COBOL with the following intrinsic function: STORED-CHAR-LENGTH Function This function returns the length of the effective characters (without training blanks) contained in argument-1. The STORED-CHAR-LENGTH function is specific to Win32, Sun and Linux. For details about how to use the examples, refer to "STORED-CHAR-LENG Function" in the "Syntax Samples". Format FUNCTION STORED-CHAR-LENGTH (argument-1) Argument 1. Argument-1 must be alphanumeric or national characters. It must not be a group item. (It can be 01 with a picture... Pete) 2. Argument-1 must consist of one or more characters. Function Value 1. The function value is the number of character positions of the effective characters contained in argument-1. 2. When argument-1 is the alphanumeric class, the function value indicates the number of alphanumeric character positions of the effective characters. 3. When argument-1 is the national class, the function value indicates the number of national character positions of the effective characters. 4. The characters stored in argument-1 must follow the encoding forms dictated by the class of argument-1. Otherwise, the result is undefined. Function Type The function type is integer. Although it isn't clear above, I have found from extensive use of this function (it is very useful...) that the number it returns is the ordinal position of the last non-blank character in the string, so embedded spaces (any number) are fine and get counted. I'm inclined to agree with Robert that it must be possible to write such a function easily in COBOL and put it in the same library as the other intrinsic functions that ARE available with VSE. Try having a chat to your friendly neighbourhood systems programmer... if the guy is good he might be very happy to to indulge you. I'd be surprised if IBM don't allow maintenance of these libraries. (You're not changing any existing functionality, just extending it....now, where have we heard that before...? Oh yeah, standard practice with OO...:-) Here's another idea :-) Why not write your function/module/whatever then replace one of the unused intrinsics with it (say COS...) if there really is no way to add to the compiler's function library... (no, Frank, I was joking...:-)) Pete. -- "I used to write COBOL...now I can do anything."
From: Roger While on 18 Jul 2008 08:40
"Pete Dashwood" <dashwood(a)removethis.enternet.co.nz> schrieb im Newsbeitrag news:6eahskF64pbgU1(a)mid.individual.net... > Fujitsu extends COBOL with the following intrinsic function: > > STORED-CHAR-LENGTH Function > > This function returns the length of the effective characters (without > training blanks) > contained in argument-1. > The STORED-CHAR-LENGTH function is specific to Win32, Sun and Linux. > For details about how to use the examples, refer to "STORED-CHAR-LENG > Function" > in the "Syntax Samples". OpenCOBOL also has this function. Roger |