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
 
String different occurances of 3 variables to a variable.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sarat6900

New User


Joined: 02 Mar 2009
Posts: 12
Location: India

PostPosted: Thu May 13, 2010 1:03 pm    Post subject: String different occurances of 3 variables to a variable.
Reply with quote

Hi Team,

I am looking to string three variables as an input to a store procedure from different records

Var 1 - X(10)
Var 2 - X(20)
Var 3 - X(80)


I want to string it as Var 1,Var 2,Var 3|Var1,Var2,Var3|Var1,Var2,Var3|Var1,Var2,Var3|
to Final String X(1000)

For Eg:

Input has 4 Records

Rec 1
-----
Var 1 - A1
Var 2 - AAAAA
Var 3 - AAAAAAAAA

Rec 2
-----
Var 1 - B11
Var 2 - BBBBB
Var 3 - BBBBBBBBBB

Rec 3
-----
Var 1 - C11
Var 2 - CCCCC
Var 3 - CCCCCCCCCC

Rec 4
-----
Var 1 - D
Var 2 - DDDDD
Var 3 - DDDDDDDDDD


Out put string

When Rec 1 (Remove the trailing space and add delimiter | )

Final String
------------
A1,AAAAA,AAAAAAAAA|


When Rec 2 (Remove the trailing space and add delimiter | and build from REC 1 )
Final String
------------
A1,AAAAA,AAAAAAAAA|B11,BBBBB,BBBBBBBBBB|


When Rec 3 (Remove the trailing space and add delimiter | and build from REC 2 )
Final String
------------
A1,AAAAA,AAAAAAAAA|B11,BBBBB,BBBBBBBBBB|C11,CCCCC,CCCCCCCCCC|

When Rec 4 (Remove the trailing space and add delimiter | and build from REC 3 )
Final String
------------
A1,AAAAA,AAAAAAAAA|B11,BBBBB,BBBBBBBBBB|C11,CCCCC,CCCCCCCCCC|D,DDDDD,DDDDDDDDDD|


In need to find the length of the Final string i.e. excluding space.

Is this possible..

Any help is greatly appreciated..

Thanks,
Sarat.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8152
Location: East Dubuque, Illinois, USA

PostPosted: Thu May 13, 2010 4:38 pm    Post subject:
Reply with quote

What have you tried so far and what results have you gotten?

Have you clicked on the manuals link at the top of the page and read the COBOL Language Reference manual on the STRING statement?

Quote:
Is this possible..
Yes, it is possible. However, this is a HELP forum, not a DO-YOUR-JOB-FOR-YOUR forum, so don't expect us to just give you the code. We can guide you when you have problems, but since most of us responders are paid for our professional work output, asking for code will not typically get you much unless you're willing to pay the going daily rates (typically about 1000 U.S. dollars per day or fraction thereof).
Back to top
View user's profile Send private message
sarat6900

New User


Joined: 02 Mar 2009
Posts: 12
Location: India

PostPosted: Thu May 13, 2010 7:02 pm    Post subject:
Reply with quote

Sorry Robert.

I had a solution of my own (delimited by ' ') 3 spaces and string. I did not like for a generic solution

I just wanted to know if there is a better way for that.

Dont get me wrong, I dint want you to code for me!!!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Thu May 13, 2010 7:12 pm    Post subject:
Reply with quote

unless any of the var's can contain all spaces:
simply string a var, delimited by spaces,a '|', then then next var, etc.
then do an inspect tally reverse for first non-space will give you the length.
or simply increment an index until a space is encountered.
Back to top
View user's profile Send private message
smijoss

Active User


Joined: 30 Aug 2007
Posts: 114
Location: pune

PostPosted: Tue May 18, 2010 12:31 pm    Post subject:
Reply with quote

If this is an array you can use 'with pointer' clause in the string function
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    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 Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm

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