IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

To Concatenate string and compound variable.


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Mar 19, 2010 4:42 pm
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Variable Output file name DFSORT/ICETOOL 8
Search our Forums:

Back to Top