Add text to each record using REXX.



IBM's Command List programming language & Restructured Extended Executor

Add text to each record using REXX.

Postby Viswanathchandru » Tue May 13, 2014 5:24 am

Dear all,

I have a requirement where I need to add a text to each record of a file. Given below is the input file.

RBE221VENUS TRANSACTION LISTING FOR DAY 121 OF YEAR 2014         
RBE1QC- TRANSACTION A2BA1     AT TERMINAL RBE0ZZ
RBE1QC- TRANSACTION VEHN      AT TERMINAL RBE0Z1
RBE1QC- TRANSACTION VEHX      AT TERMINAL DWT05P
RBE1QC- TRANSACTION MAIL      AT TERMINAL NAD068
RBE1QC- TRANSACTION INVN      AT TERMINAL ISM001
RBE221VENUS TRANSACTION LISTING FOR DAY 122 OF YEAR 2014         
RBE1QC- TRANSACTION A2BA1     AT TERMINAL RBE0ZZ
RBE1QC- TRANSACTION VEHN      AT TERMINAL RBE0Z1
RBE1QC- TRANSACTION VEHX      AT TERMINAL DWT05P
RBE1QC- TRANSACTION MAIL      AT TERMINAL NAD068
RBE1QC- TRANSACTION INVN      AT TERMINAL ISM001


So, here I have to add the date at the end of each record. For Eg: The output after processing should look like:
RBE1QC- TRANSACTION A2BA1     AT TERMINAL RBE0ZZ DAY 121 OF YEAR 2014
RBE1QC- TRANSACTION VEHN      AT TERMINAL RBE0Z1 DAY 121 OF YEAR 2014
RBE1QC- TRANSACTION VEHX      AT TERMINAL DWT05P DAY 121 OF YEAR 2014
RBE1QC- TRANSACTION MAIL      AT TERMINAL NAD068 DAY 121 OF YEAR 2014
RBE1QC- TRANSACTION INVN      AT TERMINAL ISM001 DAY 121 OF YEAR 2014
RBE1QC- TRANSACTION A2BA1     AT TERMINAL RBE0ZZ DAY 122 OF YEAR 2014
RBE1QC- TRANSACTION VEHN      AT TERMINAL RBE0Z1 DAY 122 OF YEAR 2014
RBE1QC- TRANSACTION VEHX      AT TERMINAL DWT05P DAY 122 OF YEAR 2014
RBE1QC- TRANSACTION MAIL      AT TERMINAL NAD068 DAY 122 OF YEAR 2014
RBE1QC- TRANSACTION INVN      AT TERMINAL ISM001 DAY 122 OF YEAR 2014



Can someone please assist me on how I can add the date at the end of each record. Any suggestions/help will be really helpful !


Thanks,
Viswa..
Viswanathchandru
 
Posts: 271
Joined: Mon Oct 25, 2010 2:24 pm
Has thanked: 25 times
Been thanked: 0 time

Re: Add text to each record using REXX.

Postby Blackthorn » Tue May 13, 2014 1:16 pm

What have you tried so far? It looks fairly straightforward.

Hint - have you read up on the DATE function in Rexx?
Blackthorn
 
Posts: 130
Joined: Tue Feb 01, 2011 7:12 pm
Has thanked: 1 time
Been thanked: 9 times

Re: Add text to each record using REXX.

Postby NicC » Tue May 13, 2014 1:37 pm

I would not bother with the date function. Simply read the dataset line by line. When the record type is RBE2221 save the portion that you want using SUBSTR. Do not write the record. Otherwise concatenate the saved string to each record before writing it.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic

These users thanked the author NicC for the post:
Viswanathchandru (Thu May 15, 2014 11:24 pm)
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Add text to each record using REXX.

Postby Blackthorn » Tue May 13, 2014 1:44 pm

Good point. I must look at things more closely. :)
Blackthorn
 
Posts: 130
Joined: Tue Feb 01, 2011 7:12 pm
Has thanked: 1 time
Been thanked: 9 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post