Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Can someone explain this

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Thu Dec 20, 2007 1:11 pm    Post subject: Can someone explain this
Reply with quote

I have 2 COBOL programs SAMPLE11 and SAMPLE22.

SAMPLE11 calls SAMPLE22.

SAMPLE11 has
WORKING-STORAGE SECTION.
01 WS-EXTRA.
05 WS-EXTRA-LEN PIC S9(04) COMP.
05 WS-EXTRA-1 PIC X(100).

MOVE +100 TO WS-EXTRA-LEN.
MOVE 'ABCDEFGHIJKLMNOPQR' TO WS-EXTRA-1.
CALL 'SAMPLE22' USING WS-EXTRA.

SAMPLE22
LINKAGE,SECTION.
01 LS-VAR.
05 LS-LEN PIC S9(04) COMP.
05 LS-DATA PIC X(01).
PROCEDURE DIVISION USING LS-VAR.
DISPLAY LS-DATA(1:LS-LEN)

I am passing 100 bytes from SAMPLE11 to SAMPLE22. The linkage of SAMPLE22 has 1 byte of data.

Question : How is SAMPLE22 program able to display complete 100 bytes
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Dec 20, 2007 2:14 pm    Post subject:
Reply with quote

reference modification overrides the defined data length. As long as you do not exceed the bounds defined by your CALLing prg USING data, you will be ok.

the 1 char field definied by ls-data is only a starting position when you use reference modification. without the reference modification, the results of your cobol commands will use the length provided by the data definition.
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Thu Dec 20, 2007 3:32 pm    Post subject: Reply to: Can someone explain this
Reply with quote

Thanks a lot.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Can someone explain me this JCL line ... PeterHolland JCL & VSAM 9 Sat Dec 12, 2015 7:22 am
No new posts DB2 Explain agkshirsagar DB2 3 Wed Aug 28, 2013 6:23 pm
No new posts can some one explain the below code... ram_vizag JCL & VSAM 3 Thu Aug 22, 2013 4:35 pm
No new posts Please explain this SQL CODE. tamminenisidhartha DB2 4 Wed Mar 13, 2013 5:05 pm
No new posts Explain Comparision Report gylbharat DB2 4 Tue Jun 05, 2012 5:48 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us