MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

field concatenation

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Wed Jun 02, 2004 2:01 pm    Post subject: field concatenation Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Wed Jun 02, 2004 2:35 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Itanium
Beginner


Joined: 14 Aug 2005
Posts: 6
Topics: 1

PostPosted: Wed Aug 29, 2007 3:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Wed Aug 29, 2007 4:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Wed Aug 29, 2007 4:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group