I keep various awk "function packages" in separate members in the PDS. Each one has functions I may use in the real program, which is always the last one in the concatenation.
CSVSPLIT has an awk field-splitter function for input CSV-format files that I wrote decades ago. STRFUNCS has a few string functions like LTrim, RTrim, Trim, Center, LPad, RPad, etc. that I have found useful at various times over the years. The two *TIME members in the SCRIPT DD have crude awk-language implementations of the gawk standard functions with that name because z/OS awk does not have them and I needed a minimal crude implementation for a data generation project I needed to do. Also, z/OS awk does not (I think) support the gawk "@include" functionality that allows one to keep such function packages in separate files but not have to mention them on the awk command line (multiple "-f" parameters and file names on the awk command line does effectively the same thing as the concatenated DD I use). HTH Peter -----Original Message----- From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of Nash, Jonathan S. Sent: Tuesday, December 21, 2021 2:54 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: AWK ? - Re: Top 8 Reasons for using Python instead of REXX for z/OS OMG I got it to work !! Thank you very much !! Why did your JCL have so many members in the SCRIPT DD ? I put member in with a simple AWK program . -----Original Message----- From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of Farley, Peter x23353 Sent: Tuesday, December 21, 2021 10:46 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: [EXTERNAL] Re: AWK ? - Re: Top 8 Reasons for using Python instead of REXX for z/OS Technically you are correct - I depend on the undocumented fact that the awk implementation on z/OS Unix uses the fopen() function which supports DD statement file descriptions (//DD:ddname). Given IBM's legendary support for backwards compatibility, I sincerely doubt they will ever change this, though of course they certainly could. I only use awk in non-production test jobs for research and test data generation for regression tests, so no business impact if ever this changed. Typical JCL example: //AWKSPLIT EXEC PGM=BPXBATSL,MEMLIMIT=256M, // PARM='PGM /bin/awk --f //DD:SCRIPT //DD:TEXTIN' //STDOUT DD DISP=(NEW,CATLG,CATLG), // DSN=output.qsam.file,.name, // UNIT=TEST,SPACE=(CYL,(1,1),RLSE), // DSORG=PS,RECFM=VB,LRECL=8004,BLKSIZE=0,BUFNO=31 //STDERR DD SYSOUT=* //SCRIPT DD DISP=SHR,DSN=TSOUSER.TEST.AWK(CSVSPLIT) // DD DISP=SHR,DSN=TSOUSER.TEST.AWK(STRFUNCS) // DD DISP=SHR,DSN=TSOUSER.TEST.AWK(STRFTIME) // DD DISP=SHR,DSN=TSOUSER.TEST.AWK(MKTIME) // DD DISP=SHR,DSN=TSOUSER.TEST.AWK(NEWTESTS) //TEXTIN DD DISP=SHR,DSN=input.qsam.or.pds.with.member.name, // BUFNO=31 //STDIN DD DUMMY // My awk scripts are kept in a normal PDSE created using the IBM1047 code page (ISPF terminal type 28, 3278L1). HTH Peter -----Original Message----- From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of Paul Gilmartin Sent: Sunday, December 19, 2021 3:07 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: AWK ? - Re: Top 8 Reasons for using Python instead of REXX for z/OS EXTERNAL EMAIL On Sun, 19 Dec 2021 19:13:53 +0000, Farley, Peter x23353 wrote: >I have been using awk from JCL using DD's as script source, input and output >files for years now. There is no issue using awk in normal JCL. I even use a >gawk script for decoding CSV input that I wrote literally decades ago in my >JCL-invoked awk steps. > Does IBM support all that, or are you relying on "unpredictable" behavior? >JCL examples available on request. > Please. Especially "using DD's as script source". (Or do you just copy to a UNIX temporary file?) Thanks, gil -- 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