Re: Sort job to get price variance records
On 5/08/2019 11:33 am, Paul Gilmartin wrote: +1 I'm probably partisan, but I'd look to Rexx or awk, both of which provide useful associative arrays. Personally on z/OS I would look to Java. I used to use Rexx a lot, but after getting used to Java and similar languages I find Rexx very limiting. I'm not convinced an awk solution would be easier to understand than Sort -- Andrew Rowley Black Hill Software -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Sort job to get price variance records
On Mon, 5 Aug 2019 10:55:00 +1000, Andrew Rowley wrote: >On 1/08/2019 8:03 am, Ron Thomas wrote: >> >> We have a FB File LRECL = 80 bytes and here below is the layout. Buy_price >> is at position 65 of length 10 bytes . We need to pull those item nbrs >> which has same UPC,Vendor nbr ,State Code but there is price difference. >> Could anyone let me know how this to be done using dfsort. > >I am curious, why do you want to use Sort to perform these tasks? > +1 I'm probably partisan, but I'd look to Rexx or awk, both of which provide useful associative arrays. >The solutions are ingenious, but I wonder whether someone will be able >to understand them if modification is required in the future. > >Maybe a more general programming language would be better? > Perhaps Sort is the language most generally understood among the readers of the list. Or the one that elicits the most useful answers. On Thu, 1 Aug 2019 09:21:22 -0400, Cameron Conacher wrote: >... >I have a file of data containing extracts from some JCL. >Specifically, I am looking for all values of DATACLAS. >This all relates back to Pervasive Encryption. I just want a quick report >of the DATACLAS values in use today, as well as the counts for each >DATACLAS item I find. > >I ran a quick compare to get a report from our JCL Library, and now I am >building a SORT to look at the variable length input file data. >... Again, I'd look first to Rexx PARSE or sed regular expressions. There's considerable animus to regex in this list, but its complexity pales compared to Sort. I see error sources regardless: o JCL comments might look like DD statements, causing false positives. o Instream data sets even more so. o JCL might be built with symbol substitution, causing false negatives. o Likewise arguments to PROCs. The Swiss Army Knife is a wondrous facility, but there is probably a better tool to drive in a nail. (OT: is DFSORT Turing-complete?) -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: dfsort: Sort job to get price variance records
On 1/08/2019 8:03 am, Ron Thomas wrote: Hi. We have a FB File LRECL = 80 bytes and here below is the layout. Buy_price is at position 65 of length 10 bytes . We need to pull those item nbrs which has same UPC,Vendor nbr ,State Code but there is price difference. Could anyone let me know how this to be done using dfsort. I am curious, why do you want to use Sort to perform these tasks? The solutions are ingenious, but I wonder whether someone will be able to understand them if modification is required in the future. Maybe a more general programming language would be better? -- Andrew Rowley Black Hill Software -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: dfsort: Sort job to get price variance records
On Fri, Aug 2, 2019 at 8:17 AM Joe Monk wrote: > Thats not what is being asked ... > > In the sample output... > > 50338 789997580026.00 36052910DF 96.12 > 50338 789997580026.00 36052910DF 96.12 > 50338 789997580026.00 36052910DF 95.12 > > What is different about the first two records that makes them worthy to be > included in the output? > My mistake. I don't know the answer to that question. I guess we'll need to wait for the OP and hope he will enlighten us. > > Joe > -- A sine curve goes off to infinity, or at least the end of the blackboard. -- Prof. Steiner Maranatha! <>< John McKown -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: dfsort: Sort job to get price variance records
Thats not what is being asked ... In the sample output... 50338 789997580026.00 36052910DF 96.12 50338 789997580026.00 36052910DF 96.12 50338 789997580026.00 36052910DF 95.12 What is different about the first two records that makes them worthy to be included in the output? Joe On Thu, Aug 1, 2019 at 12:54 PM John McKown wrote: > On Thu, Aug 1, 2019 at 11:20 AM retired mainframer < > retired-mainfra...@q.com> > wrote: > > > Why are two records desired for 96.12 but only one for 95.12? > > > > Because there are two different "keys" for the 95.12 There is > > 50338 789997580026.00 36052910DF > > and > > 50318 789997580026.00 36052910DF > > In the second "key", the price in all three records is the same: 95.12. So > there is no variance in the price. There are just duplicate records. > > > > > > > > -Original Message- > > > From: IBM Mainframe Discussion List On > > > Behalf Of Ron Thomas > > > Sent: Thursday, August 01, 2019 8:03 AM > > > To: IBM-MAIN@LISTSERV.UA.EDU > > > Subject: Re: dfsort: Sort job to get price variance records > > > > > > Ok Elardus. > > > > > > I will paste the requirement and output files generated again > > > > > > We have a FB File LRECL = 80 bytes and here below is the layout. > > Buy_price is at > > > position 65 of length 10 bytes . We need to pull those item nbrs > > > which has same UPC,Vendor nbr ,State Code but there is price > difference. > > Could > > > anyone let me know how this to be done using dfsort. > > > > > > Input file :- > > > > > > ITEM NUMBER UPC_NBR VendorNbr STATE_CODE > > > BUY_PRICE > > > 50338 789997580026.00 36052910DF 96.12 > > > 50338 789997580026.00 36052910DF 96.12 > > > 50338 789997580026.00 36052910DF 95.12 > > > 50318 789997580026.00 36052910DF 95.12 > > > 50318 789997580026.00 36052911DF 95.12 > > > 50318 789997580026.00 36052911DF 95.12 > > > > > > Desired o/p > > > > > > 50338 789997580026.00 36052910DF 96.12 > > > 50338 789997580026.00 36052910DF 96.12 > > > 50338 789997580026.00 36052910DF 95.12 > > > > -- > > For IBM-MAIN subscribe / signoff / archive access instructions, > > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > > > > > -- > A sine curve goes off to infinity, or at least the end of the blackboard. > -- Prof. Steiner > > 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
Re: dfsort: Sort job to get price variance records
On Thu, Aug 1, 2019 at 11:20 AM retired mainframer wrote: > Why are two records desired for 96.12 but only one for 95.12? > Because there are two different "keys" for the 95.12 There is 50338 789997580026.00 36052910DF and 50318 789997580026.00 36052910DF In the second "key", the price in all three records is the same: 95.12. So there is no variance in the price. There are just duplicate records. > > > -Original Message- > > From: IBM Mainframe Discussion List On > > Behalf Of Ron Thomas > > Sent: Thursday, August 01, 2019 8:03 AM > > To: IBM-MAIN@LISTSERV.UA.EDU > > Subject: Re: dfsort: Sort job to get price variance records > > > > Ok Elardus. > > > > I will paste the requirement and output files generated again > > > > We have a FB File LRECL = 80 bytes and here below is the layout. > Buy_price is at > > position 65 of length 10 bytes . We need to pull those item nbrs > > which has same UPC,Vendor nbr ,State Code but there is price difference. > Could > > anyone let me know how this to be done using dfsort. > > > > Input file :- > > > > ITEM NUMBER UPC_NBR VendorNbr STATE_CODE > > BUY_PRICE > > 50338 789997580026.00 36052910DF 96.12 > > 50338 789997580026.00 36052910DF 96.12 > > 50338 789997580026.00 36052910DF 95.12 > > 50318 789997580026.00 36052910DF 95.12 > > 50318 789997580026.00 36052911DF 95.12 > > 50318 789997580026.00 36052911DF 95.12 > > > > Desired o/p > > > > 50338 789997580026.00 36052910DF 96.12 > > 50338 789997580026.00 36052910DF 96.12 > > 50338 789997580026.00 36052910DF 95.12 > > -- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > -- A sine curve goes off to infinity, or at least the end of the blackboard. -- Prof. Steiner Maranatha! <>< John McKown -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: dfsort: Sort job to get price variance records
Why are two records desired for 96.12 but only one for 95.12? > -Original Message- > From: IBM Mainframe Discussion List On > Behalf Of Ron Thomas > Sent: Thursday, August 01, 2019 8:03 AM > To: IBM-MAIN@LISTSERV.UA.EDU > Subject: Re: dfsort: Sort job to get price variance records > > Ok Elardus. > > I will paste the requirement and output files generated again > > We have a FB File LRECL = 80 bytes and here below is the layout. Buy_price is > at > position 65 of length 10 bytes . We need to pull those item nbrs > which has same UPC,Vendor nbr ,State Code but there is price difference. Could > anyone let me know how this to be done using dfsort. > > Input file :- > > ITEM NUMBER UPC_NBR VendorNbr STATE_CODE > BUY_PRICE > 50338 789997580026.00 36052910DF 96.12 > 50338 789997580026.00 36052910DF 96.12 > 50338 789997580026.00 36052910DF 95.12 > 50318 789997580026.00 36052910DF 95.12 > 50318 789997580026.00 36052911DF 95.12 > 50318 789997580026.00 36052911DF 95.12 > > Desired o/p > > 50338 789997580026.00 36052910DF 96.12 > 50338 789997580026.00 36052910DF 96.12 > 50338 789997580026.00 36052910DF 95.12 -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Sort job to get price variance records
Thanks a lot Kolusu.. You are amazing to say the least !!! -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Sort job to get price variance records
>>I am getting the o/p as expected , but not sure whether what i have done is completely correct . Could you please check and let me know if the above needs correction ? Ron, You are NOT getting the o/p as expected. You shouldn't be writing the 50318 789997580026.00 36052911 DF record as it does NOT have any record with a price difference. You simply did not follow the directions that I gave. STEP 1 should be writing 2 files, but you only wrote 1 file and you added your own logic of counts. Not sure as to why you need the counts. Your Price starts at 65 and not 64. I accidentally mentioned 64 and you the owner of the data should be able to correct it to the right positions. Since you had at least put in a effort and tried to code the job based on the directions, I will show you the optimized control cards. (please don't expect it all the time) //STEP0100 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD * 50338 789997580026.00 36052910 DF 96.12 50338 789997580026.00 36052910 DF 96.12 50338 789997580026.00 36052910 DF 95.12 50318 789997580026.00 36052910 DF 95.12 50318 789997580026.00 36052911 DF 95.12 50318 789997580026.00 36052911 DF 95.12 //ORIG DD DSN=&,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE) //PULL DD DSN=&,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE) //SYSINDD * SORT FIELDS=(1,37,CH,A) OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'0')), IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,37),PUSH=(81:65,10)), IFTHEN=(WHEN=(65,10,CH,NE,81,10,CH),OVERLAY=(92:C'P')) OUTFIL FNAMES=ORIG,BUILD=(1,80) OUTFIL FNAMES=PULL,BUILD=(80X), REMOVECC,NODETAIL, INCLUDE=(92,1,CH,EQ,C'P'), SECTIONS=(1,37,TRAILER3=(1,37)) /* //STEP0200 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //INA DD DSN=&,DISP=(OLD,DELETE) //INB DD DSN=&,DISP=(OLD,DELETE) //SORTOUT DD SYSOUT=* //SYSINDD * OPTION COPY JOINKEYS F1=INA,FIELDS=(1,37,A),SORTED,NOSEQCK JOINKEYS F2=INB,FIELDS=(1,37,A),SORTED,NOSEQCK REFORMAT FIELDS=(F1:1,80) /* The output from this job is 50338 789997580026.00 36052910 DF 96.12 50338 789997580026.00 36052910 DF 96.12 50338 789997580026.00 36052910 DF 95.12 Thanks, Kolusu DFSORT Development IBM Corporation -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: dfsort: Sort job to get price variance records
Ok Elardus. I will paste the requirement and output files generated again We have a FB File LRECL = 80 bytes and here below is the layout. Buy_price is at position 65 of length 10 bytes . We need to pull those item nbrs which has same UPC,Vendor nbr ,State Code but there is price difference. Could anyone let me know how this to be done using dfsort. Input file :- ITEM NUMBER UPC_NBR VendorNbr STATE_CODE BUY_PRICE 50338 789997580026.00 36052910DF 96.12 50338 789997580026.00 36052910DF 96.12 50338 789997580026.00 36052910DF 95.12 50318 789997580026.00 36052910DF 95.12 50318 789997580026.00 36052911DF 95.12 50318 789997580026.00 36052911DF 95.12 Desired o/p 50338 789997580026.00 36052910DF 96.12 50338 789997580026.00 36052910DF 96.12 50338 789997580026.00 36052910DF 95.12 Code created: - //STEP03 EXEC SORT //SORTIN DD * 50338 789997580026.00 36052910 DF 96.12 50338 789997580026.00 36052910 DF 96.12 50338 789997580026.00 36052910 DF 95.12 50318 789997580026.00 36052910 DF 95.12 50318 789997580026.00 36052911 DF 95.12 50318 789997580026.00 36052911 DF 95.12 //SORTOUT DD DSN=T01.RXVD.PULL, //SPACE=(CYL,(50,50),RLSE),VOL=(,,,99), //DISP=(NEW,CATLG,DELETE) //SYSINDD * SORT FIELDS=(1,37,CH,A) OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,37),PUSH=(81:65,10)), IFTHEN=(WHEN=(64,10,CH,NE,81,10,CH),OVERLAY=(92:C'P')) OUTFIL FNAMES=SORTOUT,REMOVECC,NODETAIL, INCLUDE=(92,1,CH,EQ,C'P'), SECTIONS=(1,64,TRAILER3=(1,64,COUNT=(EDIT=())),65,10) /* output file Generated - 50318 789997580026.00 36052910 DF 1 50318 789997580026.00 36052911 DF 2 50338 789997580026.00 36052910 DF 3 I am not sure whether this o/p is correct . Also for the Joinkeys . This below is what i have coded //STEP01 EXEC SORT //SYSOUT DD SYSOUT=* // DD SYSOUT=* //BOTH DD DD SYSOUT=* //SORTJNF1 DD * 50338 789997580026.00 36052910 DF 96.12 50338 789997580026.00 36052910 DF 96.12 50338 789997580026.00 36052910 DF 95.12 50318 789997580026.00 36052910 DF 95.12 50318 789997580026.00 36052911 DF 95.12 50318 789997580026.00 36052911 DF 95.12 //SORTJNF2 DD DSN=T01.RXVD.PULL,DISP=SHR--> O/p from the above step //SYSINDD * JOINKEYS FILES=F1,FIELDS=(1,37,A),SORTED,NOSEQCK JOINKEYS FILES=F2,FIELDS=(1,37,A),SORTED,NOSEQCK REFORMAT FIELDS=(F1:01,80,F2:01,92,?) OPTION COPY JOIN UNPAIRED,F1,F2 OUTFIL FNAMES=BOTH, INCLUDE=(173,1,CH,EQ,C'B'),BUILD=(1,80) /* output file generated 50338 789997580026.00 36052910 DF 96.12 50338 789997580026.00 36052910 DF 96.12 50338 789997580026.00 36052910 DF 95.12 The above o/p generated based on the sample file is correct, but I am not sure whether the summarization done in the first step is correct. Regards Ron T -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: Sort job to get price variance records
Ok Kolusu, will remove dfsort tag from subject line . Thanks again for providing the steps. Here is what i have done //STEP03 EXEC SORT //SORTIN DD * 50338 789997580026.00 36052910 DF 96.12 50338 789997580026.00 36052910 DF 96.12 50338 789997580026.00 36052910 DF 95.12 50318 789997580026.00 36052910 DF 95.12 50318 789997580026.00 36052911 DF 95.12 50318 789997580026.00 36052911 DF 95.12 //SORTOUT DD DSN=T01.RXVD.PULL, //SPACE=(CYL,(50,50),RLSE),VOL=(,,,99), //DISP=(NEW,CATLG,DELETE) //SYSINDD * SORT FIELDS=(1,37,CH,A) OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,37),PUSH=(81:65,10)), IFTHEN=(WHEN=(64,10,CH,NE,81,10,CH),OVERLAY=(92:C'P')) OUTFIL FNAMES=SORTOUT,REMOVECC,NODETAIL, INCLUDE=(92,1,CH,EQ,C'P'), SECTIONS=(1,64,TRAILER3=(1,64,COUNT=(EDIT=())),65,10) /* O/p Generated 50318 789997580026.00 36052910 DF 1 50318 789997580026.00 36052911 DF 2 50338 789997580026.00 36052910 DF 3 I am not sure whether this o/p is correct . Also for the Joinkeys . This below is what i have coded JOINKEYS FILES=F1,FIELDS=(1,37,A),SORTED,NOSEQCK JOINKEYS FILES=F2,FIELDS=(1,37,A),SORTED,NOSEQCK REFORMAT FIELDS=(F1:01,80,F2:01,92,?) OPTION COPY JOIN UNPAIRED,F1,F2 OUTFIL FNAMES=BOTH, INCLUDE=(173,1,CH,EQ,C'B'),BUILD=(1,80) I am getting the o/p as expected , but not sure whether what i have done is completely correct . Could you please check and let me know if the above needs correction ? Regards Ron T -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: dfsort: Sort job to get price variance records
Sri h Kolusu wrote: >Ron, >All of your previous queries showed that you are using the competitive product >to DFSORT. If that is still true, I would really appreciate if you can stop >tagging the questions as DFSORT questions. Good point. I remember your post in Feb 2016: "OP's Shop uses Competitive product of DFSORT and so your suggestions about using DFSORT symbols which may or may not be supported and we don't want another discussion about using them incorrectly." To Ron, please say "SynSort" or whatever the product name, then the right people on IBM-MAIN may pick up your post and assist you. Just the word 'dfsort' will cause them NOT to assist you at all. >Giving you the benefit of doubt, I am going to list the procedure(not code the >entire JCL for you) to get the desired results. Ron, did you attempted to produce the output? If so, please post the FULL job (program name and DD as well as input statements) and all error messages you got. In this way, the right people associated with your product can pickup your post and try to assist you. Groete / Greetings Elardus Engelbrecht -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: dfsort: Sort job to get price variance records
>>Could anyone let me know how this to be done using dfsort. Ron, All of your previous queries showed that you are using the competitive product to DFSORT. If that is still true, I would really appreciate if you can stop tagging the questions as DFSORT questions. Giving you the benefit of doubt, I am going to list the procedure(not code the entire JCL for you) to get the desired results. Step:1 1. SORT the file on ALL the fields (ITEM NUMBER,UPC_NBR,VendorNbr,STATE_CODE,BUY_PRICE) 2. Using OUTREC WHEN=GROUP with KEYBEGIN on (ITEM NUMBER,UPC_NBR,VendorNbr,STATE_CODE), you would PUSH the Buy_price on to position 81. 3. Using another IFTHEN WHEN (64,10,CH,NE,81,10,CH) OVERLAY a value of 'P' at position 92 4. Using OUTFIL FNAMES you write 2 files. a. ORIG as is so that it will have all the records but in SORTED order. b. PULL will only have records which have P at position 92. Using sections(1,64) and Trailer3 you will write 1 record per key. Step 2: 1. Compare the files ORIG and PULL using JOINKEYS on (ITEM NUMBER,UPC_NBR,VendorNbr,STATE_CODE,BUY_PRICE) and write out the matching records 2. Since the files are already SORTED on the keys to compare, code SORTED,NOSEQCK on the JOINKEY statements, so that a COPY operation is used. This should give you the desired results that you are looking for. Thanks, Kolusu DFSORT Development IBM Corporation -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
dfsort: Sort job to get price variance records
Hi. We have a FB File LRECL = 80 bytes and here below is the layout. Buy_price is at position 65 of length 10 bytes . We need to pull those item nbrs which has same UPC,Vendor nbr ,State Code but there is price difference. Could anyone let me know how this to be done using dfsort. Input file :- ITEM NUMBER UPC_NBR VendorNbr STATE_CODE BUY_PRICE 50338 789997580026.00 36052910DF 96.12 50338 789997580026.00 36052910DF 96.12 50338 789997580026.00 36052910DF 95.12 50318 789997580026.00 36052910DF 95.12 50318 789997580026.00 36052911DF 95.12 50318 789997580026.00 36052911DF 95.12 Desired o/p 50338 789997580026.00 36052910DF 96.12 50338 789997580026.00 36052910DF 96.12 50338 789997580026.00 36052910DF 95.12 Thanks Ron T -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN