Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
remove the gap b/w 2 fields

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
shymala

New User


Joined: 26 Jul 2018
Posts: 5
Location: india

PostPosted: Thu Aug 02, 2018 12:05 pm    Post subject: remove the gap b/w 2 fields
Reply with quote

I need to concatenate 2 fields in my o/p file.
as of now I am getting the o/p as

{12345678} {1:1234:456}
I have a gap in b/w these 2 fields because of varying length of field1 the actual o/p should be
{12345678}{1:1234:456}

the important thing here is field 1 will be having varying length. say for example
{123}
{12345}
the 1st field length is 16 characters.

can anyone help me in solving this problem

Read more: http://ibmmainframes.com/about66753.html#ixzz5N049e3gy
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2126
Location: UK

PostPosted: Thu Aug 02, 2018 1:32 pm    Post subject: Reply to: remove the gap b/w 2 fields
Reply with quote

Find the first space (INSPECT). Move the data before that position to a new variableand use reference modification to move the data from (that posiiton +1) to a new variable. STRING the 2 values together.
I do not know if you can reference modification to define the destination of a string but if you can then you could simply use the current variable by moving the second part one byte to the left.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8410
Location: Dubuque, Iowa, USA

PostPosted: Thu Aug 02, 2018 6:03 pm    Post subject:
Reply with quote

Quote:
I do not know if you can reference modification to define the destination of a string but if you can then you could simply use the current variable by moving the second part one byte to the left.
Yes, COBOL allows reference modification for the sending and receiving variables in a MOVE statement so this could work.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2066
Location: NY,USA

PostPosted: Thu Aug 02, 2018 7:31 pm    Post subject:
Reply with quote

The link attached in your post has the solution already , Reread what RahulG31 has posted and modify slightly to include another filed and follow the same. The same approach is what Nic too saying above.
However, if you have DB2 in the program then you can use below query to get it easily.
Code:
select  concat(strip(:variable-1),strip(:variable-2))
        into :concat-var
from sysibm.sysdummy1
Back to top
View user's profile Send private message
shymala

New User


Joined: 26 Jul 2018
Posts: 5
Location: india

PostPosted: Fri Aug 03, 2018 2:24 pm    Post subject: Reply to: remove the gap b/w 2 fields
Reply with quote

Hi All,

The case is I am writing the data to header file of length 100 characters and the 1st field is varying . so I need to have a count and move that in a proper way.

Is there any other option apart from reference modification.
Like concatenate option in cobol not in JCl if so please provide me the example.
Does Trim option works for this situation.

Thanks
Shymala
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2126
Location: UK

PostPosted: Fri Aug 03, 2018 2:32 pm    Post subject: Reply to: remove the gap b/w 2 fields
Reply with quote

You have been given a perfectly good response that will work. Re-stating your requirement does not change the response.
Why not write a little program to test out TRIM? Or read the manual.
As you seem to not be able to try recommended answers or try things out for yourself there is little point in continuing this topic. Locked.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Remove selected duplicate rows from t... hnharish DFSORT/ICETOOL 3 Wed Sep 05, 2018 3:11 am
This topic is locked: you cannot edit posts or make replies. I need to remove low values in my field shymala COBOL Programming 8 Sun Jul 29, 2018 11:15 am
No new posts How to remove spaces between variable... Selvarajars DFSORT/ICETOOL 7 Fri Jul 27, 2018 3:58 pm
No new posts Comparing Comp-3 fields with greater ... Prateeksichem1 DFSORT/ICETOOL 11 Fri Jul 13, 2018 8:45 am
No new posts Remove duplicate record with condition rajiv rengasamy DFSORT/ICETOOL 4 Wed Jul 11, 2018 3:55 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us