Re: DFSort to pull the latest record date
On Tue, 13 Oct 2020 16:19:39 -0300, Clark Morris wrote: >... >What field is 1,4,CH? Why should an applications programmer have to >know in 2020 that offset 5 in the COBOL data division map means 6 if >it is a fixed block file and 10 if it is a variable block file? > PL1 and COBOL both generate fairly efficient code and when >>> the tool becomes more than one off wonder, someone else can pick up >>> the program and have a fighting chance of understanding what was being >>> done. >> That hypothetical "someone else" would benefit if the operands were keyword rather than positional. Rather than "1,4,CH", "OFFSET=1,LENGTH=4,TYPE=CH". Counting the RDW is absurd. Offsets should always be relative to the start of the data. If it's necessary to cite the RDW (to sort or select by record length?) it should be "OFFSET=-3,LENGTH=4,TYPE=BINARY". How does this play with RECFM=VBS? With UNIX files, variable length but no RDW? -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: DFSort to pull the latest record date
>>What field is 1,4,CH? If you looked up the syntax of P, M, F then it is very easy to follow P = start position of the field M = Length of the field F = format/type field so 1,4,CH = position 1 for a length of 4 bytes and character format >>Why should an applications programmer have to know in 2020 that offset 5 in the COBOL data division map means 6 if it is a fixed block file and 10 if it is a variable block file? hmm even in 2020 aren't you specifying what type of file you are reading/writing in COBOL via File Section? You don't have to specify what type of file you are reading via DFSORT. As for offsets, COBOL calculates the offsets by copybook/mapping of the file. Similarly you can use DFSORT symbols to specify the layout of the file and you can refer the fields directly in the control cards. DFSORT even provides a smart trick to convert your COBOL copybooks into equivalent DFSORT symbols. Check out the "Create DFSORT Symbols from COBOL Copybook" trick at https://www.ibm.com/support/pages/smart-dfsort-tricks >> For output you would be right about the COBOL program not being able > to handle the change in record length but if RECORD 0 is coded on the > FD for a QSAM input fixed block file, so long as the first n bytes are > the bytes expected, the program will read whatever record length is in > the DSCB and ignore the excess over what is described. Aren't you still limited by 01 record description of the file? If 01 record description is defined as 80 bytes, and if you are reading the 200 byte file then you cannot technically look at the contents beyond 80 bytes. I guess the alternative is to specify the largest 01 Record description. And this still does not solve the problem with different RECFM's (Fixed definition and Variable input) And output file as you pointed is always a drawback. For DFSORT you don't even have to specify the DCB of the input or output file as it figures out automatically. >>Both the sort and the COBOL program would be invalidated if any of the displacements for fields that aree reference change. Not really. For COBOL, you have to recompile and link edit with the new changes. For DFSORT it is mere change of displacement and if you use symbols then there is absolutely no changes for DFSORT at all. Just change the symbol mapping and you are all set. > When I see coding in field displacement and length I am reminded of > why I was very happy the company I was working got DYL280 to replace > DYL260. I was a heavy user of DYL260 but the ability to use COBOL > record descriptions and DYL280 record descriptions was a game changer. Well you are comparing a programming language to an utility and this topic is NOT about which one is better. Both products have their advantages and disadvantages. I for one believe in using the right tool for the right job. In this particular scenario, DFSORT is definitely a better tool. > Just out of curiousity, assuming half track blocking, how much more efficient is the sort I-O than coding BUFNO=30? Depends on several factors. Blocksize and available memory. Why don't test out a cobol program to copy a 100 million record dataset and do the same using DFSORT and verify the results. You can try different LRECL and Blocksize combinations. 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 to pull the latest record date
[Default] On 25 Sep 2020 10:25:23 -0700, in bit.listserv.ibm-main skol...@us.ibm.com (Sri h Kolusu) wrote: >> Given the obscurity of the control statements (quick tell me what >> field is 1,4,CH) why not write the thing in a language > >Clark, > >I have to respectfully disagree with you. The control statements for DFSORT >are not obscure and they are on the same level as following the >coding/syntax rules for a programming language. For example COBOL, you >would follow all the rules governing it. So why not do the same for DFSORT? What field is 1,4,CH? Why should an applications programmer have to know in 2020 that offset 5 in the COBOL data division map means 6 if it is a fixed block file and 10 if it is a variable block file? > >>> PL1 and COBOL both generate fairly efficient code and when >> the tool becomes more than one off wonder, someone else can pick up >> the program and have a fighting chance of understanding what was being >> done. > >Aren't the programs depending on the input file attributes? For example a >COBOL program written to handle a FB 80 byte file will NOT work with FB 100 >byte file. You need to write another program to handle it. With DFSORT >there is absolutely no change in the control cards for different LRECL as >long as the key fields are the same. For output you would be right about the COBOL program not being able to handle the change in record length but if RECORD 0 is coded on the FD for a QSAM input fixed block file, so long as the first n bytes are the bytes expected, the program will read whatever record length is in the DSCB and ignore the excess over what is described. Both the sort and the COBOL program would be invalidated if any of the displacements for fields that aree reference change. > >DFSORT has come a long way from being just a sort product. It can do a lot. > When I see coding in field displacement and length I am reminded of why I was very happy the company I was working got DYL280 to replace DYL260. I was a heavy user of DYL260 but the ability to use COBOL record descriptions and DYL280 record descriptions was a game changer. Just out of curiousity, assuming half track blocking, how much more efficient is the sort I-O than coding BUFNO=30? Clark Morris >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 -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: DFSort to pull the latest record date
Just a wild guess? Sort it in reverse and take the first record as oldest date?? Chris Hoelscher Lead Sys DBA IBM Global Technical Services on assignmemt to Humana Inc. T 502.476.2538 or 502.407.7266 -Original Message- From: IBM Mainframe Discussion List On Behalf Of Lizette Koehler Sent: Friday, September 25, 2020 1:16 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: [IBM-MAIN] DFSort to pull the latest record date [External Email: Use caution with links and attachments] Why not load the data into a DB and use SQL or similar language? If you have SAS - Max Min - functions If you can load to EXCEL - use its functions Not all functions on the mainframe can do everything. You should look at what makes sense. And if the tool you are comfortable in using, does not have the function, I would say to find one that does. Hope that helps Lizette -Original Message- From: IBM Mainframe Discussion List On Behalf Of Ron Thomas Sent: Friday, September 25, 2020 9:55 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: DFSort to pull the latest record date Hello We are using DFSORT utility to extract the latest record for a store/item/po and below is the sample file item_nbr| Store_nbr|Po_nbr|item_date|mode| 00604|9137|1100276393|2017-12-26|7|DSD | 00604|9137|1100278550|2018-01-09|6|DSD | Here we need to pull the 2'nd record to the Output as this is the latest date . Could someone please let me know how to achieve the same Regards Ron T -- 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 The information transmitted is intended only for the person or entity to which it is addressed and may contain CONFIDENTIAL material. If you receive this material/information in error, please contact the sender and delete or destroy the material/information. Humana Inc. and its subsidiaries comply with applicable Federal civil rights laws and do not discriminate on the basis of race, color, national origin, ancestry, age, disability, sex, marital status, gender, sexual orientation, gender identity, or religion. Humana Inc. and its subsidiaries do not exclude people or treat them differently because of race, color, national origin, ancestry, age, disability, sex, marital status, gender, sexual orientation, gender identity, or religion. English: ATTENTION: If you do not speak English, language assistance services, free of charge, are available to you. Call 1‐877‐320‐1235 (TTY: 711). Español (Spanish): ATENCIÓN: Si habla español, tiene a su disposición servicios gratuitos de asistencia lingüística. Llame al 1‐877‐320‐1235 (TTY: 711). 繁體中文(Chinese):注意:如果您使用繁體中文,您可以免費獲得語言援助 服務。請致電 1‐877‐320‐1235 (TTY: 711)。 Kreyòl Ayisyen (Haitian Creole): ATANSION: Si w pale Kreyòl Ayisyen, gen sèvis èd pou lang ki disponib gratis pou ou. Rele 1‐877‐320‐1235 (TTY: 711). Polski (Polish): UWAGA: Jeżeli mówisz po polsku, możesz skorzystać z bezpłatnej pomocy językowej. Zadzwoń pod numer 1‐877‐320‐1235 (TTY: 711). 한국어 (Korean): 주의: 한국어를 사용하시는 경우, 언어 지원 서비스를 무료로 이용하실 수 있습니다. 1‐877‐320‐1235 (TTY: 711)번으로 전화해 주십시오. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: DFSort to pull the latest record date
On Fri, 25 Sep 2020 10:25:13 -0700, Sri h Kolusu wrote: > >... The control statements for DFSORT >are not obscure and they are on the same level as following the >coding/syntax rules for a programming language. For example COBOL, you >would follow all the rules governing it. So why not do the same for DFSORT? > The comments in your example provided the necessary clarity. >... >Aren't the programs depending on the input file attributes? For example a >COBOL program written to handle a FB 80 byte file will NOT work with FB 100 >byte file. You need to write another program to handle it. With DFSORT >there is absolutely no change in the control cards for different LRECL as >long as the key fields are the same. > I hope that information could be gleaned from the data set label. Rexx, at least works that way. I'd be optimistic for PL/I to do likewise; perhaps pessimistic for COBOL. But a COBOL advocate might correct me. -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: DFSort to pull the latest record date
On Fri, 25 Sep 2020 14:08:30 -0300, Clark Morris wrote: > >Given the obscurity of the control statements (quick tell me what >field is 1,4,CH) why not write the thing in a language that has access >to the descriptions of the fields being used? We are not in the era >of 22K DOS360 partitions, 100K MVT regions or 4 megabyte MVS regions >anymore. PL1 and COBOL both generate fairly efficient code and when >the tool becomes more than one off wonder, someone else can pick up >the program and have a fighting chance of understanding what was being >done. > Kolusu gave an answer which appears to be, "take the first record after sort descending with: SORT FIELDS=(01,14,CH,A, $ ITEM_NBR + STORE_NBR 26,10,UFF,D) $ ITEM_DATE That's well-commented; as clear as naming the fields in a COBOL record definition. The possible advantage exists if that record definition exists in a copybook and needn't be coded ad-hoc by the programmer. But a similar effect could be achieved by JCL symbols, possibly defined in a JCLLIB member, to be substituted in an instream SORTCTL. (As a novice, and accustomed only to other sort utilities, I was surprised only that the major key seems to come last.) The inconvenience of COBOL for a one-off is the need for a prior job step to compile and link into a temporary STEPLIB (or does the COBOL PROC have a compile-load-and go option?) Similarly, Rexx for a one-off requires a prior IEBGENER step to copy SYSIN to a temporary SYSEXEC (but I've done something similar with IKJEFT01: REPRO; EXEC.) But does RT ever author his own SORTCTL, or always appeal to the list to do it for him? -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: DFSort to pull the latest record date
Excel is awful to use. I would recommend doing as much as possible elsewhere before loading into Excel. (Including what some of my code does: Creating the CSV files in DFSORT.) Cheers, Martin Martin Packer Systems Investigator & Performance Troubleshooter, IBM +44-7802-245-584 email: martin_pac...@uk.ibm.com Twitter / Facebook IDs: MartinPacker Blog: https://mainframeperformancetopics.com Mainframe, Performance, Topics Podcast Series (With Marna Walle): https://anchor.fm/marna-walle Youtube channel: https://www.youtube.com/channel/UCu_65HaYgksbF6Q8SQ4oOvA From: Sri h Kolusu To: IBM-MAIN@LISTSERV.UA.EDU Date: 25/09/2020 18:34 Subject:[EXTERNAL] Re: DFSort to pull the latest record date Sent by:IBM Mainframe Discussion List >>If you can load to EXCEL - use its functions Not all functions on the mainframe can do everything. You should look at what makes sense. And if the tool you are comfortable in using, does not have the function, I would say to find one that does. Lizette, EXCEL is limited to 1 million records. And it would take a lot of time to load it and then sort it and then eliminate the duplicates. >>Not all functions on the mainframe can do everything. You should look at what makes sense. And if the tool you are comfortable in using, does not have the function, I would say to find one that does. If the file is on mainframe, a Program/Utility should be able to handle it. Thanks, Kolusu -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: DFSort to pull the latest record date
Totally agree Just trying to provide alternatives that might make sense. I know I love SAS and I tend to do everything in SAS. But my co workers do not use it. So then I either have to super document the process so they can support it Or find alternatives to do the work that they would be able to support. Today, most users know a little bit about SQL. So a Data base functions starts to make more sense. It is all a matter of perspective. Lizette -Original Message- From: IBM Mainframe Discussion List On Behalf Of Sri h Kolusu Sent: Friday, September 25, 2020 10:34 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: DFSort to pull the latest record date >>If you can load to EXCEL - use its functions Not all functions on the mainframe can do everything. You should look at what makes sense. And if the tool you are comfortable in using, does not have the function, I would say to find one that does. Lizette, EXCEL is limited to 1 million records. And it would take a lot of time to load it and then sort it and then eliminate the duplicates. >>Not all functions on the mainframe can do everything. You should look >>at what makes sense. And if the tool you are comfortable in using, does not have the function, I would say to find one that does. If the file is on mainframe, a Program/Utility should be able to handle it. Thanks, Kolusu -- 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 to pull the latest record date
Thanks a lot Kolusu for the help.. it worked like a charm!! -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: DFSort to pull the latest record date
>>If you can load to EXCEL - use its functions Not all functions on the mainframe can do everything. You should look at what makes sense. And if the tool you are comfortable in using, does not have the function, I would say to find one that does. Lizette, EXCEL is limited to 1 million records. And it would take a lot of time to load it and then sort it and then eliminate the duplicates. >>Not all functions on the mainframe can do everything. You should look at what makes sense. And if the tool you are comfortable in using, does not have the function, I would say to find one that does. If the file is on mainframe, a Program/Utility should be able to handle it. Thanks, Kolusu -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: DFSort to pull the latest record date
> Given the obscurity of the control statements (quick tell me what > field is 1,4,CH) why not write the thing in a language Clark, I have to respectfully disagree with you. The control statements for DFSORT are not obscure and they are on the same level as following the coding/syntax rules for a programming language. For example COBOL, you would follow all the rules governing it. So why not do the same for DFSORT? >> PL1 and COBOL both generate fairly efficient code and when > the tool becomes more than one off wonder, someone else can pick up > the program and have a fighting chance of understanding what was being > done. Aren't the programs depending on the input file attributes? For example a COBOL program written to handle a FB 80 byte file will NOT work with FB 100 byte file. You need to write another program to handle it. With DFSORT there is absolutely no change in the control cards for different LRECL as long as the key fields are the same. DFSORT has come a long way from being just a sort product. It can do a lot. 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 to pull the latest record date
Why not load the data into a DB and use SQL or similar language? If you have SAS - Max Min - functions If you can load to EXCEL - use its functions Not all functions on the mainframe can do everything. You should look at what makes sense. And if the tool you are comfortable in using, does not have the function, I would say to find one that does. Hope that helps Lizette -Original Message- From: IBM Mainframe Discussion List On Behalf Of Ron Thomas Sent: Friday, September 25, 2020 9:55 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: DFSort to pull the latest record date Hello We are using DFSORT utility to extract the latest record for a store/item/po and below is the sample file item_nbr| Store_nbr|Po_nbr|item_date|mode| 00604|9137|1100276393|2017-12-26|7|DSD | 00604|9137|1100278550|2018-01-09|6|DSD | Here we need to pull the 2'nd record to the Output as this is the latest date . Could someone please let me know how to achieve the same Regards Ron T -- 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 to pull the latest record date
> Here we need to pull the 2'nd record to the Output as this is the > latest date . Ron, Use the following DFSORT/ICETOOL JCL which will give you the desired results //STEP0100 EXEC PGM=ICETOOL //TOOLMSG DD SYSOUT=* //DFSMSG DD SYSOUT=* //IN DD * +1+2+3+4+5+6 00604|9137|1100276393|2017-12-26|7|DSD | 00604|9137|1100278550|2018-01-09|6|DSD | 00605|9138|1100276393|2020-06-26|7|DSD | 00605|9138|1100278550|2018-01-09|6|DSD | //OUT DD SYSOUT=* //TOOLIN DD * SELECT FROM(IN) TO(OUT) ON(01,14,CH) FIRST USING(CTL1) //CTL1CNTL DD * SORT FIELDS=(01,14,CH,A, $ ITEM_NBR + STORE_NBR 26,10,UFF,D) $ ITEM_DATE /* 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 to pull the latest record date
[Default] On 25 Sep 2020 09:54:45 -0700, in bit.listserv.ibm-main ron5...@gmail.com (Ron Thomas) wrote: >Hello > >We are using DFSORT utility to extract the latest record for a store/item/po >and below is the sample file > >item_nbr| Store_nbr|Po_nbr|item_date|mode| >00604|9137|1100276393|2017-12-26|7|DSD | >00604|9137|1100278550|2018-01-09|6|DSD | > >Here we need to pull the 2'nd record to the Output as this is the latest date >. > >Could someone please let me know how to achieve the same Given the obscurity of the control statements (quick tell me what field is 1,4,CH) why not write the thing in a language that has access to the descriptions of the fields being used? We are not in the era of 22K DOS360 partitions, 100K MVT regions or 4 megabyte MVS regions anymore. PL1 and COBOL both generate fairly efficient code and when the tool becomes more than one off wonder, someone else can pick up the program and have a fighting chance of understanding what was being done. Clark Morris > >Regards >Ron T > >-- >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
DFSort to pull the latest record date
Hello We are using DFSORT utility to extract the latest record for a store/item/po and below is the sample file item_nbr| Store_nbr|Po_nbr|item_date|mode| 00604|9137|1100276393|2017-12-26|7|DSD | 00604|9137|1100278550|2018-01-09|6|DSD | Here we need to pull the 2'nd record to the Output as this is the latest date . Could someone please let me know how to achieve the same Regards Ron T -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN