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

Can someone explain this


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts DB2 Statistics - Using EXPLAIN and qu... DB2 1
No new posts Can someone explain me this JCL line ... JCL & VSAM 9
No new posts DB2 Explain DB2 3
No new posts can some one explain the below code... JCL & VSAM 3
No new posts Please explain this SQL CODE. DB2 4
Search our Forums:

Back to Top