Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum 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: 2253
Location: Hampshire, 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: 8505
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: 2310
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: 2253
Location: Hampshire, 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 User key common area users - How to r... vasanthz All Other Mainframe Topics 0 Thu Oct 10, 2019 1:17 am
No new posts Formatting bit fields IanWorthington DFSORT/ICETOOL 9 Thu Sep 19, 2019 6:14 pm
No new posts IEBGENER to copy from FB to VB and re... Mike.Fulton All Other Mainframe Topics 3 Sat Aug 24, 2019 7:20 am
No new posts Training on numeric fields data formats sergeyken SYNCSORT 12 Thu Aug 01, 2019 8:15 pm
No new posts Need to get the SUM of two fields usi... Poha Eater DFSORT/ICETOOL 7 Tue Jun 18, 2019 1:27 pm

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