Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

can we replace a value with spaces in REXX

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

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Mon Oct 15, 2007 10:39 am    Post subject: can we replace a value with spaces in REXX
Reply with quote

Hello ,

I have following requirement .

There is a file from where i wish to replace a copybook field with spaces .
Can we do it using REXX?

Can we use copybooks to read record in rexx . Actually the position of field is not sure

Regards
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Mon Oct 15, 2007 11:23 am    Post subject:
Reply with quote

The answer to both of the questions is yes.

O.
Back to top
View user's profile Send private message
shr_amar
Warnings : 2

Active User


Joined: 02 May 2005
Posts: 128
Location: UK

PostPosted: Mon Oct 15, 2007 12:38 pm    Post subject: Reply to: can we replace a value with spaces in REXX
Reply with quote

Can you tell me the process with example ?

Thanks in advance
Back to top
View user's profile Send private message
skrishnavijay

New User


Joined: 26 Sep 2007
Posts: 25
Location: chennai

PostPosted: Mon Oct 15, 2007 5:05 pm    Post subject:
Reply with quote

Hi,

If you have the copybook for the particular file(input of your interest), surely you will know the position of the field.

If it is...

say field address starts at 10th column and has 30 chars length.
file length 80

then...

1. Use execio to read the file into an array (eg. arr.)
2. do i=1 to arr.0
outarr.i = string(arr.i,1,9) || spaces(30) || string(arr.i,40,41)
end
Use execio to write the output array into output file

Hope this hepls.

Please correct me if I am wrong.

Krishna
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1232
Location: Israel

PostPosted: Mon Oct 15, 2007 6:31 pm    Post subject:
Reply with quote

Question 1: REXX has plenty of functions to do this. skrishnavijay gave one possibility, here is another one (using more or less same example):
Code:
outarr.i = overlay(copies(' ',8),arr.i,10)


Question 2: I'm not sure I understand "Can we use copybooks to read record in rexx". There are no copybooks in rexx, when you read a record, its contents is placed in a single variable. Then you can split the variable into any number of "fields".
Can you be more specific about this question ??
Back to top
View user's profile Send private message
akhi007

New User


Joined: 30 Jan 2006
Posts: 35
Location: Richmond

PostPosted: Thu Oct 18, 2007 2:56 pm    Post subject:
Reply with quote

Hi,

Copybook is a COBOL specific term. There is no concept of Copybooks in Rexx. You can achieve the same functionality through effective parsing.

Thanks,
Akhi
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 REXX to get the all datasets name parasmalik20 CLIST & REXX 5 Tue Jul 18, 2017 9:10 pm
No new posts How system know which REXX to excute? jackzhang75 CLIST & REXX 14 Thu Jul 06, 2017 1:09 am
No new posts REXX - Dynamic file Creation d_sarlie CLIST & REXX 7 Tue Jun 27, 2017 7:30 pm
No new posts REXX WTO for console message bipinpeter CLIST & REXX 6 Tue Jun 27, 2017 3:56 pm
No new posts Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us