View previous topic :: View next topic |
Author |
Message |
vijay Beginner
Joined: 09 May 2003 Posts: 131 Topics: 64
|
Posted: Wed Jun 02, 2004 2:01 pm Post subject: field concatenation |
|
|
Hi ,
I've 4 fields each of length 40.The requirement is to strip trailing spaces and double
spaces from each field and concatenate the fields as 1 field. ---field1+blank+field2+blank+field3+blank+field4.
Do I've to go through each character to do this or is there an easier way to do this in cobol.
Thanks,
Vijay |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Jun 02, 2004 2:35 pm Post subject: |
|
|
vijay,
Removing the trailing spaces is very easy, you don't have to check each and every byte in the field. you can use Inspect function reverse and you will find the length the actual string. search this application forum for "function+reverse" you will find many examples.
Why don't you post sample input and desired output?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Itanium Beginner
Joined: 14 Aug 2005 Posts: 6 Topics: 1
|
Posted: Wed Aug 29, 2007 3:35 pm Post subject: |
|
|
Hi Kolusu,
i too have the same requirements as above, i'm done with the function reverese and trying to do the below to concatenate 6 Lines into 1.
But it is not working, Can you please help.
Code: |
PERFORM VARYING WS-DESC-CNT FROM 1 BY 1 UNTIL
WS-LAST-STR
MOVE DESC-LINE(WS-DESC-CNT) TO WS-DESC-TEMP-LINE
PERFORM 3000-GET-DESC-CHAR-CNT THRU 3000-EXIT --> This will identify String Len WS-DESC-CHAR-CNT
STRING WS-DESC-LINE
WS-DESC-TEMP-LINE (1:WS-DESC-CHAR-CNT)
' '
DELIMITED BY SIZE
INTO
WS-DESC-LINE
IF WS-DESC-CNT = 6
SET WS-LAST-STR TO TRUE
END-IF
END-PERFORM
|
I've used WS-DESC-LINE as Source and Destination to concatenate, i think this is the problem. |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Wed Aug 29, 2007 4:28 pm Post subject: |
|
|
If you have imbedded double spaces, will you not have to go thru each field, char by char and shift left? _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
CICS Guy Intermediate
Joined: 30 Apr 2007 Posts: 292 Topics: 3
|
Posted: Wed Aug 29, 2007 4:52 pm Post subject: |
|
|
Sounds like a standard "squeeze out the gas" compress routine, much easier (or at least less complicated) now with inline performs and reference modification.. |
|
Back to top |
|
|
|
|