In the spirit of MEMO XMASGIFT,
and just for the sake of completeness, I'll paste in my "ONELINE EXEC"
(which uses CMPRREXX EXEC if it is accessed) and adds some minor, nice
features with better identification of the source exec.
Mike Walter
Hewitt Associates
Any opinions expressed herein are mine alone and do not necessarily
represent the opinions or policies of Hewitt Associates.
/* Prolog; See Epilog for additional information ********************
* Exec Name - ONELINE EXEC *
* Unit Support - IS *
* Status - Version 2, Release 1.3 *
********************************************************************/
vers='V2R1.3'
address COMMAND
parse source . . xfn xft xfm .
parse upper arg ifn ift ifm ofn oft ofm . '(' options ')'
If ifn='' | ifn='?' then Signal Explain
If ift='' then ift='EXEC'
If ifm='' then ifm='*'
If ofn='' | ofn='=' then ofn=ifn
If oft='' | oft='*' then
If ift='EXEC'
then oft='1$EXEC'
else If ift='XEDIT'
then oft='1$XEDIT'
else oft='ONELINE'
If oft='=' then oft=ift
If ofm='' then ofm='A'
If ofm='=' then ofm=ifm
'PIPE' ,
'| COMMAND LISTFILE' ifn ift ifm '(NOHEADER LABEL ISODATE' ,
'| VAR indata'
If rc<>0 then
Do
say indata
Exit rc
End
parse var indata ifn ift ifm irecfm ilrecl irecs iblks ,
iisodate itime ilabel .
'PIPE' ,
'| COMMAND LISTFILE' ifn ift ifm '(NOHEADER LABEL' ,
'| VAR indata'
parse var indata . . . . . . . ,
iudate . .
say xfn xft 'processing input='ifn ift ifm', output='ofn oft ofm'.'
'STATEW * *' ofm
If rc<>0 then
Do
say 'Output filemode' ofm 'is not Linked/Accessed Read/Write.'
Exit rc
End
?replace=0
?newdate=0
invopts=''
Do while options<>''
parse var options opt options
Select
When abbrev('REPLACE',opt,3) then ?replace=1
When abbrev('NEWDATE',opt,4) then ?newdate=1
Otherwise invopts=invopts opt
End
End
If invopts<>'' then
Do
say 'Invalid options found:' strip(invopts,'B')
Exit 20
End
'PIPE CMS LISTFILE' ofn oft ofm /* STATE checks extensions, too */
If rc=0 & \?replace then
Do
say ofn oft ofm 'already exists. If not needed, use the',
'REPLACE option.'
Exit 12
End
'ERASE' ofn oft ofm
'STATE CMPRREXX REXX *' /* PIPE's compresser avail? */
?cmprrexx=(rc=0)
/* Note: IBM's ONELINE EXEC leaves the first line that */
/* starts with: /**/ ---about 111 blanks--- trace o */
/* untouched. IBM's ONELINE expects that the calling EXEC */
/* will replace that comment and blanks with some of it's */
/* own documentation. Since the EXEC to be ONELINE'd may */
/* contain a comment block before that '/**/' line, we must */
/* check the first bunch (an arbitrary limit) of lines. */
/* IBM's ONELINE also appears to delete comments before the */
/* first: /**/ */
'PIPE <' ifn ift ifm '| TAKE 20 | STEM rec.'
parse var rec.1 w1 .
parse var w1 w1 3 .
If w1<>"/*" then
Do
say 'Input file:' ifn ift ifm 'does not begin with a REXX' ,
'comment line.'
Exit 16
End
?IBMstyle=0
Do ix=1 to rec.0
parse upper var rec.ix w1 w2 w3 w4 w5
If w1<>'/**/' | w2<>'TRACE' | w4<>'' then Iterate
?IBMstyle=1
Leave
End
If \?cmprrexx then
Do
SIGNAL ON ERROR
'COPYFILE' ifn ift ifm 'X$EUPD$X CMSUT1' ofm '(REPLACE'
/* Following X$EUPD$X XEDIT S dated 7/22/04 and is used to */
/* delete the standard (non-EXECUPDT "/*! */") comments. */
/* If a comment leads any command, the output can end up */
/* with spaces in front of it rather than left adjusted. */
'XEDIT X$EUPD$X CMSUT1' ofm '( PROF X$EUPD$X NOMSG ) 0'
'PIPE < X$EUPD$X CMSUT1' ofm '| STEM rec.'
/* Use of X$EUPD$X causes "IBMstyle" EXECs to have the 1st */
/* "IBMstyle" line broken into two lines, with the 1st line */
/* being "/* X$EUPD$X CMSUT1 */" and the second line being */
/* a bunch of spaces ending with: trace 'o'. */
If ?IBMstyle then
Do
rec.1=left('/*' ifn ift '*/',131) "trace 'o'"
rec.2=''
End
Else rec.1='/*' ifn ift '*/'
'ERASE X$EUPD$X CMSUT1' ofm
End
/* Insert a "trace 'o'" for later diagnostic capabilities. */
isodate=date('S',date('U'),'U','-','/')
If ?IBMstyle then longline='' /* IBM will replace line 1 */
Else
longline='/*' ifn ift ifm 'processed by: ONELINE EXEC' vers ,
'-' left(date('W'),3) isodate time() ,
'Input was:' ifn ift ifm irecfm ilrecl irecs iblks ,
iisodate itime ilabel '*/;/* trace 'o' */;'
maxlrecl=65535
If ?cmprrexx then
Do /* Do it the easy way */
If ?IBMstyle then
'PIPE (end ? long) <' ifn ift ifm ,
'| FRLABEL /**/' , /* Skip all before */
'| hold: DROP 1' , /* Pass rec 1 thru */
'| CMPRREXX % NODATE' , /* Don't add date/time*/
'| fin: FANIN 1 0' , /* Join rec 1 at start*/
'| JOIN * /;/' , /* Merge these, too */
'| >' ofn oft ofm 'F' , /* Fixed has no rec max */
'? hold:' ,
'| DROP 0' , /* Just pass back rec */
'| fin:' /* Return to main pipe*/
Else
'PIPE (long) <' ifn ift ifm , /* OK to be > 65K! */
'| CMPRREXX % NODATE' ,
'| CHANGE コ/* */ココ' , /* Del. CMPRREXX comnt*/
'| CHANGE ココ'longline'コ' , /* Little more detail */
'| >' ofn oft ofm 'F' /* Fixed has no record max */
End
Else /* The hard way... */
Do
/* This routine packs the commands together with only a ';' */
/* between each command (no spaces). Since it will add a */
/* ';' as a command separator, we will delete any trailing */
/* ';'s from the input record. */
/* In addition, since commas used as command continuations */
/* are invalid on a single line, trailing commas are also */
/* deleted from the input. Since an input record which had */
/* a trailing comma (which we deleted before adding the */
/* record to the longline) might happen to be the last */
/* command in 'longline' before it is written, we must keep */
/* track of whether the previous record had a continuation */
/* so the trailing ';' we added can be replaced by a ','. */
/* If the previous record ended with a quoted string and */
/* was continued to another quoted string, don't abutt the */
/* quotes (or two '' will be interpreted as a single '. */
If ?IBMstyle then begin=1
else begin=2
Do ix=begin to rec.0
If rec.ix='' then Iterate
rec=strip(strip(rec.ix,'B'),'T',';')
parse var rec char1 2 .
revrec=reverse(rec)
parse var revrec endchar 2 rest
rest=strip(rest,'L')
parse var rest endcharm1 2 .
If endchar=',' then
rec=strip(strip(rec,'T',','),'T')
longlinelen=length(longline)
If length(rec)+longlinelen > maxlrecl then
Do
If PrevRecEndChar=',' then
longline=overlay(',',longline,longlinelen,1)
'EXECIO 1 DISKW' ofn oft ofm '(VAR LONGLINE'
longline=rec||';'
End
Else
Do
reqblank=''
If PrevRecEndChar=',' & (char1='"' | char1="'") & ,
(PrevRecEndCharM1="'" | PrevRecEndCharM1='"') then
reqblank=' '
If endchar=','
then longline=longline||reqblank||rec||' '
else longline=longline||reqblank||rec||';'
End
PrevRecEndChar=endchar
PrevRecEndCharM1=endcharm1
End
If longline<>'' then
'EXECIO 1 DISKW' ofn oft ofm '(FINIS VAR LONGLINE'
End
If \?newdate then
'DMSPLU' ofn oft ofm right(iudate,8,0) right(itime,8,0)
SIGNAL OFF Error
Exit rc
Error:
say xfn xft 'failed at line' sigl', the contents of that line were:'
say sourceline(sigl)
Exit rc
Explain:
say 'The ONELINE EXEC is used to compress other EXECs into'
say 'one long line. This is done by using PIPEs CMPRREXX if,'
say 'available, or by using EXECUPDT logic to delete all'
say 'comments (except those in EXECUPDT-type format where'
say 'comments begin in column 1 with: /*! ), all blank lines'
say 'and all leading and trailing blanks on each record.'
say
say 'The resultant records are packed together on one line with'
say 'REXX''s instruction separator ";" between them.'
say
say 'Lines continued with a "," are handled properly.'
say 'If the resultant line exceeds 65,535 bytes, it is broken at'
say 'suitable points into additional long records.'
say
say 'The command syntax is (defaults are underlined):'
say ' ----------'
say
say 'ONELINE in_fname <EXEC|in_ftype> <*|in_fmode>'
say ' ---- - '
say
say ' <=|out_fname> <1$EXEC|1$XEDIT|ONELINE|=|*|out_ftype>' ,
'<A|=|out_fmode>'
say ' - ______ _______ _______ ' ,
' _ '
say
say ' <( <REPlace> <NEWDate> >'
say
Exit
/* Epilog ***********************************************************
* Function - Compress EXECs into one long line to speed *
* initiation (single I/O). Also produces a more *
* difficult EXEC to 'swipe' and diagnose. *
* Component of - System Programmer's Tool Kit *
* Command format- See 'Explain', above. *
* Called by - Smart Systems Programmers *
* Dependencies - VM/SP 3 or higher. *
* - X$EUPD$X XEDIT S (part of EXECUPDT EXEC) *
* Program Lang. - CMS REXX *
* Date Written - 12/20/91 *
* Author - Michael R. Walter *
* Changed | By | Description of Change *
* --------+-----+------------------------------------------------- *
* 01/07/92 mrw - Support IBM's (IBMstyle) commenting at start. *
* 06/11/93 mrw - Include 'LISTFILE ... (LABEL' stats in comment. *
* 06/23/93 mrw - Handle lines ending with: ,, *
* 07/16/93 mrw - Prevent lines ending with: 'string', *
* continued with: 'more' *
* from being concatenated as: 'string''more' *
* - Default out_ftype for EXEC and XEDIT to *
* 1$EXEC and 1$XEDIT respectively. *
* 07/21/93 mrw - If out_ftype entered as '*', use computed out_ft *
* 08/02/93 mrw - Add support for CMPRREXX REXX stage. *
* 10/28/93 mrw - More PIPEs, less EXECIO. *
* - Better handling of IBMstyle with CMPRREXX. *
* - Remove CMPRREXX's date/time and '/* */' *
* 07/01/99 mrw - Change COPYFILE (DATE to use DMSPLU. *
* 20010118 mrw - Default to OLDDATE *
* - Use isodate for commenting. *
* 20071227 mrw - Chg boolean variables from $varname to ?varname *
* - Correct spelling of IBM's ONELINE. *
* - Change "logical not" char (not on PC keyboard, *
* often xlated wrong) to backslash. *
* *
********************************************************************/
"Wakser, David" <[EMAIL PROTECTED]>
Sent by: "The IBM z/VM Operating System" <[email protected]>
12/27/2007 03:56 PM
Please respond to
"The IBM z/VM Operating System" <[email protected]>
To
[email protected]
cc
Subject
Re: EXEC to "compress" EXECs
Thanks, but I don't believe this will be a problem.
David Wakser
From: The IBM z/VM Operating System [mailto:[EMAIL PROTECTED] On
Behalf Of Huegel, Thomas
Sent: Thursday, December 27, 2007 4:53 PM
To: [email protected]
Subject: Re: EXEC to "compress" EXECs
I was playing with this and hit a 'gotcha'.
If you have this call: SOURCELINE() it always returns one line which is
now the whole program.
Probably not used that often but it is something to be aware of.
-----Original Message-----
From: The IBM z/VM Operating System [mailto:[EMAIL PROTECTED]
Behalf Of Wakser, David
Sent: Tuesday, December 25, 2007 10:32 AM
To: [email protected]
Subject: Re: EXEC to "compress" EXECs
Thanks, Dave - I figured it out.
David Wakser
-----Original Message-----
From: The IBM z/VM Operating System [mailto:[EMAIL PROTECTED] On
Behalf Of Dave Jones
Sent: Tuesday, December 25, 2007 11:28 AM
To: [email protected]
Subject: Re: EXEC to "compress" EXECs
Hi, David.
You can invoke it like so:
PIPE < rexx exec a | FPLCMPRX | > compressed_rexx exec a
where "rexx exec a" is the Rexx exzec to be compressed.
Merry Christmas.
DJ
Wakser, David wrote:
> Thanks, Bruce! I found it and it sounds exactly what I need. Do I need
> to re-name (or rather, copy) it to a type EXEC? Or is it meant to be
> invoked by another program (like PIPES)? If the latter, how?
>
> David Wakser
>
> -----Original Message-----
> From: The IBM z/VM Operating System [mailto:[EMAIL PROTECTED]
> On Behalf Of Bruce Hayden
> Sent: Tuesday, December 25, 2007 11:04 AM
> To: [email protected]
> Subject: Re: EXEC to "compress" EXECs
>
> What you're looking for is FPLCMPRX REXX on the 190 (S) disk. It was
> renamed when Pipes was put into CMS.
>
> On Dec 24, 2007 5:28 PM, Wakser, David <[EMAIL PROTECTED]>
> wrote:
>>
>> Do you know what the COMPREXX state is - referenced by someone else?
>> It sounds exactly like what I am looking for.
>>
>> David Wakser
>
> --
> Bruce Hayden
> Linux on System z Advanced Technical Support Endicott, NY
--
DJ
V/Soft
z/VM and mainframe Linux expertise, training,
consulting, and software development
www.vsoft-software.com
The information contained in this e-mail and any accompanying documents may
contain information that is confidential or otherwise protected from
disclosure. If you are not the intended recipient of this message, or if this
message has been addressed to you in error, please immediately alert the sender
by reply e-mail and then delete this message, including any attachments. Any
dissemination, distribution or other use of the contents of this message by
anyone other than the intended recipient is strictly prohibited. All messages
sent to and from this e-mail address may be monitored as permitted by
applicable law and regulations to ensure compliance with our internal policies
and to protect our business. Emails are not secure and cannot be guaranteed to
be error free as they can be intercepted, amended, lost or destroyed, or
contain viruses. You are deemed to have accepted these risks if you communicate
with us by email.