For the REXX code, would the performance be improved if you wrote all the 
records to a file at one time, instead of a record at a time?  (use "QUEUE" in 
this case instead of "PUSH").

I used to do the same thing all in one REXX program, but I used IBM's software, 
"SmartBatch Works..." (or something like that) this software provided a TSO 
"PIPE" command which let me queue up all the records and after creating a 
specific separator line between each set of data, I could have it write all the 
members of the PDSe at one time.

Al Nims
Systems Admin/Programmer 3
Information Technology
University of Florida
(352) 273-1298

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of John McKown
Sent: Wednesday, August 20, 2014 10:58 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: DF/SORT question (challenge?)

On Wed, Aug 20, 2014 at 9:34 AM, TonyIcloud-OPERA <tonybabo...@icloud.com>
wrote:

> I have a dataset that contains records with a field, by which I need 
> to create a separate dataset that would contain all occurrences of that field.
> For example the file, FB100, looks like
>
> value1 other data.....
> value1 other data.....
> value1 other data.....
> value2 other data.....
> value2 other data.....
> value2 other data.....
> value3 other data.....
> value3 other data.....
> value3 other data.....
> value4 other data.....
> value4 other data.....
> value4 other data.....
>
> My final product must be a series of datasets:
>
> hlq.value1.records
> hlq.value2.records
> hlq.value3.records
> hlq.value4.records
>
> There may be hundreds/thousands of possible values, hence 
> hundreds/thousands of datasets.  I have accomplished this in 3 phases, 
> first pass reads the data, uses ICETOOL OCCUR to list the values, 
> second phase reads the OUTPUT and formats DD statements and OUTFIL 
> OUTREC statements, the third phase reads the original data to create 
> the numerous output files.  I used a newly created PDSE as the output 
> file whereupon the third phase created several thousand members.
>
> It works, after a fashion, but I'd like a more simple solution.
>
>
Well, assuming that performance is not an overriding concern, I would have two 
steps. The first would be a DFSORT which sorts the records in order by the 
field in question. The second step would be a REXX program which would look 
something like:

/* REXX */
VALUE='';
DO FOREVER
      "EXECIO DISKR 1 INPUT"
      IF RC <> 0 THEN LEAVE /* LEAVE IF EOF */
     PARSE PULL RECORD
     NVALUE=WORD(RECORD,1) /* EXTRACT VALUE */
     IF VALUE <> NVALUE THEN DO
         "EXECIO 0 DISKW OUTPUT (FINIS"
         ADDRESS TSO "FREE DDN(OUTPUT)"
         ADDRESS TSO "ALLOC DDN(OUTPUT) DSN(hlq."VALUE".records) ",
            "NEW CATALOG SPACE(a b) CYL RECFM(f) LRECL(lrecl) BLKSIZE(0)"
     END
     PUSH RECORD
     "EXECIO DISKW 1 OUTPUT"
END

Of course, you need to customize the ALLOC command. And in my JCL, I would have 
a //OUTPUT DD DUMMY

If you're really adventurous, I'll give you a UNIX solution. But most people 
don't really want that.
--
There is nothing more pleasant than traveling and meeting new people!
Genghis Khan

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to