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

Create PDS based on PS


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Jul 23, 2012 3:06 pm
Reply with quote

Anuj Dhawan wrote:
It'd be nice if you can post the solution (pseudo code) which worked for you, possibly might help someone later.
Will Jesus forgive me of my sins? See, what I've done! icon_biggrin.gif
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 23, 2012 3:36 pm
Reply with quote

dbzTHEdinosauer wrote:
other than very lite on rc checking,
i found the REXX Script rather well written.


Mmmmm....

Code:
/* start getting records   */
/* for 1st member          */


The records have already been "got". Presumably, unless we have been shown the code just for processing the first member, this is not for only the first member.

Code:
/* Get member name or repl */
/* by mem### generator     */


What's all the "repl" stuff? Don't seem to be no code for it.

Code:
/* find end tag, create the*/
/* member, clean variables */


Just says what the lines of code say, and won't be changed when the lines of code are changed.


I'm not going to go into it all again. It is probably a "one-off", so why bother? Well, "one-offs" have a habit of being copied for other "one-offs". So, knowing that I'm likely to copy it at some time, I try to do it like a "real" program.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 23, 2012 8:12 pm
Reply with quote

since everyone else is continually justifying their comments,
i will do the same:

the script at times has misleading or useless comments.

the script is very lite on rc checking and could lead to errors
i.e. directory or data full.

substr would have been better than index

k is incremented throughout the population of stem text.
and then reset to 1 after every new member is written.

are pds directorys maintained in sorted order. don't think so.
as a result, the sorted or unsorted member names has no effect.

the value of the 0th variable has no effect when DISKW * format is used.
when the 0th variable is used as the LINES parm
DISKW stem.0
it is treated just like any other variable.

again i say,
sort of the error checking and comments
the script was rather well written.
add appropriate comments and error checking
it would have been an excellent script.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 23, 2012 8:41 pm
Reply with quote

oh, something that is poor programming:
this:
Code:
      "execio * diskw out (stem text."
      "execio 0 diskr out (finis"

would have been better coded as:
Code:
"execio * diskw out (stem text. finis"
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jul 23, 2012 8:49 pm
Reply with quote

Hi Anuj,

Quote:
Will Jesus forgive me of my sins? See, what I've done!
I suspect He will, but there are others around here . . . . icon_cool.gif

d
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jul 23, 2012 10:16 pm
Reply with quote

dbzTHEdinosauer wrote:

are pds directorys maintained in sorted order. don't think so.
as a result, the sorted or unsorted member names has no effect.



I do :-)
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Mon Jul 23, 2012 10:23 pm
Reply with quote

OK - after a hard day's graft in the sunshine...I hope that this covers what Dick was wanting me to cover...
Code:
/*- Rexx -------------------------------------------------------------*
 |                                                                    |
 *------------------------------------------------------------- Rexx -*/
trace '?i'
mystem.0 = 6
mystem.1 = 'one'
mystem.2 = 'two'
mystem.3 = 'three'
mystem.4 = 'four'
mystem.5 = 'five'
mystem.6 = 'six'
drop mystem.3
mystem.5 = '00'b

'ALLOC FI(FMTLST) DS(SOURCE.FMT) SHR REUSE'
'EXECIO 'mystem.0' DISKW FMTLST (STEM mystem. FINIS)'
'FREE DD(FMTLST)'
Exit


And the output:
Code:
one
two
MYSTEM.3
four
..
six


Sorry about the .. but textpad would not allow me to cut text that contains a null value.

So, properly coded, stem.0 can be used to write non-existent - or previously dropped variables and variables with the 'null' value. If the manual says it cannot then the manual is WRONG.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 23, 2012 10:43 pm
Reply with quote

SIGH,
no, the manual says when you use the arbitrary number of lines format
DISKW *
the 0th variable has no effect.

the manual is correct,

