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
 
To Concatenate string and compound variable.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
EternalQuest

New User


Joined: 24 Dec 2009
Posts: 4
Location: Chennai

PostPosted: Fri Mar 19, 2010 4:40 pm    Post subject: To Concatenate string and compound variable.
Reply with quote

Hi,

I am trying to update (concatenate a string and a compound variable) a record in a file. I used the following statements

Rexx Code:---------
"EXECIO 1 DISKRU MEMSTAT 1(STEM LINE."
SAY LINE.1 /* Output: Test
TEST.1 = LINE.1||" Successful "
SAY TEST.1 /* Output: Test
"EXECIO 1 DISKW MEMSTAT (STEM TEST. FINIS"
-----------------------

MEMSTAT has a single record with value "Test". I want to add string "Successful" to the existing record and update the same file, so the result should be "Test Successful". But the above code is not giving the expected result. It only prints "Test".

However, the below test is working fine, i.e., adding a string to the front of LINE.1
but my requirement need the above result.

REXX Code:------------
"EXECIO 1 DISKRU MEMSTAT 1(STEM LINE."
SAY LINE.1 /* Output: Test
TEST.1 = " Successful "||LINE.1
SAY TEST.1 /* Output: Successful Test
"EXECIO 1 DISKW MEMSTAT (STEM TEST. FINIS"
--------------------------

Could you please help me with that?
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


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

PostPosted: Fri Mar 19, 2010 4:42 pm    Post subject:
Reply with quote

Quote:
I am trying to update (concatenate a string and a compound variable) a row in a file.
Terminology note: files do not have rows. Databases have rows. Files have records. Hence, by definition, what you are wanting to do cannot be done since there are no rows in files.

There are many terms in IT that are very precisely defined, mistaking rows for records as you have done indicates at best a degree of carelessness in your approach, at worst that you have no idea what you are doing.
Back to top
View user's profile Send private message
EternalQuest

New User


Joined: 24 Dec 2009
Posts: 4
Location: Chennai

PostPosted: Fri Mar 19, 2010 4:48 pm    Post subject: Reply to: To Concatenate string and compound variable.
Reply with quote

Sorry Robert,

The input file is a flat file. I mistakenly mentioned as row instead of record. Now I have corrected it.
Back to top
View user's profile Send private message
fayazbashask

New User


Joined: 28 Jun 2007
Posts: 9
Location: Hyderabad

PostPosted: Fri Mar 19, 2010 5:24 pm    Post subject: Reply to: To Concatenate string and compound variable.
Reply with quote

Hi, when you read the data from dataset, for example 80 bytes record, it will be stored in the stem variable. After that you are concatenating the value with Successful so the value becomes 80 chars and successful, lets say totally 90 characters. again you are updating the dataset record of 80 bytes, so it will take the first 80 bytes.

solution1:
read the record from the dataset in updatable mode.
STRIP the value in the stem variable and then append what you want to, then write it.
(just add value = strip(value,"b") before you append)

solution2:
read the record from the dataset in updatable mode.
Parse the value from the stem variable and then position the value what you want to, then write it.
Back to top
View user's profile Send private message
EternalQuest

New User


Joined: 24 Dec 2009
Posts: 4
Location: Chennai

PostPosted: Fri Mar 19, 2010 5:33 pm    Post subject: Reply to: To Concatenate string and compound variable.
Reply with quote

@ fayazbashask

Awesome dude. I got it!!!
I used the 1st option, thanks for your timely help.
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am
No new posts line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
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

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