View previous topic :: View next topic |
Author |
Message |
vijay Beginner
Joined: 09 May 2003 Posts: 131 Topics: 64
|
Posted: Mon Jun 09, 2008 12:31 pm Post subject: Question on string statement |
|
|
Hi ,
Need help with small logic.Here is the code
01 TEST-DATA.
05 ws-text PIC X(05) VALUE 'temp'.
05 ws-output PIC X(50).
EJECT
PROCEDURE DIVISION.
move 'xxxx - temp' to ws-output
STRING ws-text
ws-output (1:6)
DELIMITED BY SIZE
INTO ws-output.
display ws-output.
GOBACK.
Why is the ouput 'temp temp t ' ? If i change INTO ws-output to another variable WS-OUTPUT1 it works fine.Anyone help what is the reason behind this>? |
|
Back to top |
|
 |
jsharon1248 Intermediate
Joined: 08 Aug 2007 Posts: 291 Topics: 2 Location: Chicago
|
Posted: Mon Jun 09, 2008 1:51 pm Post subject: |
|
|
Why are you using the WS-OUTPUT field as the source and target? Based on the values, COBOL is doing what I would expect. The compiler replaces the STRING with a series of MOVEs, so the results make sense. If you're really trying to prefix WS-OUTPUT with the value in WS-TEXT, define the fields as part of a group, or string the fields into a different target. |
|
Back to top |
|
 |
|
|