View previous topic :: View next topic
|
Author |
Message |
shr_amar Warnings : 2 Active User
Joined: 02 May 2005 Posts: 128 Location: UK
|
|
|
|
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 |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
The answer to both of the questions is yes.
O. |
|
Back to top |
|
|
shr_amar Warnings : 2 Active User
Joined: 02 May 2005 Posts: 128 Location: UK
|
|
|
|
Can you tell me the process with example ?
Thanks in advance |
|
Back to top |
|
|
skrishnavijay
New User
Joined: 26 Sep 2007 Posts: 25 Location: chennai
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
akhi007
New User
Joined: 30 Jan 2006 Posts: 35 Location: Richmond
|
|
|
|
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 |
|
|
|