Re: How to get last node in DFSORT
Use REXX REVERSE function. Then parse out the first value. Reverse it again. On Sat, May 23, 2020 at 5:57 AM Billy Ashton wrote: > Hi folks! This should be easy, but it escapes me... > > I have an 80-byte LRECL list of filenames (starting in col 1, varying > lengths), and I need to capture just the last node of the file, and > store it as a separate word on the record, in col 51. > > For example, if the file has > JOSEPH.CONTROL.SAMPLIB.JCL > PRODUCTION.CONTROL.VSAM.DATABASE.INDEX > > I would like the records to be > JOSEPH.CONTROL.SAMPLIB.JCL(now here 24 spaces)JCL > PRODUCTION.CONTROL.VSAM.DATABASE.INDEX(12 spaces)INDEX > > I expect I can use a Parse statement, but not sure how to get the last > occurrence of something... > > Thanks for your help! > Billy > > -- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > -- Wayne V. Bickerdike -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: How to get last node in DFSORT
REV = REVERSE(PRODUCTION.CONTROL.VSAM.DATABASE.INDEX) PARSE VALUE REV WITH LASTNODE '. ' . LASTNODE = REVERSE(LASTNODE) On Sat, May 23, 2020 at 7:16 AM Wayne Bickerdike wrote: > Use REXX REVERSE function. > Then parse out the first value. > Reverse it again. > > > On Sat, May 23, 2020 at 5:57 AM Billy Ashton > wrote: > >> Hi folks! This should be easy, but it escapes me... >> >> I have an 80-byte LRECL list of filenames (starting in col 1, varying >> lengths), and I need to capture just the last node of the file, and >> store it as a separate word on the record, in col 51. >> >> For example, if the file has >> JOSEPH.CONTROL.SAMPLIB.JCL >> PRODUCTION.CONTROL.VSAM.DATABASE.INDEX >> >> I would like the records to be >> JOSEPH.CONTROL.SAMPLIB.JCL(now here 24 spaces)JCL >> PRODUCTION.CONTROL.VSAM.DATABASE.INDEX(12 spaces)INDEX >> >> I expect I can use a Parse statement, but not sure how to get the last >> occurrence of something... >> >> Thanks for your help! >> Billy >> >> -- >> For IBM-MAIN subscribe / signoff / archive access instructions, >> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN >> > > > -- > Wayne V. Bickerdike > > -- Wayne V. Bickerdike -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: How to get last node in DFSORT
Billy, Use the following DFSORT JCL which will give you the desired results //STEP0100 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD * A.B.C.D.E A.B.C.D.EF A.B.C.D.EFG A.B.C.D.EFGH A.B.C.D.EFGHI A.B.C.D.EFGHIJ A.B.C.D.EFGHIJK A.B.C.D.EFGHIJKL JOSEPH.CONTROL.SAMPLIB.JCL PRODUCTION.CONTROL.VSAM.DATABASE.INDEX SYS1.PARMLIB SYS5.NPLEX1.PARMLIB SYS4.UBS.EXEC SYS3.UBS.A.B.C.D SYS3.UBS.ABC.C.DE SYS3.UBS.AB.BC.DE SYS3.UBS.AB.BC.XAB //SORTOUT DD SYSOUT=* //SYSINDD * OPTION COPY INREC IFTHEN=(WHEN=INIT, PARSE=(%=(ENDAT=C' '), %01=(SUBPOS=9,FIXLEN=8)), BUILD=(01,44,%01)), IFTHEN=(WHEN=(52,1,CH,EQ,C'.'),BUILD=(01,44,53,1)), IFTHEN=(WHEN=(51,1,CH,EQ,C'.'),BUILD=(01,44,52,2)), IFTHEN=(WHEN=(50,1,CH,EQ,C'.'),BUILD=(01,44,51,3)), IFTHEN=(WHEN=(49,1,CH,EQ,C'.'),BUILD=(01,44,50,4)), IFTHEN=(WHEN=(48,1,CH,EQ,C'.'),BUILD=(01,44,49,5)), IFTHEN=(WHEN=(47,1,CH,EQ,C'.'),BUILD=(01,44,48,6)), IFTHEN=(WHEN=(46,1,CH,EQ,C'.'),BUILD=(01,44,47,7)), IFTHEN=(WHEN=(45,1,CH,EQ,C'.'),BUILD=(01,44,46,8)), IFTHEN=(WHEN=NONE,BUILD=(01,44,45,9,JFY=(SHIFT=LEFT))) /* The output from this job is A.B.C.D.E E A.B.C.D.EF EF A.B.C.D.EFG EFG A.B.C.D.EFGHEFGH A.B.C.D.EFGHI EFGHI A.B.C.D.EFGHIJ EFGHIJ A.B.C.D.EFGHIJK EFGHIJK A.B.C.D.EFGHIJKLEFGHIJKL JOSEPH.CONTROL.SAMPLIB.JCL JCL PRODUCTION.CONTROL.VSAM.DATABASE.INDEX INDEX SYS1.PARMLIBPARMLIB SYS5.NPLEX1.PARMLIB PARMLIB SYS4.UBS.EXEC EXEC SYS3.UBS.A.B.C.DD SYS3.UBS.ABC.C.DE DE SYS3.UBS.AB.BC.DE DE SYS3.UBS.AB.BC.XAB XAB Further if you have any questions, please let me know 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: How to get last node in DFSORT
/* REXX */ ADDRESS TSO 'ALLOC F(INDD) DA(OUTLIST(DSNS)) SHR REUSE' "EXECIO * DISKR INDD (STEM LINE. FINIS" DO I = 1 TO LINE.0 STR = PARSIT(LINE.I) END EXIT PARSIT: ARG STR REV = REVERSE(STR) PARSE VALUE REV WITH LASTVAR '.' . LASTVAR = REVERSE(LASTVAR) SAY STR LASTVAR RETURN STR A.B.C.D.E E A.B.C.D.EF EF A.B.C.D.EFG EFG A.B.C.D.EFGH EFGH A.B.C.D.EFGHI EFGHI A.B.C.D.EFGHIJ EFGHIJ A.B.C.D.EFGHIJK EFGHIJK A.B.C.D.EFGHIJKL EFGHIJKL JOSEPH.CONTROL.SAMPLIB.JCL JCL PRODUCTION.CONTROL.VSAM.DATABASE.INDEX INDEX SYS1.PARMLIB PARMLIB SYS5.NPLEX1.PARMLIB PARMLIB SYS4.UBS.EXEC EXEC SYS3.UBS.A.B.C.D D SYS3.UBS.ABC.C.DE DE SYS3.UBS.AB.BC.DE DE SYS3.UBS.AB.BC.XAB XAB On Sat, May 23, 2020 at 7:42 AM Sri h Kolusu wrote: > Billy, > > Use the following DFSORT JCL which will give you the desired results > > //STEP0100 EXEC PGM=SORT > //SYSOUT DD SYSOUT=* > //SORTIN DD * > A.B.C.D.E > A.B.C.D.EF > A.B.C.D.EFG > A.B.C.D.EFGH > A.B.C.D.EFGHI > A.B.C.D.EFGHIJ > A.B.C.D.EFGHIJK > A.B.C.D.EFGHIJKL > JOSEPH.CONTROL.SAMPLIB.JCL > PRODUCTION.CONTROL.VSAM.DATABASE.INDEX > SYS1.PARMLIB > SYS5.NPLEX1.PARMLIB > SYS4.UBS.EXEC > SYS3.UBS.A.B.C.D > SYS3.UBS.ABC.C.DE > SYS3.UBS.AB.BC.DE > SYS3.UBS.AB.BC.XAB > //SORTOUT DD SYSOUT=* > //SYSINDD * > OPTION COPY > INREC IFTHEN=(WHEN=INIT, > PARSE=(%=(ENDAT=C' '), > %01=(SUBPOS=9,FIXLEN=8)), > BUILD=(01,44,%01)), > IFTHEN=(WHEN=(52,1,CH,EQ,C'.'),BUILD=(01,44,53,1)), > IFTHEN=(WHEN=(51,1,CH,EQ,C'.'),BUILD=(01,44,52,2)), > IFTHEN=(WHEN=(50,1,CH,EQ,C'.'),BUILD=(01,44,51,3)), > IFTHEN=(WHEN=(49,1,CH,EQ,C'.'),BUILD=(01,44,50,4)), > IFTHEN=(WHEN=(48,1,CH,EQ,C'.'),BUILD=(01,44,49,5)), > IFTHEN=(WHEN=(47,1,CH,EQ,C'.'),BUILD=(01,44,48,6)), > IFTHEN=(WHEN=(46,1,CH,EQ,C'.'),BUILD=(01,44,47,7)), > IFTHEN=(WHEN=(45,1,CH,EQ,C'.'),BUILD=(01,44,46,8)), > IFTHEN=(WHEN=NONE,BUILD=(01,44,45,9,JFY=(SHIFT=LEFT))) > /* > > > The output from this job is > > A.B.C.D.E E > A.B.C.D.EF EF > A.B.C.D.EFG EFG > A.B.C.D.EFGHEFGH > A.B.C.D.EFGHI EFGHI > A.B.C.D.EFGHIJ EFGHIJ > A.B.C.D.EFGHIJK EFGHIJK > A.B.C.D.EFGHIJKLEFGHIJKL > JOSEPH.CONTROL.SAMPLIB.JCL JCL > PRODUCTION.CONTROL.VSAM.DATABASE.INDEX INDEX > SYS1.PARMLIBPARMLIB > SYS5.NPLEX1.PARMLIB PARMLIB > SYS4.UBS.EXEC EXEC > SYS3.UBS.A.B.C.DD > SYS3.UBS.ABC.C.DE DE > SYS3.UBS.AB.BC.DE DE > SYS3.UBS.AB.BC.XAB XAB > > > Further if you have any questions, please let me know > > > 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 > -- Wayne V. Bickerdike -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: How to get last node in DFSORT
Col 51... /* REXX */ ADDRESS TSO 'ALLOC F(INDD) DA(OUTLIST(DSNS)) SHR REUSE' "EXECIO * DISKR INDD (STEM LINE. FINIS" SAY '+1+2+3+4+5+6' DO I = 1 TO LINE.0 STR = PARSIT(LINE.I) END EXIT PARSIT: ARG STR REV = REVERSE(STR) PARSE VALUE REV WITH LASTVAR '.' . LASTVAR = REVERSE(LASTVAR) OUTSTR = INSERT(STR,LASTVAR,0,50) SAY OUTSTR RETURN STR +1+2+3+4+5+6 A.B.C.D.E E A.B.C.D.EFEF A.B.C.D.EFG EFG A.B.C.D.EFGH EFGH A.B.C.D.EFGHI EFGHI A.B.C.D.EFGHIJEFGHIJ A.B.C.D.EFGHIJK EFGHIJK A.B.C.D.EFGHIJKL EFGHIJKL JOSEPH.CONTROL.SAMPLIB.JCLJCL PRODUCTION.CONTROL.VSAM.DATABASE.INDEXINDEX SYS1.PARMLIB PARMLIB SYS5.NPLEX1.PARMLIB PARMLIB SYS4.UBS.EXEC EXEC SYS3.UBS.A.B.C.D D SYS3.UBS.ABC.C.DE DE SYS3.UBS.AB.BC.DE DE SYS3.UBS.AB.BC.XABXAB *** Proportional spacing, bah! On Sat, May 23, 2020 at 10:16 AM Wayne Bickerdike wrote: > /* REXX */ > ADDRESS TSO > 'ALLOC F(INDD) DA(OUTLIST(DSNS)) SHR REUSE' > "EXECIO * DISKR INDD (STEM LINE. FINIS" > DO I = 1 TO LINE.0 > STR = PARSIT(LINE.I) > END > EXIT > PARSIT: > ARG STR > REV = REVERSE(STR) > PARSE VALUE REV WITH LASTVAR '.' . > LASTVAR = REVERSE(LASTVAR) > SAY STR LASTVAR > RETURN STR > > A.B.C.D.E E > A.B.C.D.EF EF > A.B.C.D.EFG EFG > A.B.C.D.EFGH EFGH > A.B.C.D.EFGHI EFGHI > A.B.C.D.EFGHIJ EFGHIJ > A.B.C.D.EFGHIJK EFGHIJK > A.B.C.D.EFGHIJKL EFGHIJKL > JOSEPH.CONTROL.SAMPLIB.JCL JCL > PRODUCTION.CONTROL.VSAM.DATABASE.INDEX INDEX > SYS1.PARMLIB PARMLIB > SYS5.NPLEX1.PARMLIB PARMLIB > SYS4.UBS.EXEC EXEC > SYS3.UBS.A.B.C.D D > SYS3.UBS.ABC.C.DE DE > SYS3.UBS.AB.BC.DE DE > SYS3.UBS.AB.BC.XAB XAB > > > On Sat, May 23, 2020 at 7:42 AM Sri h Kolusu wrote: > >> Billy, >> >> Use the following DFSORT JCL which will give you the desired results >> >> //STEP0100 EXEC PGM=SORT >> //SYSOUT DD SYSOUT=* >> //SORTIN DD * >> A.B.C.D.E >> A.B.C.D.EF >> A.B.C.D.EFG >> A.B.C.D.EFGH >> A.B.C.D.EFGHI >> A.B.C.D.EFGHIJ >> A.B.C.D.EFGHIJK >> A.B.C.D.EFGHIJKL >> JOSEPH.CONTROL.SAMPLIB.JCL >> PRODUCTION.CONTROL.VSAM.DATABASE.INDEX >> SYS1.PARMLIB >> SYS5.NPLEX1.PARMLIB >> SYS4.UBS.EXEC >> SYS3.UBS.A.B.C.D >> SYS3.UBS.ABC.C.DE >> SYS3.UBS.AB.BC.DE >> SYS3.UBS.AB.BC.XAB >> //SORTOUT DD SYSOUT=* >> //SYSINDD * >> OPTION COPY >> INREC IFTHEN=(WHEN=INIT, >> PARSE=(%=(ENDAT=C' '), >> %01=(SUBPOS=9,FIXLEN=8)), >> BUILD=(01,44,%01)), >> IFTHEN=(WHEN=(52,1,CH,EQ,C'.'),BUILD=(01,44,53,1)), >> IFTHEN=(WHEN=(51,1,CH,EQ,C'.'),BUILD=(01,44,52,2)), >> IFTHEN=(WHEN=(50,1,CH,EQ,C'.'),BUILD=(01,44,51,3)), >> IFTHEN=(WHEN=(49,1,CH,EQ,C'.'),BUILD=(01,44,50,4)), >> IFTHEN=(WHEN=(48,1,CH,EQ,C'.'),BUILD=(01,44,49,5)), >> IFTHEN=(WHEN=(47,1,CH,EQ,C'.'),BUILD=(01,44,48,6)), >> IFTHEN=(WHEN=(46,1,CH,EQ,C'.'),BUILD=(01,44,47,7)), >> IFTHEN=(WHEN=(45,1,CH,EQ,C'.'),BUILD=(01,44,46,8)), >> IFTHEN=(WHEN=NONE,BUILD=(01,44,45,9,JFY=(SHIFT=LEFT))) >> /* >> >> >> The output from this job is >> >> A.B.C.D.E E >> A.B.C.D.EF EF >> A.B.C.D.EFG EFG >> A.B.C.D.EFGHEFGH >> A.B.C.D.EFGHI EFGHI >> A.B.C.D.EFGHIJ EFGHIJ >> A.B.C.D.EFGHIJK EFGHIJK >> A.B.C.D.EFGHIJKLEFGHIJKL >> JOSEPH.CONTROL.SAMPLIB.JCL JCL >> PRODUCTION.CONTROL.VSAM.DATABASE.INDEX INDEX >> SYS1.PARMLIBPARMLIB >> SYS5.NPLEX1.PARMLIB PARMLIB >> SYS4.UBS.EXEC EXEC >> SYS3.UBS.A.B.C.DD >> SYS3.UBS.ABC.C.DE DE >> SYS3.UBS.AB.BC.DE DE >> SYS3.UBS.AB.BC.XAB XAB >> >> >> Further if you have any questions, please let me know >> >> >> 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 >> > > > -- > Wayne V. Bickerdike > > -- Wayne V. Bickerdike -- For IBM-MAIN subscribe
Re: How to get last node in DFSORT
> Col 51... For some reason the original question did not arrive in my inbox, but the subsequent emails came in. So I did not see the actual requirement. So adjusted the control cards to put the last node at position 51 now. Here are the updated control cards. //SYSINDD * OPTION COPY INREC IFTHEN=(WHEN=INIT, PARSE=(%=(ENDAT=C' '), %01=(SUBPOS=9,FIXLEN=8)), BUILD=(01,44,%01)), IFTHEN=(WHEN=(52,1,CH,EQ,C'.'),BUILD=(01,44,51:53,1)), IFTHEN=(WHEN=(51,1,CH,EQ,C'.'),BUILD=(01,44,51:52,2)), IFTHEN=(WHEN=(50,1,CH,EQ,C'.'),BUILD=(01,44,51:51,3)), IFTHEN=(WHEN=(49,1,CH,EQ,C'.'),BUILD=(01,44,51:50,4)), IFTHEN=(WHEN=(48,1,CH,EQ,C'.'),BUILD=(01,44,51:49,5)), IFTHEN=(WHEN=(47,1,CH,EQ,C'.'),BUILD=(01,44,51:48,6)), IFTHEN=(WHEN=(46,1,CH,EQ,C'.'),BUILD=(01,44,51:47,7)), IFTHEN=(WHEN=(45,1,CH,EQ,C'.'),BUILD=(01,44,51:46,8)), IFTHEN=(WHEN=NONE,BUILD=(01,44,51:45,9,JFY=(SHIFT=LEFT))) /* 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: How to get last node in DFSORT
Sri, I ignored the cc51 in my first attempt. I had to post using a fixed font too, so that the last field actually did appear in cc51 as viewed. Love your work BTW. Regards. On Sat, May 23, 2020 at 10:44 AM Sri h Kolusu wrote: > > Col 51... > > For some reason the original question did not arrive in my inbox, but the > subsequent emails came in. So I did not see the actual requirement. So > adjusted the control cards to put the last node at position 51 now. Here > are the updated control cards. > > //SYSINDD * > OPTION COPY > INREC IFTHEN=(WHEN=INIT, > PARSE=(%=(ENDAT=C' '), > %01=(SUBPOS=9,FIXLEN=8)), > BUILD=(01,44,%01)), > IFTHEN=(WHEN=(52,1,CH,EQ,C'.'),BUILD=(01,44,51:53,1)), > IFTHEN=(WHEN=(51,1,CH,EQ,C'.'),BUILD=(01,44,51:52,2)), > IFTHEN=(WHEN=(50,1,CH,EQ,C'.'),BUILD=(01,44,51:51,3)), > IFTHEN=(WHEN=(49,1,CH,EQ,C'.'),BUILD=(01,44,51:50,4)), > IFTHEN=(WHEN=(48,1,CH,EQ,C'.'),BUILD=(01,44,51:49,5)), > IFTHEN=(WHEN=(47,1,CH,EQ,C'.'),BUILD=(01,44,51:48,6)), > IFTHEN=(WHEN=(46,1,CH,EQ,C'.'),BUILD=(01,44,51:47,7)), > IFTHEN=(WHEN=(45,1,CH,EQ,C'.'),BUILD=(01,44,51:46,8)), > IFTHEN=(WHEN=NONE,BUILD=(01,44,51:45,9,JFY=(SHIFT=LEFT))) > /* > > 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 > -- Wayne V. Bickerdike -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: How to get last node in DFSORT
That sounds like a great use case for regexen. -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of Billy Ashton [bill00ash...@gmail.com] Sent: Friday, May 22, 2020 3:57 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: How to get last node in DFSORT Hi folks! This should be easy, but it escapes me... I have an 80-byte LRECL list of filenames (starting in col 1, varying lengths), and I need to capture just the last node of the file, and store it as a separate word on the record, in col 51. For example, if the file has JOSEPH.CONTROL.SAMPLIB.JCL PRODUCTION.CONTROL.VSAM.DATABASE.INDEX I would like the records to be JOSEPH.CONTROL.SAMPLIB.JCL(now here 24 spaces)JCL PRODUCTION.CONTROL.VSAM.DATABASE.INDEX(12 spaces)INDEX I expect I can use a Parse statement, but not sure how to get the last occurrence of something... Thanks for your help! Billy -- 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: How to get last node in DFSORT
Kolusu, thank you so much for this. I hadn't thought about testing for each node and length like that - I will hold onto this email for some other things that are similar! Thanks again! Billy -- Original Message -- From: "Sri h Kolusu" To: IBM-MAIN@listserv.ua.edu Sent: 5/22/2020 8:44:32 PM Subject: Re: How to get last node in DFSORT Col 51... For some reason the original question did not arrive in my inbox, but the subsequent emails came in. So I did not see the actual requirement. So adjusted the control cards to put the last node at position 51 now. Here are the updated control cards. //SYSINDD * OPTION COPY INREC IFTHEN=(WHEN=INIT, PARSE=(%=(ENDAT=C' '), %01=(SUBPOS=9,FIXLEN=8)), BUILD=(01,44,%01)), IFTHEN=(WHEN=(52,1,CH,EQ,C'.'),BUILD=(01,44,51:53,1)), IFTHEN=(WHEN=(51,1,CH,EQ,C'.'),BUILD=(01,44,51:52,2)), IFTHEN=(WHEN=(50,1,CH,EQ,C'.'),BUILD=(01,44,51:51,3)), IFTHEN=(WHEN=(49,1,CH,EQ,C'.'),BUILD=(01,44,51:50,4)), IFTHEN=(WHEN=(48,1,CH,EQ,C'.'),BUILD=(01,44,51:49,5)), IFTHEN=(WHEN=(47,1,CH,EQ,C'.'),BUILD=(01,44,51:48,6)), IFTHEN=(WHEN=(46,1,CH,EQ,C'.'),BUILD=(01,44,51:47,7)), IFTHEN=(WHEN=(45,1,CH,EQ,C'.'),BUILD=(01,44,51:46,8)), IFTHEN=(WHEN=NONE,BUILD=(01,44,51:45,9,JFY=(SHIFT=LEFT))) /* 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: How to get last node in DFSORT
On Sun, 24 May 2020 05:02:24 +, Seymour J Metz wrote: >That sounds like a great use case for regexen. > Ob"When your favorite tool is a hammer ..." > >From: Billy Ashto >Sent: Friday, May 22, 2020 3:57 PM > >I have an 80-byte LRECL list of filenames (starting in col 1, varying >lengths), and I need to capture just the last node of the file, and >store it as a separate word on the record, in col 51. -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: How to get last node in DFSORT
Well, in this case the hammer is the reverse function; /\.([#$@[:upper:][:digit:]]{1,8})\n/, despite the awkward syntax, is still cleaner. Wasn't there a song on the 1960's, Lexity, Lex, YACCitty YACC? -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of Paul Gilmartin [000433f07816-dmarc-requ...@listserv.ua.edu] Sent: Tuesday, May 26, 2020 2:51 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: How to get last node in DFSORT On Sun, 24 May 2020 05:02:24 +, Seymour J Metz wrote: >That sounds like a great use case for regexen. > Ob"When your favorite tool is a hammer ..." > >From: Billy Ashto >Sent: Friday, May 22, 2020 3:57 PM > >I have an 80-byte LRECL list of filenames (starting in col 1, varying >lengths), and I need to capture just the last node of the file, and >store it as a separate word on the record, in col 51. -- gil -- 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: How to get last node in DFSORT
https://www.youtube.com/watch?v=-cHB3Rbz1OI Yakity Yak - The Coasters April 1958. In The Great Outdoors with John Candy and Twins with Arnold and Danny DeVito. On Tue, May 26, 2020 at 2:42 PM Seymour J Metz wrote: > > Well, in this case the hammer is the reverse function; > /\.([#$@[:upper:][:digit:]]{1,8})\n/, despite the awkward syntax, is still > cleaner. > > Wasn't there a song on the 1960's, Lexity, Lex, YACCitty YACC? > > > -- > Shmuel (Seymour J.) Metz > http://mason.gmu.edu/~smetz3 > > > From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of > Paul Gilmartin [000433f07816-dmarc-requ...@listserv.ua.edu] > Sent: Tuesday, May 26, 2020 2:51 PM > To: IBM-MAIN@LISTSERV.UA.EDU > Subject: Re: How to get last node in DFSORT > > On Sun, 24 May 2020 05:02:24 +, Seymour J Metz wrote: > > >That sounds like a great use case for regexen. > > > Ob"When your favorite tool is a hammer ..." > > > > >From: Billy Ashto > >Sent: Friday, May 22, 2020 3:57 PM > > > >I have an 80-byte LRECL list of filenames (starting in col 1, varying > >lengths), and I need to capture just the last node of the file, and > >store it as a separate word on the record, in col 51. > > -- gil > > -- > 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 -- Mike A Schwab, Springfield IL USA Where do Forest Rangers go to get away from it all? -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: How to get last node in DFSORT
On Tue, 26 May 2020 19:42:31 +, Seymour J Metz wrote: >Well, in this case the hammer is the reverse function; >/\.([#$@[:upper:][:digit:]]{1,8})\n/, despite the awkward syntax, is still >cleaner. > I was more thinking of the OP's requirement for DFSORT as the hammer. And Sri supplied a massive sledgehammer. Don't forget '-' is sorta legal in data set names; more characters if the DSN needn't be catalogued. And Sri's example contained a node longer than 8 bytes. And what if there are characters further to the right that must be preserved? But I assumed a terminating ' '. So: awk '{ match( $0, /\.[^. ]* / ) print( substr( $0, 1, 50) substr( $0, RSTART + 1, 8 ) substr( $0, 59 ) ) }' >Wasn't there a song on the 1960's, Lexity, Lex, YACCitty YACC? -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: How to get last node in DFSORT
> And Sri's example contained a node longer than 8 bytes. Well, if it were up to me z/OS would support cataloged data sets with longer index levels, but circumstances being what they are I'd rather not parse them. Besides, they're only valid inside of apostrophes. If the problem definition changes then the regex must change with it, but it's still fairly straightforward. Doesn't awk have captures these days? -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of Paul Gilmartin [000433f07816-dmarc-requ...@listserv.ua.edu] Sent: Tuesday, May 26, 2020 6:02 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: How to get last node in DFSORT On Tue, 26 May 2020 19:42:31 +, Seymour J Metz wrote: >Well, in this case the hammer is the reverse function; >/\.([#$@[:upper:][:digit:]]{1,8})\n/, despite the awkward syntax, is still >cleaner. > I was more thinking of the OP's requirement for DFSORT as the hammer. And Sri supplied a massive sledgehammer. Don't forget '-' is sorta legal in data set names; more characters if the DSN needn't be catalogued. And Sri's example contained a node longer than 8 bytes. And what if there are characters further to the right that must be preserved? But I assumed a terminating ' '. So: awk '{ match( $0, /\.[^. ]* / ) print( substr( $0, 1, 50) substr( $0, RSTART + 1, 8 ) substr( $0, 59 ) ) }' >Wasn't there a song on the 1960's, Lexity, Lex, YACCitty YACC? -- gil -- 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: How to get last node in DFSORT
AFAIK, no captures available in POSIX awk (i.e., what we get delivered with z/OS), only in gawk-only extended matching functions like gensub() and in gawk split() with the optional gawk-only arguments to split out parsed groups into arrays. Peter -Original Message- From: IBM Mainframe Discussion List On Behalf Of Seymour J Metz Sent: Tuesday, May 26, 2020 6:50 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: How to get last node in DFSORT > And Sri's example contained a node longer than 8 bytes. Well, if it were up to me z/OS would support cataloged data sets with longer index levels, but circumstances being what they are I'd rather not parse them. Besides, they're only valid inside of apostrophes. If the problem definition changes then the regex must change with it, but it's still fairly straightforward. Doesn't awk have captures these days? -- This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: How to get last node in DFSORT
On Tue, 26 May 2020 22:50:10 +, Seymour J Metz wrote: > >Well, if it were up to me z/OS would support cataloged data sets with longer >index levels, but circumstances being what they are I'd rather not parse them. >Besides, they're only valid inside of apostrophes. > DISABLE(DSNCHECK) supersedes most such rules. But JCL is oblivious to DISABLE(DSNCHECK). It won't let the programmer create an unconventional DSN without apostrophes nor catalog any DSN within apostrophes. Empirically, I found I couldn't create a DSN starting with a period even within apostrophes. I don't know where this is documented. -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: How to get last node in DFSORT
> Empirically, I found I couldn't create a DSN starting with a period even > within apostrophes. I don't know where this is documented. Gil, This works fine for me //STEP0100 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD * dummyrecord //SORTOUT DD PATH='/tmp/.create.dsn.with.period', // PATHMODE=(SIRWXU,SIRWXG,SIRWXO), // PATHOPTS=(OWRONLY,OCREAT,OEXCL), // PATHDISP=(KEEP,DELETE),FILEDATA=TEXT, // LRECL=80,BLKSIZE=27920,RECFM=FB //SYSINDD * OPTION COPY /* Thanks, Kolusu -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: How to get last node in DFSORT
PATH ¬= DSN -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of Sri h Kolusu [skol...@us.ibm.com] Sent: Tuesday, May 26, 2020 9:49 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: How to get last node in DFSORT > Empirically, I found I couldn't create a DSN starting with a period even > within apostrophes. I don't know where this is documented. Gil, This works fine for me //STEP0100 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD * dummyrecord //SORTOUT DD PATH='/tmp/.create.dsn.with.period', // PATHMODE=(SIRWXU,SIRWXG,SIRWXO), // PATHOPTS=(OWRONLY,OCREAT,OEXCL), // PATHDISP=(KEEP,DELETE),FILEDATA=TEXT, // LRECL=80,BLKSIZE=27920,RECFM=FB //SYSINDD * OPTION COPY /* 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: How to get last node in DFSORT
Yackity yak, don't go back. It's after Monday Morning and it's the wrong season for quarterbacks. On Wed, May 27, 2020 at 1:13 PM Seymour J Metz wrote: > PATH ¬= DSN > > > -- > Shmuel (Seymour J.) Metz > http://mason.gmu.edu/~smetz3 > > > From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf > of Sri h Kolusu [skol...@us.ibm.com] > Sent: Tuesday, May 26, 2020 9:49 PM > To: IBM-MAIN@LISTSERV.UA.EDU > Subject: Re: How to get last node in DFSORT > > > Empirically, I found I couldn't create a DSN starting with a period even > > within apostrophes. I don't know where this is documented. > > Gil, > > This works fine for me > > //STEP0100 EXEC PGM=SORT > //SYSOUT DD SYSOUT=* > //SORTIN DD * > dummyrecord > //SORTOUT DD PATH='/tmp/.create.dsn.with.period', > // PATHMODE=(SIRWXU,SIRWXG,SIRWXO), > // PATHOPTS=(OWRONLY,OCREAT,OEXCL), > // PATHDISP=(KEEP,DELETE),FILEDATA=TEXT, > // LRECL=80,BLKSIZE=27920,RECFM=FB > //SYSINDD * > OPTION COPY > /* > > > 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 > -- Wayne V. Bickerdike -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: How to get last node in DFSORT
*Yakity Yak - The Coasters April 1958. * I'm more of a Jeff Beck man. You're everywhere and nowhere baby.(Hi Ho Silver Lining). Or the inimitable Mrs Doubtfire (oooh, all over the place!). -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN