IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Method to find the length of copybook


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ManjulaRajamurugan

New User


Joined: 28 Apr 2008
Posts: 4
Location: Hyderabad

PostPosted: Mon Apr 28, 2008 3:39 pm
Reply with quote

Hi,
Is there any method to find the length of copybooks? other than counting the length of individual fields included in that copybook?
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Mon Apr 28, 2008 3:44 pm
Reply with quote

Do you have FileAid?

O.
Back to top
View user's profile Send private message
mytags

New User


Joined: 28 Apr 2008
Posts: 63
Location: US

PostPosted: Mon Apr 28, 2008 3:47 pm
Reply with quote

By using listcatentries in the Copy book list we can find the length of the copy book.
Back to top
View user's profile Send private message
ManjulaRajamurugan

New User


Joined: 28 Apr 2008
Posts: 4
Location: Hyderabad

PostPosted: Mon Apr 28, 2008 3:51 pm
Reply with quote

may i know where to give it? that listcatentries?
Back to top
View user's profile Send private message
ManjulaRajamurugan

New User


Joined: 28 Apr 2008
Posts: 4
Location: Hyderabad

PostPosted: Mon Apr 28, 2008 3:54 pm
Reply with quote

also can we find it using option 3 and then 13?
Back to top
View user's profile Send private message
mytags

New User


Joined: 28 Apr 2008
Posts: 63
Location: US

PostPosted: Mon Apr 28, 2008 4:02 pm
Reply with quote

After entering your Pds name in option 3.4 we will get a list of copy books included in this pds,within the command line we can type 'listcat entries(/) all' then we can see the full details including its length.
With Regards,
Hari
Back to top
View user's profile Send private message
ManjulaRajamurugan

New User


Joined: 28 Apr 2008
Posts: 4
Location: Hyderabad

PostPosted: Mon Apr 28, 2008 4:03 pm
Reply with quote

ok thanks
Back to top
View user's profile Send private message
mytags

New User


Joined: 28 Apr 2008
Posts: 63
Location: US

PostPosted: Mon Apr 28, 2008 4:04 pm
Reply with quote

'Welcome'
Manjula

With regards
Hari
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Apr 28, 2008 4:14 pm
Reply with quote

not really sure how listcat can provide you a list of lengths that are derived by adding element lengths.

are you not just receiving a list of number of records (lines) in each copybook?

normally, looking at a compile listing will provide you the length.

I have a special program that has nothing except copy statements in linkage section. that means the compiler will start at relative zero for each level 01 encounterd, thus displacements (relative locations) are oriented to the begining of the copybook.
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Mon Apr 28, 2008 4:23 pm
Reply with quote

what about ?
Quote:
DISPLAY LENGTH OF yourcopybook
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Apr 28, 2008 7:45 pm
Reply with quote

acevedo,

Not sure about this but I think "LENGTH OF" needs a variable name.

Maybe:
DISPLAY LENGTH OF 01 level in yourcopybook ?

PS to Manjula:
Some copybooks may have multiple 01 levels.
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Mon Apr 28, 2008 9:01 pm
Reply with quote

our standards says: if any, only one 01 level por copybook.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Apr 28, 2008 10:05 pm
Reply with quote

The PS was for Manjula.
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Tue Apr 29, 2008 11:47 am
Reply with quote

My reply was not the result of thinking that PS was for me, it was just a comment.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Apr 30, 2008 2:56 am
Reply with quote

The following is primarily for OS/VS COBOL but can certainly be used in COBOL2 and greater.

You could call the following sub-program 'GETLGTH', passing four binary-fword parameters.
Code:

01  WS-GETLGTH PIC X(08) VALUE 'GETLGTH'.
01  WS-FIELD-LGTH PIC 9(08) COMP.
01  WS-BOOK-LGTH PIC 9(08) COMP.
01  WS-COPYBOOK-START.
    03..........
    03..........
    03..........
    03 WS-LAST-FIELD PIC X(20).
*
MOVE 20 TO WS-FIELD-LGTH.
*
CALL WS-GETLGTH USING WS-COPYBOOK-START,
                      WS-LAST-FIELD,
                      WS-FIELD-LGTH,
                      WS-BOOK-LGTH.

After return back from "GETLGTH", WS-BOOK-LGTH will contains the overall length from the first byte of WS-COPYBOOK-START through the last byte of WS-LAST-FIELD.
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    R8,0(,R8)           CLEAR TOP-BIT                         
         L     R6,0(,R6)           END-ADDRESS INTO R6                   
         S     R6,0(,R5)           SUBTRACT START-ADDRESS FWORD           
         A     R6,0(,R7)           ADD LAST-FIELD'S FWORD-LGTH           
         BCTR  R6,0                REDUCE BY 1                           
         ST    R6,0(,R8)           STORE IN 4TH-PARM                     
         LA    R15,0               SET RETURN-CODE                       
         CR    R6,R15              EXCEEDS ZERO?                         
         BH    RTN2CLLR            YES, RETURN TO CALLER                 
         ST    R15,0(,R8)          ENSURE X'00'S                         
         LA    R15,16              SET RETURN-CODE                       
RTN2CLLR EQU   *                                                         
         RETURN (14,12),RC=(15)    RESTORE AND RETURN                     
GETLGTH  AMODE 31                                                         
GETLGTH  RMODE ANY                                                       
         YREGS                     REGISTER-EQUATE MACRO                 
         END   ,                   END 'GETLGTH'                         

HTH....

Regards,

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

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Wed Apr 30, 2008 3:27 am
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
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu May 01, 2008 2:18 am
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: 51

PostPosted: Fri May 02, 2008 6:51 pm
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: 51
Location: delaware

PostPosted: Sat Jun 21, 2008 1:14 am
Reply with quote

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

New User


Joined: 07 May 2008
Posts: 50
Location: Bangalore

PostPosted: Sat Jun 21, 2008 5:04 am
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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sat Jun 21, 2008 6:07 am
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
Currently Banned

New User


Joined: 07 May 2008
Posts: 50
Location: Bangalore

PostPosted: Sat Jun 21, 2008 11:25 pm
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

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sun Jun 22, 2008 12:21 am
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
Currently Banned

New User


Joined: 07 May 2008
Posts: 50
Location: Bangalore

PostPosted: Sun Jun 22, 2008 12:39 am
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: 459
Location: Belgium

PostPosted: Sun Jun 22, 2008 1:18 am
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Replacing FILLER with FILLER<SeqNu... DFSORT/ICETOOL 2
No new posts Get RECORD LENGTH, allocated space of... CLIST & REXX 7
No new posts sort to find out the char which repea... Mainframe Interview Questions 10
No new posts Compare 2 alphabets in a REXX and fin... CLIST & REXX 2
No new posts Store the data for fixed length COBOL Programming 1
Search our Forums:

Back to Top