dbz wrote but Nic refuses to read wrote:
populate the first 3 stem variables (1,2, and 3)
drop stem.4 or populate stem.4 with "" (zero length value)
populate stem.0 with 0,1,2 or 4 >4 (does not matter)
DISKW * (stem. finis
it will output 3 records.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Mon Jul 23, 2012 10:47 pm
Reply with quote

Nic Clouston wrote:
So, properly coded, stem.0 can be used to write non-existent - or previously dropped variables and variables with the 'null' value. If the manual says it cannot then the manual is WRONG.

No, what the manual says is:
Quote:
The 0th variable has no effect on controlling the number of lines written from variables.

Thus, if your example were modified to:
Code:
/*- Rexx -------------------------------------------------------------*
 |                                                                    |
 *------------------------------------------------------------- Rexx -*/
trace '?i'
mystem.0 = 6
mystem.1 = 'one'
mystem.2 = 'two'
mystem.3 = 'three'
mystem.4 = 'four'
mystem.5 = 'five'
mystem.6 = 'six'
drop mystem.3
mystem.5 = '00'b
foo = 5

'ALLOC FI(FMTLST) DS(SOURCE.FMT) SHR REUSE'
'EXECIO 'foo' DISKW FMTLST (STEM mystem. FINIS)'
'FREE DD(FMTLST)'
Exit

the EXECIO statement would only write five records, despite mystem.0 having the value 6. So Mr. Brenholz correctly states that
Quote:
the value of the 0th variable has no effect when DISKW * format is used.
when the 0th variable is used as the LINES parm
DISKW stem.0
it is treated just like any other variable.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jul 23, 2012 11:10 pm
Reply with quote

The directory entries in a PDS are stored in the alphabetical order of member names. So if a new entry is to be created, all the entries coming after it need to be shifted to make room for it.

I stand corrected..
Bill,
your thinking was correct;
mine was not.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Tue Jul 24, 2012 12:10 am
Reply with quote

Akatsukami: What has 'foo' got to do with it? We are discussing stem.0 in the 'number of lines to write' position as opposed to using *. You could make foo = 6 and you will get the same result as stem.0 = 6. You could set stem.0 = 5 and you will get the same result as foo = 5.

Dick: are you thinking that I am referring to stem.0 within the brackets? Why should I? I am referring to the number of lines to write and that is the first parameter after EXECIO - as my code clearly shows - not the stem parameter within the brackets/parentheses.

As the manual says (paraphrased) if you give '*' then EXECIO will write until it reckons it has found a stop writing condition. If you give a specific number of lines to write from a stated stem then it will write that number of lines even if it has to write the default values e.g. MYSTEM.99

Now, if you are all believing that I am talking about stem.0 within the brackets then this entire debate is based on false premises and should be deleted.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Jul 24, 2012 3:35 pm
Reply with quote

there is a lot of confusion/miswording around here .... icon_cool.gif

<stem>.0 has relevance ONLY for reading ( where it gets filled )

when writing

EXECIO *
EXECIO <somevar>

the fact that somevar is a stem element is completely irrelevant,
it is used as a simple/plain variable

it is nowhere implied that for a write the zeroth stem value will be used

cheers
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Tue Jul 24, 2012 9:42 pm
Reply with quote

Exactly, Enrico. And I really think that Dick and I are talking 2 different things - me about the explicit use of stem.0 in the lines to write position and Dick about the implicit use in the data to be written portion of the command where it is ignored as Dick says and the manual says. But, until Dick comes back, we cannot be 100% certain. If this is the case then most of the posts can be deleted as being irrelevant and possibly misleading. The debate probably would not have started if I had written along the lines of "do not use '*' as the number of lines to write but the stem.0 in the 'lines to write' position of the command.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 24, 2012 10:41 pm
Reply with quote

Nic wrote:
The debate probably would not have started if I had written along the lines of "do not use '*' as the number of lines to write but the stem.0 in the 'lines to write' position of the command.


we would have had a different debate,
but a debate, nevertheless.

but the point is taken and accepted.
the script in question in this thread could have been written:
"EXECIO " k "...."
thus saving the time to load text.0 with the value of k
which at the time of ALLOC/EXECIO was accurate.
which would have included any zero length records,
and not have terminated the DISKW.

I was under the mis-understanding that Nic did not know
that stem.0 has no effect on a DISKW
unless stem.0 is the variable used as the LINES parm.

I also do not feel there is any necessity to delete any posts.
I am willing to have any errors of my posts stand as
a good example of
a bad example.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Wed Jul 25, 2012 12:35 am
Reply with quote

And I, who have 48 years' experience, but nonetheless have never used REXX or dealt with these issues, and therefore have essentially no idea what you guys are talking about, have thoroughly enjoyed the discussion.

Quite civil, but then again no one here but us mice.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Wed Jul 25, 2012 12:10 pm
Reply with quote

You should have heard the words going on in my head - and I suspect it was the same with Dick. But publicly blowing a fuse does not help. Of course it did not help that we were arguing about different things and therefore not arguing at all. We were arguing our own corners but in different rings!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 25, 2012 7:40 pm
Reply with quote

this thread has attracted a lot of views
(a couple obviously attributable to Nic and me).
I wonder what is going around in the heads of those
who seeing a 4 page thread on creating pds from PS
and expect a novelette of '50 ways to leave your lover'.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Wed Jul 25, 2012 10:28 pm
Reply with quote

Excellent!

Actually, I am on an archaeological dig at the moment. Yesterday an elderly couple came to the side of the trench: She: what was you best find? He: Your wife! Me: No, that was my best loss! Laughs all round. (never married - yet)
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 -> JCL & VSAM Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts How to create a list of SAR jobs with... CA Products 3
No new posts To search DB2 table based on Conditio... DB2 1
This topic is locked: you cannot edit posts or make replies. Merge 2 input files based on the reco... JCL & VSAM 2
No new posts create rexx edit Macro that edits the... CLIST & REXX 3
No new posts Split large FB file based on Key coun... DFSORT/ICETOOL 4
Search our Forums:

Back to Top