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
knobi

New User


Joined: 16 Aug 2005
Posts: 54

PostPosted: Sat Jul 21, 2012 10:35 pm
Reply with quote

hello!!

I have a requirement to build a pds file based on a ps (lrecl 400) file .
The input file has the <tags> indicating the begin and the end of each member.

what would be the best approach in this case to create the pds, 1) a rexx code, or 2) is there any other IBM z/os native utility?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


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

PostPosted: Sat Jul 21, 2012 10:46 pm
Reply with quote

  1. How many records does the PS data set contain?
  2. How many members will be created?
  3. What do the delimiters look like?
  4. What sort product does your shop have?
Back to top
View user's profile Send private message
knobi

New User


Joined: 16 Aug 2005
Posts: 54

PostPosted: Sat Jul 21, 2012 10:50 pm
Reply with quote

around 5000 records...
around 400 members should be created
delimiters are <start> <end>
only IBM z/OS native utilities
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Sun Jul 22, 2012 12:00 am
Reply with quote

is the (tobe pds) member name contained in any record?
if not, is there any naming scheme to be followed?
Back to top
View user's profile Send private message
knobi

New User


Joined: 16 Aug 2005
Posts: 54

PostPosted: Sun Jul 22, 2012 12:20 am
Reply with quote

no member name convention.
it could be mem000, mem001...
Back to top
View user's profile Send private message
knobi

New User


Joined: 16 Aug 2005
Posts: 54

PostPosted: Sun Jul 22, 2012 12:28 am
Reply with quote

guys, nevermind... i took the rexx approach and it worked fine, thought there was another way to do ...like the IEBUPDTE but unfortunatelly limited to 72 positions for input...
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Sun Jul 22, 2012 1:04 am
Reply with quote

It'd be nice if you can post the solution (pseudo code) which worked for you, possibly might help someone later.
Back to top
View user's profile Send private message
knobi

New User


Joined: 16 Aug 2005
Posts: 54

PostPosted: Sun Jul 22, 2012 2:53 am
Reply with quote

this is basically what was done.
probably there are a way to do it more efficiently
anyway, it did the job...
if anyone has any suggestion of change or any other way to do it, pls share..

Code:

- allocate and read input file
     
k=1
do i=1 to dat1.0
  text.k=dat1.i                          /* start getting records   */
  k = k + 1                              /* for 1st member          */

  if index(dat1.i,'4') = 1   then        /* Get member name or repl */
     do                                  /* by mem### generator     */
       memb=strip(substr(dat1.i,54,8))
     end

  if index(dat1.i,'<end>') = 1 then      /* find end tag, create the*/
    do                                   /* member, clean variables */
      "alloc da('pds_file("memb")') f(out) old reuse"
      "execio * diskw out (stem text."
      "execio 0 diskr out (finis"
      "free f(out)"
      memb=" "
      k=1
      drop text.
    end

end
exit 0
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: Sun Jul 22, 2012 6:21 am
Reply with quote

Why use k at all? i always has the same value when k is used.

What's with the index for '4'? Just an example, or your data can't otherwise contain '4' at that position? If the positions of 4/<end> are fixed, why not substr instead of index?

You use dat.i multiple times.

You don't validate memb.

You are "light" on error checking. If your PDS fills, are you going to notice?

Your comments are generally not correct or those that are say nothing.

You don't deal with either a missing start or end.

For your file size, "efficiency" probably doesn't matter (and how many times are you doing this?). Is the PS in member-name order?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Sun Jul 22, 2012 11:37 am
Reply with quote

Maintain text.0 then you can use that to control the DISKW instead of * which can terminate DISKW early if the data to be written contains an EOF marker.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Sun Jul 22, 2012 7:48 pm
Reply with quote

other than very lite on rc checking,
i found the REXX Script rather well written.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Sun Jul 22, 2012 10:39 pm
Reply with quote

what is an an EOF marker?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Sun Jul 22, 2012 11:49 pm
Reply with quote

Not correct terminology but something that makes EXECIO think it has no more data to read. I believe the manual mentions null as one of these things. It also mentions EOF.
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 12:21 am
Reply with quote

not to be tooooo picky,

but we were discussing writing with execio in this thread,
and i did not think EOF had a proper place when
discussing when execio reaches a point of nothing else to write.
yes, a NULL length stem variable is one
and, an uninitialized stem variable is another
(i.e. value of mystem.3 = 'MYSTEM.3')

actually, all i was getting at was for an EXECIO with an arbitrary number of writes - DISKW *
the value contained in the stem variable 0
(i.e. mystem.0)
has no effect.

and knobi used an uninitialized stem variable as the terminator
for his EXECIO DISKW * statement.

but in the event that one of the input records in knobi's file contained a 0-length record (or null),
then yes,
EXECIO DISKW k
would have been the better way to write the statement.

so, you are correct, i was wrong.
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 1:30 am
Reply with quote

I just hope that knobi is still following the thread and is learning. One thing you learn is that you never stop learning. Rights and Wrongs yes but even that manual link you PMed me, Dick, is confusing because it did mention stem.0 being ignored but I am not sure how they were proposing the usage of it. Like any command being sent to another address space, stuff not quoted gets substituted.
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 2:45 am
Reply with quote

the DISKW does not use the value of stem.0.
when the EXECIO is based on a stem variable DISKW terminates when either
  • a stem variable contains a zero length value - NULL
  • a stem variable is in initialized state - value of stem.x = 'STEM.X'.

DISKR populates stem.0 with the record count when a stem variable (as apposed to the stack) is used as the file record repository.

I admittedly thought that stem.0 have a purpose for DISKW for many years
(never bothered to read the detail in the documentation)
but a simple experiment would proved the point.

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.

Knobi drops the output stem (text.)after each DISKW,
thus all unpopulated stem variables for text. are in INITIAL state.
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 7:27 am
Reply with quote

From the manual TSO/E REXX Commands example 12

Code:
        "EXECIO" newvar.0 "DISKW MYOUTDD (STEM NEWVAR." /* Write
                               exactly the number of records read  */

I think what the manual means when it says EXECIO ignores stem.0 is that it ignore stem.0 as a value to be written.
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 7:57 am
Reply with quote

Sigh,
TSO REXX COMMANDS Operands for Writing to a Data Set: wrote:

When EXECIO writes an arbitrary number of lines from a list of compound variables, it stops when it reaches a null value or an uninitialized variable (one that displays its own name).

The 0th variable has no effect on controlling the number of lines written from variables.


In your example, newvar.0 (as you said) resolves to a specific number,
thus your example is not an arbitrary number of lines,
which is indicated as an asterisk (*)

and please try the experiment that I suggested a few posts ago.
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 9:47 am
Reply with quote

and yes you are correct.

regardless of the format of reading into (DISKR/DISKRU) or writing from (DISKW)
a stem
the 0th variable is not used for record storage or as a record source.
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 12:16 pm
Reply with quote

At 3am I was NOT going to experiment but, if I am still alive after today's (physical) exertions, I will try an experiment or two this evening. Suffice to say for the moment that this debate started because people, not only in this topic, have stated that STEM.0 cannot be used in place of * in DISKW. OF course it can if done right i.e. variable substitution is allowed before the command is passed to TSO. We are now exploring the limits. And I will continue this evening.
Back to top
View user's profile Send private 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
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