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

How to list data set names with different HLQ?


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
murali.andaluri

New User


Joined: 07 Jun 2013
Posts: 16
Location: USA

PostPosted: Thu Apr 12, 2018 11:33 pm
Reply with quote

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
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 747
Location: Pennsylvania

PostPosted: Fri Apr 13, 2018 12:21 am
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2448
Location: Hampshire, UK

PostPosted: Fri Apr 13, 2018 1:24 am
Reply with quote

You are missing
Code:
last_nodes.0 = 3

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
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2214
Location: Silicon Valley

PostPosted: Fri Apr 13, 2018 5:41 am
Reply with quote

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
View user's profile Send private message
murali.andaluri

New User


Joined: 07 Jun 2013
Posts: 16
Location: USA

PostPosted: Fri Apr 13, 2018 3:38 pm
Reply with quote

Your solution is working!!!
Thank you so much Nic.
Back to top
View user's profile Send private message
murali.andaluri

New User


Joined: 07 Jun 2013
Posts: 16
Location: USA

PostPosted: Fri Apr 13, 2018 3:42 pm
Reply with quote

Sorry Pedro!!! Its typo error.
Back to top
View user's profile Send private message
prino
Warnings : 1

Senior Member


Joined: 07 Feb 2009
Posts: 1238
Location: Vilnius, Lithuania

PostPosted: Fri Apr 13, 2018 3:57 pm
Reply with quote

Nic Clouston wrote:
You are missing
Code:
last_nodes.0 = 3

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
View user's profile Send private message
prino
Warnings : 1

Senior Member


Joined: 07 Feb 2009
Posts: 1238
Location: Vilnius, Lithuania

PostPosted: Fri Apr 13, 2018 3:57 pm
Reply with quote

Nic Clouston wrote:
You are missing
Code:
last_nodes.0 = 3

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
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 747
Location: Pennsylvania

PostPosted: Fri Apr 13, 2018 4:42 pm
Reply with quote

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
View user's profile Send private message
Steve Coalbran

New User


Joined: 01 Feb 2007
Posts: 89
Location: Stockholm, Sweden

PostPosted: Sat Apr 28, 2018 7:45 pm
Reply with quote

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
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 416
Location: Denmark

PostPosted: Sun Apr 29, 2018 2:44 pm
Reply with quote

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
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 SKIP LOCKED DATA in UPDATE statement DB2 9
This topic is locked: you cannot edit posts or make replies. Copy list of files from PS to another... CLIST & REXX 11
No new posts How to find which file contains my se... DFSORT/ICETOOL 6
No new posts Changing Data Type SYNCSORT 4
No new posts Copying data from prev record using SORT SYNCSORT 19
Search our Forums:

Back to Top