View previous topic :: View next topic
|
Author |
Message |
murali.andaluri
New User
Joined: 07 Jun 2013 Posts: 23 Location: USA
|
|
|
|
Hi,
I am new to REXX and started writing small programs to automate few things.
I am writing a program to read SSO to find out execution time of each job.
I achieved logic by using Parse, but challenge i am facing is listing data set names. My job names starts with IS*, IF*, IB*. I cant give I* because there are huge number of jobs with it.
below is my code:
DATFILE='SSO.D*.T*' || JDATE || '.' || 'IS*'
DSVAR = ''
"ISPEXEC LMDINIT LISTID(IDV) LEVEL("DATFILE")
DO FOREVER
"ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"
If i use above code it is listing only jobs with IS*, but i need IF* and IB* as well, can someone help me how to achieve this?
Note: i can not use I* since there is huge list of jobs. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
What I would do is put your code in an internal subroutine.
I would have the last node be a variable.
I would call this subroutine from an earlier loop.
Example.
Note 1: This is completely untested, but a good start
Note 2: This is just one approach, go ahead guys and beat me up.
Code: |
LAST_NODES. = ''
LAST_NODES.1 = 'IS'
LAST_NODES.2 = 'IF'
LAST_NODES.3 = 'IB'
X = 1
DO UNTIL LAST_NODES.X = ''
CALL LIST_DATASETS
X = X + 1
END
EXIT
/* SUBROUTINE */
LIST_DATASETS: NOP
LASTNODE = LAST_NODES.X
DATFILE='SSO.D*.T*' || JDATE || '.' ||LASTNODE||'*'
DSVAR = ''
"ISPEXEC LMDINIT LISTID(IDV) LEVEL("DATFILE")
DO FOREVER
"ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"
.... MORE CODE.....
RETURN |
|
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
You are missing
which then allows
Code: |
Do x= 1 to last_nodes.0 |
instead of the DO UNTIL and later you do not need LASTNODE=LAST_node.x
but have
Code: |
DATFILE='SSO.D*.T*' || JDATE || '.' ||LAST_NODE.x||'*' |
Just an alternative without changing too much. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
just a comment on terminology:
The subject of the post is about HLQ, but the example is about LLQ. The high level qualifier (HLQ) is the leftmost qualifier in the data set name. The low level qualifier (LLQ) is the rightmost qualifier. |
|
Back to top |
|
|
murali.andaluri
New User
Joined: 07 Jun 2013 Posts: 23 Location: USA
|
|
|
|
Your solution is working!!!
Thank you so much Nic. |
|
Back to top |
|
|
murali.andaluri
New User
Joined: 07 Jun 2013 Posts: 23 Location: USA
|
|
|
|
Sorry Pedro!!! Its typo error. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Nic Clouston wrote: |
You are missing
which then allows
Code: |
Do x= 1 to last_nodes.0 |
instead of the DO UNTIL and later you do not need LASTNODE=LAST_node.x
but have
Code: |
DATFILE='SSO.D*.T*' || JDATE || '.' ||LAST_NODE.x||'*' |
Just an alternative without changing too much. |
I've actually started using Dave's method, i.e.
Code: |
s. = -1
s.1 = whatever
s.2 = something
s.3 = this?
s.4 = that?
do i = 1 by 1 while s.i \= -1
...
end |
as it stops you forgetting to update s.0! |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Nic Clouston wrote: |
You are missing
which then allows
Code: |
Do x= 1 to last_nodes.0 |
instead of the DO UNTIL and later you do not need LASTNODE=LAST_node.x
but have
Code: |
DATFILE='SSO.D*.T*' || JDATE || '.' ||LAST_NODE.x||'*' |
Just an alternative without changing too much. |
I've actually started using Dave's method, i.e.
Code: |
s. = -1
s.1 = whatever
s.2 = something
s.3 = this?
s.4 = that?
do i = 1 by 1 while s.i \= -1
...
end |
as it stops you forgetting to update s.0! |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Nic,
I am NOT missing - last_nodes.0 = 3
I leave it off on purpose. My method allows adding more entries without having to set this value as well. I have been burned in the past.
I have used this method hundreds of times.
This is why I said this is just one method. |
|
Back to top |
|
|
Steve Coalbran
New User
Joined: 01 Feb 2007 Posts: 89 Location: Stockholm, Sweden
|
|
|
|
daveporcelan wrote: |
Nic,
I am NOT missing - last_nodes.0 = 3
I leave it off on purpose. My method allows adding more entries without having to set this value as well. I have been burned in the past.
|
I quite like it.
Alternative solution: Read the list of LLQ specifications?
Code: |
"EXECIO * DISKR SYSIN (STEM last_nodes. FINIS " |
and
Code: |
//SYSIN *
IS%A*
IF%B*X
IB%88*
/* |
By this means one can use full member patterns?
This also sets last_nodes.0? |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
my personal preference for small lists is using a string, like:
Code: |
list='item1 item2 item3'
do listn=1 to words(list)
call sub(word(list,listn))
end |
|
|
Back to top |
|
|
|