Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Method to find the length of copybook
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL
Author Message
PeD

Active User


Joined: 26 Nov 2005
Posts: 297
Location: Belgium

PostPosted: Wed Apr 30, 2008 3:27 am    Post subject:
Reply with quote

http://groups.google.be/group/bit.listserv.tsorexx/browse_thread/thread/d60c97b35839e3ff/bdcec8b86fb6ecae?lnk=gst&q=rexx+record+calculation#bdcec8b86fb6ecae
See first thread.

Tribute of Mark Harrington.

Just perfect.

Regards
Pierre
Back to top
View user's profile Send private message
References
PostPosted: Wed Apr 30, 2008 3:27 am    Post subject: Re: Reply with quote

Bill O'Boyle

Active User


Joined: 14 Jan 2008
Posts: 296
Location: Orlando, FL, USA

PostPosted: Thu May 01, 2008 2:18 am    Post subject: Re: Method to find the length of copybook
Reply with quote

Sincere apologies to one and all regarding the GETLGTH Assembler sub-program previously posted. I must have had my head up my A$$ because this previous version WILL NOT WORK and with that, please use the replacement GETLGTH sub-program below.

The Caller's parmlist of four arguments remains the same.

Code:

GETLGTH  CSECT                                                           
         USING *,R3                INFORM ASSEMBLER                       
         SAVE (14,12)              SAVE REGISTERS                         
         LA    R3,0(,R15)          R3 IS BASE                             
         LM    R5,R8,0(R1)         PARM-ADDRESSABILITY                   
         LA    R5,0(,R5)           CLEAR TOP-BIT                         
         LA    R6,0(,R6)           SAME                                   
         LA    R7,0(,R7)           SAME                                   
         LA    R8,0(,R8)           SAME                                   
         XC    0(4,R8),0(R8)       ENSURE X'00'S                         
         LR    R1,R6               LOAD END-ADDRESS                       
         SLR   R1,R5               REDUCE BY START-ADDRESS               
         AL    R1,0(,R7)           ADD LAST-FIELD'S LGTH                 
         LA    R15,16              SET 'BAD' RETURN-CODE                 
         CHI   R1,0                NEGATIVE?                     
         BL    RTN2CLLR            YES, RETURN TO CALLER
         LA    R15,8               RESET RETURN-CODE
         BE    RTN2CLLR            RETURN WHEN ZERO           
         ST    R1,0(,R8)           STORE RESULT IN 4TH-PARM               
         SLR   R15,R15             ALL IS WELL                           
RTN2CLLR EQU   *                                                         
         RETURN (14,12),RC=(15)    RESTORE AND RETURN                     
GETLGTH  AMODE 31                                                         
GETLGTH  RMODE ANY                                                       
         YREGS                     REGISTER-EQUATE MACRO                 
         END   ,                   END 'GETLGTH'                         

Slowly wiping egg from face.... icon_redface.gif

Bill
Back to top
View user's profile Send private message
sudhaaa

New User


Joined: 24 Mar 2005
Posts: 47

PostPosted: Fri May 02, 2008 6:51 pm    Post subject:
Reply with quote

If you have Fileaid, use option 3.8

Thanks,
Sudhaaa
Back to top
View user's profile Send private message
kirankumarj

New User


Joined: 18 Dec 2007
Posts: 39
Location: delaware

PostPosted: Sat Jun 21, 2008 1:14 am    Post subject: From fileaid
Reply with quote

Option 8 (XREF) will give you the length !!
Back to top
View user's profile Send private message
Pankaj Gupta

New User


Joined: 07 May 2008
Posts: 27
Location: Bangalore

PostPosted: Sat Jun 21, 2008 5:04 am    Post subject:
Reply with quote

Quote:
DISPLAY LENGTH OF yourcopybook

Hello, but I am having a doubt about this syntaxes. The compiler it is not compiling "LENGTH OF". Also before I am mentioned that it is also not liking the EVALUATES syntax. Is the LENTH OF the valid COBOLs?
Back to top
View user's profile Send private message
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 8033
Location: 221 B Baker St

PostPosted: Sat Jun 21, 2008 6:07 am    Post subject:
Reply with quote

Hello,

Quote:
The compiler it is not compiling "LENGTH OF".
And it should not/will not. . . .

That suggestion was for using fileaid, not compiling a program.
Back to top
View user's profile Send private message
Pankaj Gupta

New User


Joined: 07 May 2008
Posts: 27
Location: Bangalore

PostPosted: Sat Jun 21, 2008 11:25 pm    Post subject:
Reply with quote

acevedo wrote:
what about ?
Quote:
DISPLAY LENGTH OF yourcopybook


Mr dick, I am sure this is meant to be the COBOL
Back to top
View user's profile Send private message
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 8033
Location: 221 B Baker St

PostPosted: Sun Jun 22, 2008 12:21 am    Post subject:
Reply with quote

Hello,

Quote:
Mr dick, I am sure this is meant to be the COBOL
Why so sure? Your certainty is misplaced if you mean the cobol compiler.

There is no "display length of" in the IBM mainframe cobol language.

The suggestion was for displaying the length using fileaid.
Back to top
View user's profile Send private message
Pankaj Gupta

New User


Joined: 07 May 2008
Posts: 27
Location: Bangalore

PostPosted: Sun Jun 22, 2008 12:39 am    Post subject:
Reply with quote

I am really not being so sure. 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?

Is DISPLAY also being a command of the FILEAID? If this is being so then I have never been seeing it.
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 297
Location: Belgium

PostPosted: Sun Jun 22, 2008 1:18 am    Post subject:
Reply with quote

I am back to this question and back to my answer.
The handy tool of Mark H. is just perfect for that.
On top of that the poster seems to want to calculate the length outside a program, just online in ISPF.
But maybe noone does the effort to go inside the link and to open the first thread of Mark H.

Ohh these days ...

Cheers

Pierre
Back to top
View user's profile Send private message
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 8033
Location: 221 B Baker St

PostPosted: Sun Jun 22, 2008 5:10 am    Post subject:
Reply with quote

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 icon_smile.gif
Back to top
View user's profile Send private message
Srinivas George

New User


Joined: 31 May 2008
Posts: 4
Location: bangalore

PostPosted: Sun Jun 22, 2008 2:14 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 8033
Location: 221 B Baker St

PostPosted: Sun Jun 22, 2008 10:17 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Srinivas George

New User


Joined: 31 May 2008
Posts: 4
Location: bangalore

PostPosted: Mon Jun 23, 2008 1:02 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 8033
Location: 221 B Baker St

PostPosted: Mon Jun 23, 2008 6:33 pm    Post subject:
Reply with quote

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) icon_smile.gif

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 icon_redface.gif
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL All times are GMT + 6 HoursGoto page Previous  1, 2, 3  Next
Page 2 of 3