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

can we replace a value with spaces in REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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: 2358
Location: Israel

PostPosted: Mon Oct 15, 2007 11:23 am
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
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
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: 1353
Location: Israel

PostPosted: Mon Oct 15, 2007 6:31 pm
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
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 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 Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top