View previous topic :: View next topic
|
Author |
Message |
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
In COBOL we are having the DISPLAY verb and we are also having "LENGTH OF".
Why is then DISPLAY LENGTH OF VARIABLE not being COBOL?
|
You cannot "mix and match" as you seem to want to do. It is not part of cobol because the people responsible for the development of the language have seen no reason to include this.
You must use the syntax as intended (which is in the manual which you are not using). At the top of the web page is a link to "IBM Manuals" - the cobol manuals are the first group. If you look in the manuals you will not find "display length of" as an opton. You will also not find (and cannot compile) "MULTIPLY FILE-SECTION BY SPECIAL-NAMES GIVING WORKING-STORAGE" even though all of these too are valid parts of the language.
If your goal is to get the length and you have not looked at Pierre's link, you should do so. You might also get help from someone who speaks assembler and look at Bill's suggestion.
If you want the compiler to be changed to perform as you believe it should, you will need to manage some disappointment |
|
Back to top |
|
|
Srinivas George
New User
Joined: 31 May 2008 Posts: 4 Location: bangalore
|
|
|
|
Grettings Pankaj Gupta,
While "ADD WORKING-STORAGE TO FILE-SECTION" is certainly yes most amusing, you are not so wrong in trying to use
Code: |
DISPLAY LENGTH OF VARIABLE |
it is yes but one step away. We must certainly assign LENGTH OF to a variable and then yes we can display the variable. I elaborate now in the code for you:
Code: |
SET VARIABLE TO LENGTH OF TOP-VARIABLE-OF-COPYBOOK
DISPLAY VARIABLE |
This you will find will certainly compile. Unless you are yes using the long teethed OSVS COBOL.
I am certainly intrigued by the use of an assembler routine to determine the length of a copybook if we are yes using the OSVS COBOL. In this situation we can certainly say this:
Code: |
EXAMINE TOP-LEVEL-OF-COPYBOOK
TALLYING VARIABLE FOR CHARACTERS |
NO, We cannot. . .
After this code has executed then yes the variable VARIABLE will certainly contain the length of the copybook. An assembler subroutine seems certainy over the lid. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello Srinivas George,
Before posting did you do testing - on an IBM mainframe?
I didn't trust my memory, so i looked at the COBOL manuals available via the "IBM Manuals" link at the top of the page and as i recalled, EXAMINE is no longer supported. To do the same thing, INSPECT is now used. If you code EXAMINE and use Enterprise (the most current) COBOL, EXAMINE causes this:
Code: |
955 IGYPS2072-S "EXAMINE" WAS INVALID. SKIPPED TO THE NEXT VERB |
If one uses INSPECT (with Enterprise COBOL) and tries to TALLY the length of the copybook, the result is not (always?) the correct length.
If you are going to post "solutions", you need to test them and the test must be done in an environment covered by these forums (i.e. only IBM mainframe - usng the IBM compilers). |
|
Back to top |
|
|
Srinivas George
New User
Joined: 31 May 2008 Posts: 4 Location: bangalore
|
|
|
|
Mr Dick, my humble apologies. By a slip of the keboard I have certainly typed "EXAMINE" when I meant to type "INSPECT".
On OSVS CObol, as my post was certainly concerning, this WILL give the correct length. Note that yes you should certainly be setting the counter to the zero first:
Code: |
MOVE ZERO TO VARIABLE
INSPECT TOP-LEVEL-OF-COPYBOOK
TALLYING VARIABLE FOR CHARACTERS |
After this code the field "VARIABLE" WILL contain yes the correct length of everything that is certainly below the top level. This code I am using yes every day. It is certainly correct and certainly works.
I apologise certainly once more for typing the wrong verb. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I apologise certainly once more for typing the wrong verb.
|
Not a problem - we all make that mistake (if we've coded long enough to remember EXAMINE)
As far as the INSPECT, when i ran a couple of incomplete tests, the value of length worked for a very simple copybook, but i did not get what i expected for a complicated copybook (it is over 14k in length and contains many redefinitions and several repeating groups). Time permitting, i'll try a bit more today.
I mentioned using an IBM mainframe because we have received posts for unix and windows that have compiler features (extensions) the ibm cobol compiler does not support. Sorry for the misunderstanding |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
In an OS/VS COBOL environment running CICS, do NOT use the EXAMINE, TRANSFORM, INSPECT, etc, Verbs, because internally, they issue an MVS GETMAIN and due to this, eventually the region will abend with an S80A abend, which means that Virtual Storage has been exhausted. It is a known bug NOT to use these Verbs in CICS t/w OS/VS COBOL.
HTH....
Regards,
Bill |
|
Back to top |
|
|
|