Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Create PDS based on PS
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
knobi

New User


Joined: 16 Aug 2005
Posts: 46

PostPosted: Sat Jul 21, 2012 10:35 pm    Post subject: Create PDS based on PS
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: 1738
Location: Bloomington, IL

PostPosted: Sat Jul 21, 2012 10:46 pm    Post subject:
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: 46

PostPosted: Sat Jul 21, 2012 10:50 pm    Post subject:
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    Post subject:
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: 46

PostPosted: Sun Jul 22, 2012 12:20 am    Post subject:
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: 46

PostPosted: Sun Jul 22, 2012 12:28 am    Post subject:
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

Senior Member


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

PostPosted: Sun Jul 22, 2012 1:04 am    Post subject:
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: 46

PostPosted: Sun Jul 22, 2012 2:53 am    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Sun Jul 22, 2012 6:21 am    Post subject: Reply to: create pds based on ps
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: 1713
Location: UK

PostPosted: Sun Jul 22, 2012 11:37 am    Post subject:
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    Post subject:
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    Post subject:
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: 1713
Location: UK

PostPosted: Sun Jul 22, 2012 11:49 pm    Post subject:
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    Post subject:
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: 1713
Location: UK

PostPosted: Mon Jul 23, 2012 1:30 am    Post subject:
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    Post subject:
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: 1713
Location: UK

PostPosted: Mon Jul 23, 2012 7:27 am    Post subject:
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    Post subject:
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    Post subject:
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: 1713
Location: UK

PostPosted: Mon Jul 23, 2012 12:16 pm    Post subject:
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
This topic is locked: you cannot edit posts or make replies. Job to wait and continue based on reply yugendran COBOL Programming 5 Wed Oct 05, 2016 1:46 pm
No new posts how to split records based on specifi... Venkata Ramayya DFSORT/ICETOOL 6 Wed Sep 28, 2016 3:20 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us