I wanted to use my old ISPF panel for GNU grep that I created over 10 years ago. Unfortunately the variant of grep that was part f s390utils that we used to have on our system is no longer avaiable.
I have recently set up zopen.community - the latest attempt to port open source tools to z/OS. It works very well, but has one small flaw. It does not support working with datasets.
With the old s390util variant of GNU grep I could have run a script like this
//GREP EXEC PGM=BPXBATSL BPXBATSL PRESERVES DDNAMES (SPAWN)
//* BPXBATCH DOES NOT (FORK+EXEC)
//*
//* IBM Grep is sitll corupted
//* GNU Grep does not understand LOCALE under z/OS
//* sad story ... use sed instead
//*
//STDIN DD PATH='/dev/null',PATHOPTS=(ORDONLY)
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDENV DD *
LC_ALL=En_US.IBM-037
//STDPARM DD DATA,DLM=@@
PGM
/sys/s390util/bin/grep
-ir
-f //dd:script
//'SYS1.MACLIB'
@@
//SCRIPT DD DATA,DLM=$$
¬CVTMAP\>
$$
//
To search fo the word CVTMAP starting at the beginning of some record
in SYS1.MACLIB
. Note the not character ¬
in the pattern. Because the JCL is encoded in the traditional MVS EBCDIC IBM-037 and the grep utility is compiled for Unix System Services with the standard
USS EBCIDIC IBM-1047 I had to change what you would expect to be ’^’ into ’¬’.
There are three characters (that mattered to me so far) that are different between IBM-027 and IBM-1047 and ’^’ is one of them. The other two are the squqre brackets ’[’ ’]’. Maybe one day I will understand why IBM had to create the 1047 codepage when they were adding the “open eddition” unix to MVS.