View previous topic :: View next topic
|
Author |
Message |
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Rexx Gurus,
As per my requirement i would get the column no and the data as inputs and i should update the record with the data in that particular column.
say for example the input data that i get is
column - 15
data - Aaru
then i should update all the records with "Aaru" starting from column no 15. Is there any function in REXX to do this? |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
POS ought to work. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
I think there is a possibility that data in other columns will make POS difficult to use.
For example, say the search was for aaru in column 15 and data was:
Code: |
----+----1----+----2---
aaru aaru aaru |
if POS('aaru', whole_line) = 15 ...
would give false results.
perhaps:
Code: |
column =15
serch = 'aaru'
If substr(whole_line, column, length(serch) = serch then... |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I may misunderstand the requirement, but my understanding is that the user will provide a starting position and a "fill" value. The code should fill all of the records with specified value at the starting position. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Kevin,
Quote: |
POS ought to work. |
I have used POS before, and to my knowledge it can be used for finding the starting position of the string.
dick,
Quote: |
I may misunderstand the requirement, but my understanding is that the user will provide a starting position and a "fill" value. The code should fill all of the records with specified value at the starting position. |
Exactly. You are correct and that is what my requirement is. |
|
Back to top |
|
|
charanmsrit
New User
Joined: 25 Oct 2007 Posts: 81 Location: Australia
|
|
|
|
Hi,
even i have got an almost similar requirement. i have to update accounting information on job card for all the 3000 jcl's in each test region of total 20 test regions to the below shown format. each jcl have different accounting information with different length. well, i know i can capture both open and closing brackets column position. is there a way to use these column positions and update the accounting information to below format ?? Please advise
JOB (1111,XXXX,XXXXXXXX),
Thanks, |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
charan,
First of all your requirement is different from mine and it is doable.
Quote: |
know i can capture both open and closing brackets column position. is there a way to use these column positions and update the accounting information to below format |
Use POS u can get the column no/position where the accounting info starts[by checking for "("] and based on that u can edit the data. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
here is a snippet that will parse a job card for accounting data
get rid of the old account info,
rebuild the same card with the new account info
Code: |
jobcard = " //jobname JOB (sccnt,wwww,qqq),class=a, "
jobcard = " //jobname JOB acct,class=b, "
jobcard = " //jobname JOB (sccnt,wwww,qqq),class=a, "
jobcard = strip(jobcard)
p = pos("JOB",jobcard)
jhead = strip(substr(jobcard,1,p-1))
if p = 0 then do
say "not a JOB stmt :" jobcard
exit
end
data = strip(substr(jobcard,p+4))
say "data " data
if substr(data,1,1) = "(" then do
p = Pos(")",data)
acctinfo = substr(data,2, p-2)
jtail = substr(data,p+1)
end
else do
p = pos(",",data)
acctinfo = substr(data,1,p-1)
jtail = substr(data,p)
end
say "jhead " jhead
say "jtail " jtail
say "acctinfo" acctinfo
parse var acctinfo acct1 "," acct2 "," acct3 "," acct4 "," .
say "acct1 " acct1
say "acct2 " acct2
say "acct3 " acct3
say "acct4 " acct4
newacct= "(new,acct.info)"
jobcnew = jhead || " JOB " || newacct || jtail
say "jobcnew " jobcnew
|
|
|
Back to top |
|
|
Ganesh.Deokar
New User
Joined: 30 Sep 2005 Posts: 26 Location: Buffalo,NY
|
|
|
|
Did you try OVERLAY function.
e.g.
OVERLAY(' ','abcdef',3) -> 'ab def'
OVERLAY('.','abcdef',3,2) -> 'ab. ef'
OVERLAY('qq','abcd') -> 'qqcd'
OVERLAY('qq','abcd',4) -> 'abcqq'
OVERLAY('123','abc',5,6,'+') -> 'abc+123+++'
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/IKJ4A350/4.3.43?DT=20040623084642
Regards,
Ganesh |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
regarding Aaru's original requirement:
> i should update all the records with "Aaru" starting from column no 15
A. I understood it to describe a filter:
i should update all the records THAT HAVE "Aaru" starting from column no 15
B. whereas, Dick understood it to mean:
i should update all the records AND REPLACE ANY TEXT IN COLUMN 15 WITH "Aaru"
If it really is B, then I do not understand how POS can help. |
|
Back to top |
|
|
charanmsrit
New User
Joined: 25 Oct 2007 Posts: 81 Location: Australia
|
|
|
|
Thanks a ton enrico. It's really amazing |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
pedro,
Quote: |
If it really is B, then I do not understand how POS can help. |
You are correct and POS cannot be used for the same. This has already been said in the previous post. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Ganesh,
Quote: |
Did you try OVERLAY function.
|
I shall try and let u know if it is working. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
What about an ISPF edit macro
C 'abc' '999' 15 |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
expat,
Quote: |
What about an ISPF edit macro |
Basically my requirement is to get few column no's/data from the user and update that particular column in a PS/VSAM files with the data.
first i want it to implement for PS/alphanumeric/numeric fields and then extend it to VSAM/COMP/COMP-3 fields and all
i have not written any macro's and have to dig a bit to see if i can use it. I shall give it a try.
Thanks for your valuable suggestions. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
> first ... PS/alphanumeric/numeric fields and then extend it to VSAM/COMP/COMP-3...
I doubt that you will be able to use similar methods to update both PS and VSAM files. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Pedro,
Quote: |
I doubt that you will be able to use similar methods to update both PS and VSAM files. |
Hmm even i doubt. My first task is to make it work for a normal sequential dataset and then should try for VSAM. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Quote: |
Did you try OVERLAY function. |
Yep, tried and it worked. Thanks for letting me know this. |
|
Back to top |
|
|
|