Very nice Peter.  I also like using awk in JCL with datasets, although I prefer 
just to put the scripts in zFS, like source code :-)

Much of my use of awk are small, quick, and dirty.    It's often mixed in with 
pipes of other shell commands.  It's nice to be able to put your shell and awk 
code inline in the JCL :

// EXEC  PGM=COZBATCH  friends don't let friends use BPXBATCH :-)
//INPUT  DD DISP=SHR,DSN=...
//STDOUT DD ...
//STDIN  DD *
   awk  '
    ...
    ...
    '  //DD:INPUT
//
 
BTW:  z/OS awk is really disappointing to use if you are accustomed to using 
gawk on linux.   
I look forward to trying David Crayford's new port of gawk.

Kirk Wolf
Dovetailed Technologies
http://dovetail.com

Co:Z is available free under the terms of our Community License.
http://dovetail.com/support.html


On Tue, Dec 21, 2021, at 9:46 AM, Farley, Peter x23353 wrote:
> 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 <[email protected]> On Behalf Of 
> Paul Gilmartin
> Sent: Sunday, December 19, 2021 3:07 PM
> To: [email protected]
> 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 [email protected] with the message: INFO IBM-MAIN
> 

Kirk Wolf
Dovetailed Technologies
http://dovetail.com

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to