View previous topic :: View next topic
|
Author |
Message |
kalukakkad
New User
Joined: 10 Mar 2005 Posts: 81
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
kalukakkad
New User
Joined: 10 Mar 2005 Posts: 81
|
|
|
|
Thanks a lot. |
|
Back to top |
|
|
|